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.
  • 42
    点赞
  • 75
    收藏
    觉得还不错? 一键收藏
  • 13
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 13
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值