github配置SSH proxy

在windows users 用户目录下生成config文件,如在C:Usersyour_user_name.ssh 目录下,找到config文件,如果没有新建一个,写入如下内容:

Host github.com
Host ssh.github.com
ProxyCommand connect -H 127.0.0.1:1080 %h 22

[2020-05-31更新] 

测试连接命令

ssh git@github.com -vT  #加v会显示debug信息

 刚刚发现设置的代理不管用了。git push命令提示

ERROR: Unexpected http response: ''.
FATAL: failed to begin relaying via HTTP.
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.

测试连接提示

CreateProcessW failed error:2
posix_spawn: No such file or directory

经过搜索,猜测可能是Host的问题,原来的配置是Host github.com 。搜了一圈,感觉别人说的配置没什么不同,然后后来又测试,发现是连接不上,就想到可能是Host不对,因为搜的时候发现有个人Host写的有ssh.github.com。把Host改成这个之后可以通过连接测试。可能是github换域名解析了什么的,不清楚,反正再加一个Host。

参考链接:

https://upupming.site/2019/05/09/git-ssh-socks-proxy/

原文地址:https://www.cnblogs.com/roadwide/p/10336236.html