Total Pageviews

Sunday, 8 July 2012

How To Get GIT Working Behind A Firewall [Using A SOCKS Proxy]

Some GIT servers support the http protocol but some don't and if you're behind a firewall like me (at work - so I don't have control over it and most ports are blocked) you basically can't access GIT.

But with the help of WebUpd8 reader RKV and this post, I got GIT working behind a firewall using TOR.

If you don't know how to set up TOR, see the post about using Spotify and Pandora using TOR (post by rkv). You can of course use a different SOCKS proxy, but I prefer TOR for this job.

Once you have TOR up and running, enter this in a terminal:
sudo gedit /usr/bin/proxy-wrapper


And paste this in the newly created file:
#!/bin/bash
nc -xlocalhost:9050 -X5 $*


Then save the file and make it executable using the following command:
sudo chmod +x /usr/bin/proxy-wrapper


If you use Ubuntu, your version of netcat probably doesn't support the -x and -X flags. But you can install netcat-openbsd instead:
sudo apt-get install netcat-openbsd


And finally, make GIT use a SOCKS proxy using the following command:
export GIT_PROXY_COMMAND="/usr/bin/proxy-wrapper"
bash

from http://www.webupd8.org/2010/03/how-to-get-git-working-behind-firewall.html