Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

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

$ ssh -L9418:github.com:9418 myuser@myhomessh.com

And clone repositories replacing github.com 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 github.com after cloning
    git remote rm origin
    git remote add origin git://github.com/someuser/someproject.git

  2. add github.com to your hosts file and point it to 127.0.0.1

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

  4. use your favourite packet forwarder, example for Mac OS X:
    sudo ipfw add 00100 fwd 127.0.0.1,9418 tcp from me to github.com 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.

@mid9commander

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:
github.com[0: 127.0.0.1]: 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
Owner

This isn't my guide, it was just submitted by a user. There are some other guides over at http://help.github.com/firewalls-and-proxies/ 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
Something went wrong with that request. Please try again.