Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?

Create a tunnel to github with the git default daemon port like this:

$ ssh

And clone repositories replacing with localhost, like so:

$ git clone git://localhost/someuser/someproject.git

If you want to preserve the “correct” metadata, there are several options

  1. replace localhost origin with after cloning
    git remote rm origin
    git remote add origin git://

  2. add to your hosts file and point it to

  3. add to your ~/.ssh/config:
      HostName localhost

  4. use your favourite packet forwarder, example for Mac OS X:
    sudo ipfw add 00100 fwd,9418 tcp from me to dst-port 9418

    and when you are done, don’t forget to remove it:
    sudo ipfw delete 00100

    (use caution, especially if you are using ipfw already and have rule 00100 in place)

Stuck behind a corporate firewall? Justin Bailey has a good guide. Scroll down for a *nix solution as well.

Thanks for these instructions, I did all of the above and I am able to clone, but when I tried to push, I am getting these errors:[0:]: errno=Operation timed out
fatal: unable to connect a socket (Operation timed out)

Do you know what the reason might be? I really want to get git working behind my stupid corporate firewall


tekkub commented Aug 18, 2010

This isn't my guide, it was just submitted by a user. There are some other guides over at if they help. Smart HTTP might be your best bet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment