AlephNullPlex

Just another weblog

04
Oct

The Secret to Github at work

Bookmark and Share Comments (0)

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.

  1. Install Putty. I used the all in one installer.
  2. As I use msysgit I renamed C:\Program Files\Git\bin\ssh.exe so that Putty's ssh was used. I also copied C:\Program Files\PuTTY\plink.exe to C:\Program Files\PuTTY\ssh.exe but I'm not sure if that is essential.
  3. Add C:\Program Files\PuTTY\ to your PATH environment variable.
  4. Use PuttyGen to create a putty comptible private/public key pair. Make sure you add this new public key to your Github account.
  5. 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”.
  6. Start up Pageant and load in the key you created in step 4.
  7. Clone your repository using http
  8. Edit .git/config and 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.

Comments

Write a Comment