The Secret to Github at work
posted by Geoff Ford on 04 Oct 2009
Update: 2011-09-28 To this day this still remains one of the most popular posts on this site. However, since the introduction of smart http, this workaround is no longer necessary. You may want to keep this snippet handy though:
sed -i 's/git:\/\//https:\/\//g' .git/config
This will replace any references to the git protocol to the smart https protocol. This is especially handy for projects that use submodules such as AkitaOnRails' Vimfiles
We will now return to our regularly scheduled programming
You've been able to clone github repositories using http for a while now which allows you to get around proxies at work. But using this method won't allow you to push any changes back, which is a major pain point to using Github behind at my workplace.
Today, a co-worker brought this article from Justin Bailey to my attention, which describes how to use an ssh tunnel over port 443 to get push access to github.
The steps in the above are pretty clear and consice, however I added a few minor changes. Here are the steps I used to get it up and running.
- Install Putty. I used the all in one installer.
- As I use msysgit I renamed
C:\Program Files\Git\bin\ssh.exeso that Putty's ssh was used. I also copiedC:\Program Files\PuTTY\plink.exetoC:\Program Files\PuTTY\ssh.exebut I'm not sure if that is essential. - Add
C:\Program Files\PuTTY\to your PATH environment variable. - Use PuttyGen to create a putty comptible private/public key pair. Make sure you add this new public key to your Github account.
- Using PuTTY, create and save a session for github with the following characteristics:
- Set the host to ssh.github.com, port 443.
- Under Connection / SSH / Auth, select your private key file for SSH authentication.
- Under Connection / Proxy, select HTTP and enter appropriate information for the host and port.
- Save your session with a name such as “gitproxy”.
- Start up Pageant and load in the key you created in step 4.
- Clone your repository using http
- Edit
.git/configand change the remote origin to pass through the proxy you created above.[remote "origin"] fetch = +refs/heads/:refs/remotes/origin/ url = git@gitproxy:YOURGITUSERNAME/YOURGIT_REPO.git
That's it. By editing .git/config all the operations that use the default origin/master will work nicely. You can now push with a simple 'git push'.
This setup is dependant on the ssh.github.com host. Let's hope the move to Rackspace includes maintaining this useful option.
by Law Essay - Nov. 29, 2011 11:17 a.m.
It is very nice to learn how to make good programs. I have been dreaming to become a good programmer but it so happen that programming seem not to like me.
by UK Essay - Nov. 29, 2011 11:18 a.m.
It is very nice to learn how to make good programs. I have been dreaming to become a good programmer but it so happen that programming seem not to like me.
by craps tables - Dec. 5, 2011 9:26 a.m.
I was learned about this site , having a presentation to be dwell from us.
by aluminum bridge - Dec. 8, 2011 12:39 p.m.
Making a program is not easy. I studied it before but I failed to run my program the way it should be.
by jobs kenya - Dec. 22, 2011 5:43 a.m.
This will surely help a lot of programmers out there.
by jobs kenya - Dec. 22, 2011 5:43 a.m.
This will surely help a lot of programmers out there.
by jobs kenya - Dec. 22, 2011 5:44 a.m.
This will surely help a lot of programmers out there. It indicates how important those codes are.
by everett dental clinic - Jan. 20, 2012 2:52 a.m.
Its been very useful to me for I have the same process with you. Thanks on the ides.
by maryluo - Jan. 20, 2012 6:54 a.m.
I don't have any idea on this but because of this blog, It gave me information and idea about this thing. I am very much greatfull and its really my pleasure on reading this blog. keep it up! <a href="http://www.excelbridge.com/for-engineers/bridge-types">steel bridge</a> | <a href="http://www.excelbridge.com/for-owners/bridge-types">pedestrian bridges</a>