Github 推送报错kex_exchange_identification: Connection closed by remote host

夜晚使用 hexo deploy 推送文章报错:

kex_exchange_identification: Connection closed by remote host
Connection closed by 127.0.0.1 port 7890
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
FATAL Something's wrong. Maybe you can find the solution here: https://hexo.io/docs/troubleshooting.html

可白天还好好的,第一反应是不是代理挂了,检查了一下确实,不过切完地址依然有问题,在猜测ssh被删了,失效?

有可能代理服务商禁用了22端口问题

解决办法

要在 SSH 配置文件中设置此行为,请在 ~/.ssh/config 编辑该文件(如果没有就新建一个config文件),并添加以下部分:

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

再次连接到 GitHub.com 来测试这是否有效:

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

参考链接:

https://github.com/vernesong/OpenClash/issues/1960#issuecomment-1019101426

https://docs.github.com/zh/authentication/troubleshooting-ssh/using-ssh-over-the-https-port

https://www.v2ex.com/t/841032