Github behind a proxy

2009/04/10

Suppose you have an account to github and you want to use it even when you are behind a very restrictive proxy.
The problem arises “only” when you have to push new patches, given that you can clone/pull even using http out of the box.

Luckily the github guys give us the access to another server (ssh.github.com) which basically listen on the port 443 and forwards

The informations to set up your environment can be found here:

github over proxy

And here you find:
corkscrew

This for example is my configuration (on Macosx but on linux is the same):

SSH_CONFIG

Host gitproxy
  User git
  HostName ssh.github.com
  Port 443
  ProxyCommand corkscrew <proxy> <port> %h %p
  IdentityFile /Users/andrea/.ssh/github

Now in your git repository you can simply add the new remote

git remote add git@gitproxy:<repository>

Another nice way to bypass the proxy (thanks Christian) is to use the GIT_PROXY_COMMAND variable, in this way

export GIT_PROXY_COMMAND=/usr/local/bin/proxy-cmd.sh

#!/bin/bash
(echo "CONNECT $1:$2 HTTP/1.0"; echo; cat ) | socket proxy.unitn.it 3128 | (read a; read a; cat )

And now git for every push/pull will execute that script and bypass the proxy.


Follow

Get every new post delivered to your Inbox.