警告
本文最后更新于 2022-12-02,文中内容可能已过时。
尝试克隆 Github 仓库,报kex_exchange_identification: Connection closed by remote host
。
1
2
3
|
# 测试Github的连通性,报下面错误SSH端口被封了
$ ssh -T [email protected]
kex_exchange_identification: Connection closed by remote host
|
Github 提供的 SSH over the HTTPS port 的方法访问,如果成功会返回如下信息。
1
2
3
|
# 测试通过443端口访问
$ ssh -T -p 443 [email protected]
Hi xxx! You've successfully authenticated, but GitHub does not provide shell access.
|
测试成功通过下面命令克隆仓库
如果不想用上面的命令来克隆仓库,需要修改 SSH 配置,在 ~/.ssh/config
中添加如下信息。
1
2
3
4
5
|
Host github.com
Hostname ssh.github.com
Port 443
User git
IdentityFile ~/.ssh/id_rsa
|
然后可以使用克隆仓库
1
2
3
4
5
6
7
|
# git 设置代理
git config --global http.proxy socks5://127.0.0.1:11080
git config --global https.proxy socks5://127.0.0.1:11080
# 取消代理
git config --global --unset http.proxy
git config --global --unset https.proxy
|
Using SSH over the HTTPS port