简单记一个 bug,以后再遇到方便查到解决方法。

Git 使用 ssh 拉取 GitHub 仓库的时候报 kex_exchange_identification 错误:

1
2
3
4
kex_exchange_identification: Connection closed by remote host
Connection closed by x.x.x.x port 22
fatal: Could not read from remote repository.
Please make sure you have the correct access rights

我一开始以为是密钥配置过期,后来发现是 GitHub 的地址更新了。把 known_hosts 删掉让它自己重新生成一下就好了。

1
rm ~/.ssh/known_hosts