If you are a developer and you work in public hotspots you have indoubtable ran into an issue where you try to pull down a repository from Github through the git://
protocol and you get this error:
fatal: unable to connect to github.com:
github.com[0: 192.30.252.128]: errno=Connection refused
Here is how I've solved it for my case (yes, there are many other ways like switching to https or http protocol).
You'll need a could based server that you can SSH into and access to your /etc/hosts
.
Do this:
ssh your-cloud-server.com -L 9418:github.com:9418
then edit your /etc/hosts
echo '127.0.0.1 github.com' | sudo tee --append /etc/hosts
How this works is Panera (and many other public wifi hosts) will block port 9418
which is the git://
protocol. So our solution is to redirect our local traffic through our cloud server (the ssh command). While this might work for one-off commands (simple git clone git://
), I had 20 repositories to clone (Rails project) and changing all the entries to use localhost
wasn't going to be productive, using the /etc/hosts
trick helps with this.