Monday, 17 January 2011

HTTPS push to Github

I have been using Github for several years now, and when it turned out that our institute's firewall does not allow SSH, I even bought an account there, in order to be able to use HTTPS-to-SSH tunneling. But recently this approach just ceased to work (maybe our ITS updated firewall settings or maybe Github changed something). And it turned out that Github now allows you to push from behind the firewall for free! The feature is called "Smart HTTP Support" (and if I weren't that lazy, I could start using it half a year ago).

So basically that's what you have to do:
1. Create ~/.netrc with the following contents:
machine github.com
login username
password yourgithubpassword
2. Protect this file from other users:
$ chmod 600 ~/.netrc
3a. Set remote path as "https://github.com/username/reponame.git" in .git/config of existing repository, or
3b. Clone the remote repository as
$ git clone https://github.com/username/reponame.git

Now you can just "git push" from behind any paranoidal proxy!

No comments:

Post a Comment