GitHub连接错误:kex_exchange_identification:Connection closed by remote host

前言:

使用命令测试GitHub连接时报错:

1
2
C:\Users\miryang\Desktop\YuJiang4319.github.io>ssh -T [email protected]
kex_exchange_identification: Connection closed by remote host

解决:

  • 关掉梯子(不推荐)
  • 将 Github 的连接端口从 22 改为 443

操作:

编辑 ~/.ssh/config 文件(没有就新增),windows在用户目录下的.ssh目录,添加如下内容

1
2
3
4
Host github.com
HostName ssh.github.com
User git
Port 443

验证:

1
2
3
4
5
6
7
C:\Users\miryang\Desktop\YuJiang4319.github.io>ssh -T [email protected]
The authenticity of host '[ssh.github.com]:443 ([198.18.2.79]:443)' can't be established.
ECDSA key fingerprint is SHA256:p2QAMXNIC1TJYWeIOttrVc98/R1BUFWu3/LiyKgUfQM.
Are you sure you want to continue connecting (yes/no/[fingerprint])? y
Please type 'yes', 'no' or the fingerprint: yes
Warning: Permanently added '[ssh.github.com]:443,[198.18.2.79]:443' (ECDSA) to the list of known hosts.
Hi YuJiang4319! You've successfully authenticated, but GitHub does not provide shell access.