Git through a proxy

I was connected to a LAN behind a proxy. When I tried to download something from github I got this error:
fatal: unable to connect to Name or service not known

I’m running latest Ubuntu desktop (12.04).

One way I found to bypass this problem is to create a git proxy wrapper.

  1. Create the script i.e. ~/bin/ and configure the 2 variables according to your needs. My proxy is a local service which forwards my requests to the real LAN proxy. Local service is configured to listen on the 5865 port of my local ( machine.
    nc -x$proxy_address:$proxy_port -X5 $*
  2. export an environment variable
    $ export GIT_PROXY_COMMAND=~/bin/

Then you can run your usual git commands.