Github from behind a firewall
October 10th, 2008
Using github.com from behind a firewall
If you are like me you are slowly using github more and more, as some of the top upcoming frameworks like Merb and Rails are being hosted there.
If you are behind a firewall at work, you might not be able to clone a repository because the port used for the git protocol is 9418, so issuing a "git clone" command will timeout. You can change the protocol to http, so instead of git clone git://github.com/path/to/repo you would do git clone http://github.com/path/to/rep, sounds easy enough but it's slower when it works and many times it will not work. I have gotten output like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
walk 2707ebbbc5837619dcc51af43db18ac31380c4a5 walk 743917a6de6464dd2fa5e064f1881adba218cae6 walk 2a348104ddb2c1b2090a8ca80d21258846afd250 walk 8a9cbc1af1343bfd32ea4b473341dff364b67353 walk 1bc43720343856280ad6801562f75b3239ca4ce2 walk e9ea1557e703f2f238192d72bd2714b0af425b7c walk fbc886b9adecad2e6e9c9a13f67349cd21c01ffa walk c4dc40df63fc5cebd2f3b2cceb7c8ea20ac86776 walk 64db048595a07b70057b98731d6e957406bca913 walk 012e0629863b3ce4b98c7eebb3f5ef4ed6d7b1e8 walk 109ec6b85d66f959a83048af9e173f612b1d4009 Getting alternates list for http://github.com/sam/extlib.git Getting pack list for http://github.com/sam/extlib.git error: Unable to find abb467803fa74dfdc3740f31b4fde5544e6a4100 under http://github.com/sam/extlib.git Cannot obtain needed tree abb467803fa74dfdc3740f31b4fde5544e6a4100 while processing commit 109ec6b85d66f959a83048af9e173f612b1d4009. fatal: Fetch failed. |
I assume this is fetching each commit and processing it, but has problems
SSH Tunnel Solution
The solution is pretty simple if you have ssh access outbound from work to a machine that is not fire walled. You would setup a ssh tunnel with the following command ssh -L 9418:github.com:9418 (username)@(machine.domain) Then your clone command would be changed to git clone git://localhost/path/to/repo
Updated sake merb recipe to clone via tunnel
Edit your ~/.sake recipe and change all github.com instances to localhost



Leave a Reply