现象
尝试克隆 Github 仓库时遇到了的报措
kex_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.
检查了各项配置:
Github 平台与本地的 ssh key 均配置正常
本地 ~/.ssh/config~ 中没有开启 proxy 代理配置
执行命令 ssh -T git@github.com 返回如下结果
$ ssh -T git@github.com
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 git@github.com
Hi xxx! You've successfully authenticated, but GitHub does not provide shell access.