Github Clone: Connection closed by remote host
背景
今天尝试克隆 Github 仓库时遇到了诡异的报措 kex_exchange_identification: Connection closed by remote host
。随即做如下检查:
- Github 平台与本地的
ssh key
均配置正常 - 本地
~/.ssh/config~
中没有开启proxy
代理配置 - 执行命令
ssh -T [email protected]
返回如下结果
$ ssh -T [email protected]
kex_exchange_identification: Connection closed by remote host
原因
家中使用的梯子封禁了 Github 端口 22 的连接
解决
将 Github 的连接端口从 22 改为 443 即可。修改 ~/.ssh/config
,添加如下段落即可
Host github.com
HostName ssh.github.com
User git
Port 443
验证
$ ssh -T [email protected]
Hi xxx! You've successfully authenticated, but GitHub does not provide shell access.