Github Clone: Connection closed by remote host

在尝试克隆Github仓库时遇到kex_exchange_identification:Connectionclosedbyremotehost的错误,原因是网络代理封锁了Git的默认端口22。解决方法是将Github的SSH连接端口改为443,在~/.ssh/config中添加相应配置,然后验证连接成功。
摘要由CSDN通过智能技术生成

现象

尝试克隆 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

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.
  • 7
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值