当前位置:   article > 正文

git push失败,提示connection timed out_connection timed out could not read from remote re

connection timed out could not read from remote repository. please make sure

1. 报错信息

  1. # git push
  2. ssh: connect to host github.com port 22: Connection timed out
  3. fatal: Could not read from remote repository.
  4. Please make sure you have the correct access rights
  5. and the repository exists.

2. 以前是可以使用的,突然无法push,找了些方法,如重新添加ssh key,最后想到换了网络环境,可能是防火墙导致无法访问22端口

3. 解决步骤

1)测试可用性

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

提示如下证明可用

  1. Hi username! You’ve successfully authenticated, but GitHub does not
  2. provide shell access.

 或

  1. The authenticity of host '[ssh.github.com]:443 ([20.205.243.160]:443)' can't be established.
  2. ECDSA key fingerprint is SHA256:p2QAMXNIC1TJYWeIOttrVc98/R1BUFWu3/LiyKgUfQM.
  3. Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
  4. Warning: Permanently added '[ssh.github.com]:443,[20.205.243.160]:443' (ECDSA) to the list of known hosts.
  5. Hi username! You've successfully authenticated, but GitHub does not provide shell access.

2)编辑~/.ssh/config 文件

本windows下,路径为C:\Users\用户名\.ssh,没有config文件则添加一个,没有后缀。再该config文件中添加内容

  1. Host github.com
  2. Hostname ssh.github.com
  3. Port 443

3)再次测试

ssh -T git@github.com

提示如下即可用

Hi username! You’ve successfully authenticated, but GitHub does not provide shell access.

个人学习记录,侵删

参考:

解决 ssh: connect to host github.com port 22: Connection timed out - SegmentFault 思否

记一次git push失败,提示connection timed out - 卡里的技术博客

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Li_阴宅/article/detail/786500
推荐阅读
相关标签
  

闽ICP备14008679号