How do I use GitHub through harsh proxies?

前端 未结 3 1242
情书的邮戳
情书的邮戳 2020-12-07 19:36

Given the following constraints, how can I use GitHub from Windows and Unix?

  • All access to the internet is restricted to a proxy
  • The proxy only allows
3条回答
  •  一整个雨季
    2020-12-07 20:04

    My scenario was a little different to Jeff Tchang's (but based on his post) but might be helpful here.

    All of our workplace/corporate internet access is via a non-authenticating proxy. I was able to clone from but not push to github: running

    git push -u origin master
    

    would return

    ssh: connect to host github.com port 22: Operation timed out
    fatal: The remote end hung up unexpectedly
    

    Based on http://returnbooleantrue.blogspot.com/2009/06/using-github-through-draconian-proxies.html and http://meinit.nl/ssh-through-a-proxy-from-your-apple-mac-os-x and http://www.mtu.net/~engstrom/ssh-proxy.php I was able to download/install corkscrew and add the following to my ~/.ssh/config:

    Host github.com
      User git
      Port 22
      Hostname github.com
      TCPKeepAlive yes
      IdentitiesOnly yes
      ProxyCommand /usr/local/bin/corkscrew proxy..com 8080 %h %p 
    

    Some points to note:

    • I use my workplace/corporate private key also with GitHub: if you don't you will need to add an "IdentityFile" line

    • Unlike with Jeff Tchang (and thanks to mtu.net) I did not need to have the "~/.ssh/myauth" at the end of the ProxyCommand line

    • I did not need to set up a ssh.github.com Host section.

    Hope these help.

提交回复
热议问题