栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

git 报错 ssh:connect to host github.com port 22

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

git 报错 ssh:connect to host github.com port 22

kex_exchange_identification: Connection closed by remote host
Connection closed by 140.82.121.3 port 22
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

 突然发现git无法操作,报错如上图。

本来以为是ssh key失效了?检查了一下是对应的。

测试

$ ssh -T  git@ssh.github.com

结果依然是 

上网找方法:

测试端口443 ,是可以成功的 

$ ssh -T -p 443 git@ssh.github.com

参考网上方法,解决办法如下:

 找到git 的config文件  /etc/ssh/ssh_config 并编辑

$ vi /etc/ssh/ssh_config    

没有权限的话用sudo

在末尾添加下面代码并保存

Host github.com
User git
Hostname ssh.github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa
Port 443

成功! 

接下来就可以正常操作git啦!

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/450250.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号