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

ssh: connect to host github.com port 22: Connection timed out fatal: Could not read from remote repo

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

ssh: connect to host github.com port 22: Connection timed out fatal: Could not read from remote repo

问题描述:
在使用Git将本地仓库推送到远程仓库的时候,发生了如下错误:“fatal: Could not read from remote repository.”
1、首先输入以下命令检查SSH是否能够连接成功(ssh后面有空格)

ssh -T git@github.com

发现报错:端口连接超时。

ssh: connect to host github.com port 22: Connection timed out

解决方案(亲测有效)
在C盘——用户——你的主机名文件夹中找到.ssh文件夹;(此前配置SSH时会生成该文件夹)
在.ssh文件夹中新建文件 config,不带后缀(可以新建文本文档,去掉.txt后缀)
使用notepad++(或其他方式)打开config文件,输入以下内容,保存后即可
其中xxxxqq.com为你的邮箱

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

再次执行

ssh -T git@github.com

会出现以下提示,输入yes回车即可

The authenticity of host '[ssh.github.com]:443 ([192.30.255.123]:443)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '[ssh.github.com]:443,[192.30.255.123]:443' (RSA) to the list of known hosts.

再次执行ssh -T git@github.com,发现验证通过–接下来可以正常上传代码

Hi Clare! You've successfully authenticated, but GitHub does not provide shell access.
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/830901.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

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

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