Git故障排查

kex_exchange_identification: Connection closed by remote host

当使用ssh -T [email protected]时出现以上报错

尝试以下命令

ssh -T -p 443 [email protected]

如果显示Hi <username>! You've successfully authenticated, but GitHub does not provide shell access.则说明连接成功

强大的GFW阻止了22端口,我们可以将github的连接改为443:

# ~/.ssh/config
Host github.com
    Hostname ssh.github.com
    Port 443
    User git

参考资料