How to Setup Corkscrew to Connect to Github through Draconian Proxy

My company has a draconian proxy server that prevents me from SSHing to remove servers, and therefore preventing me from using github. I have spent the last day following examples on the web, such as

  • How do I use GitHub through harsh proxies?
  • http://tachang.tumblr.com/post/22265579539/using-github-through-draconian-proxies-windows-and

But nothing seems to be working. Here is my ~/.ssh/config file:

  • How to manage a project on GitHub that has an external git dependency not stored on GitHub
  • Git add interactive new file
  • Get the difference between two branches in Git
  • Add repository to a git tree
  • Undo a git am --abort
  • How can I troubleshoot git pull
  • ProxyCommand /usr/local/bin/corkscrew proxy02.COMPANY_NAME.com 8080 %h %p
    
    Host github.com
    User git
    Port 22
    Hostname github.com
    IdentityFile "/Users/msnider/.ssh/id_rsa"
    IdentitiesOnly yes
    TCPKeepAlive yes
    
    Host ssh.github.com
    User git
    Port 443
    Hostname ssh.github.com
    IdentityFile "/Users/msnider/.ssh/id_rsa"
    IdentitiesOnly yes
    TCPKeepAlive yes
    

    This is the error message I receive when I try to git pull --rebase:

    Proxy could not open connnection to github.com:  Forbidden
    ssh_exchange_identification: Connection closed by remote host
    fatal: Could not read from remote repository.
    
    Please make sure you have the correct access rights
    and the repository exists.
    

    I get the same forbidden error when I just try to SSH to github.com, but I can ssh to ssh.github.com if I specify my identity:

    ssh -i ~/.ssh/id_rsa git@ssh.github.com
    Hi mattsnider! You've successfully authenticated, but GitHub does not provide shell access.
    Connection to ssh.github.com closed.
    

    There is no authentication needed to connect to the proxy server.

    I have also tried setting the http_proxy and https_proxy environment variables:

    http_proxy=http://proxy02.COMPANY_NAME.com:8080
    https_proxy=http://proxy02.COMPANY_NAME.com:8080
    

    Anyone have an idea as to what I am doing wrong and how I can get this to work? Thanks.

  • svn (with git frontend) branch merging with different directory structure
  • Github windows: Commit failed: Failed to create a new commit… continued issues
  • Are all branches in git equal
  • Git submodule fails on TFS Build
  • git pre-commit hook format code - Intellij/Android Studio
  • Git move pull request from one repository to another repository
  • One Solution collect form web for “How to Setup Corkscrew to Connect to Github through Draconian Proxy”

    I have finally figured it out. My company’s proxy server blocks all communication on ports other than 80 and 443, so I cannot connect to github on port 22. I thought the examples I found on the web were to change communication from 22 to 443, but they do not.

    The problem is with this section of code from all the web examples:

    Host github.com
    User git
    Port 22
    Hostname github.com
    IdentityFile "/Users/msnider/.ssh/id_rsa"
    IdentitiesOnly yes
    TCPKeepAlive yes
    

    This says when connecting to github.com from the proxy server use the hostname github.com and port 22, which is blocked by my proxy. By changing the github.com definition to:

    Host github.com
    User git
    Port 443
    Hostname ssh.github.com
    IdentityFile "/Users/msnider/.ssh/id_rsa"
    IdentitiesOnly yes
    TCPKeepAlive yes
    

    I can finally connect to github.

    Git Baby is a git and github fan, let's start git clone.