在window10中,使用git提交代码到Github上时拒绝连接,之前使用的时候是正常的。
在拉取、推送代码时遇到以下报错:
?ke?? git pull
kex_exchange_identification: Connection closed by remote host
Connection closed by 20.205.243.166 port 22
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
原因:
github的22端口抽风了,也有可能是代理端口屏蔽了22。
方法1:
在~/.ssh/config 配置中修改为以下的格式
Host im.github.com
HostName ssh.github.com
IdentityFile ~/.ssh/id_rsa_github_im
User im
Port 443
ProxyCommand "D:\Program Files\Git\mingw64\bin\connect.exe" -S 127.0.0.1:7890 %h %p
注意:关键点是HostName改为ssh.github.com ,
Port 改为443,
ProxyCommand 改为你本地git对应的路径