记录下github使用ssh代理的设置
前段时间想研究下git命令突然发现怎么都连不上github了就研究了下git代理的一些设置。
代理ssh传输的方式简单来说就是在 .ssh 文件夹下设置config文件中的ProxyCommand 来配置,不同操作系统的设置方法不同,这边已Windows为例
使用http代理
Host github.com
User git
ProxyCommand connect -H 127.0.0.1:7890 %h %p
使用socks5代理
Host github.com
User git
ProxyCommand connect -S 127.0.0.1:7891 %h %p
然后使用git窗口试下
ssh -T git@github.com
笑死,拒绝
kex_exchange_identification: Connection closed by remote host
Connection closed by 20.205.243.166 port 22
改下访问443端口
ssh -T -p 443 git@ssh.github.com
看到 hi 就说明没问题了
然后改下代理设置指定为443
Host github.com
HostName ssh.github.com
Port 443
User git
就可以了,最后如果要指定不同的网站用不同的私钥可以这样设置
Host github.com
HostName ssh.github.com
Port 443
User git
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa
如有错误欢迎指出
评论
问答助学
相关内容
0个评论
全部评论
点击登录,快来和大家讨论吧~
表情
图片
暂无评论
