git push代码时报错:kex_exchange_identification: Connection closed by remote host

458 阅读1分钟

检查问题

  1. 检查了github与本地的ssh key,没有问题
  2. 执行ssh -v git@github.com命令,返回
OpenSSH_for_Windows_8.1p1, LibreSSL 3.0.2
debug1: Reading configuration data C:\\Users\\hhh/.ssh/config
debug1: C:\\Users\\hhh/.ssh/config line 3: Applying options for github.com
debug1: Executing proxy command: exec connect -S 127.0.0.1:1081 -a none github.com 22
CreateProcessW failed error:2
posix_spawnp: No such file or directory

原因

可能之前tizi更新导致修改了github的访问端口

解决措施

修改C:\\Users\\hhh/.ssh/config文件

Host github.com
   HostName ssh.github.com
   User git
   Port 443

最后再验证是否有效

ssh -T git@github.com
Hi xxxxxx You've successfully authenticated, but GitHub does not provide shell access.