在windows users 用户目录下生成config文件,如在C:\Users\your_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/

相关文章:

  • 2021-09-02
  • 2021-05-15
  • 2021-10-26
  • 2021-04-05
  • 2021-10-27
  • 2021-10-21
  • 2022-02-17
猜你喜欢
  • 2021-05-17
  • 2021-06-23
  • 2021-07-31
  • 2021-11-08
相关资源
相似解决方案