如何设置Corkscrew通过Draconian代理连接到Github

mat*_*der 6 git ssh proxy

我的公司有一个严格的代理服务器阻止我SSH服务器删除服务器,因此阻止我使用github.我花了最后一天关注网络上的例子,比如

但似乎没有任何效果.这是我的〜/ .ssh/config文件:

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
Run Code Online (Sandbox Code Playgroud)

这是我尝试以下时收到的错误消息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.
Run Code Online (Sandbox Code Playgroud)

当我尝试SSH到github.com时,我得到了相同的禁止错误,但如果我指定了我的身份,我可以ssh到ssh.github.com:

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.
Run Code Online (Sandbox Code Playgroud)

无需身份验证即可连接到代理服务器.

我也尝试过设置http_proxyhttps_proxy环境变量:

http_proxy=http://proxy02.COMPANY_NAME.com:8080
https_proxy=http://proxy02.COMPANY_NAME.com:8080
Run Code Online (Sandbox Code Playgroud)

任何人都知道我做错了什么以及如何让它发挥作用?谢谢.

mat*_*der 11

我终于明白了.我公司的代理服务器阻止了80和443以外的端口上的所有通信,因此我无法连接到端口22上的github.我认为我在网络上找到的例子是将通信从22改为443,但他们没有.

问题出在所有Web示例的代码段中:

Host github.com
User git
Port 22
Hostname github.com
IdentityFile "/Users/msnider/.ssh/id_rsa"
IdentitiesOnly yes
TCPKeepAlive yes
Run Code Online (Sandbox Code Playgroud)

这说当从代理服务器连接到github.com时,使用主机名github.com和端口22,它被我的代理阻止.通过将github.com定义更改为:

Host github.com
User git
Port 443
Hostname ssh.github.com
IdentityFile "/Users/msnider/.ssh/id_rsa"
IdentitiesOnly yes
TCPKeepAlive yes
Run Code Online (Sandbox Code Playgroud)

我终于可以连接到github了.