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
But nothing seems to be working. Here is my ~/.ssh/config file:
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 [email protected]
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With