git出现 Failed to connect to github.com port 22: Timed out

187 阅读1分钟

在工作中git push时发现

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

网上的方法编辑~/.ssh/config

Host github.com
  Hostname ssh.github.com
  Port 443

使用ssh -T -p 443 git@ssh.github.com查看能否连接 依旧不行

1.打开 ipaddress.com 网站,查询以下网址对应地IP

网站地址 :https://websites.ipaddress.com/

2.需要查询地网址ip

1、github.com
2、github.global.ssl.fastly.net

image.png

image.png

3.复制查询后地ip,然后在hosts文件中做出相应地修改(hosts文件路径:C:\Windows\System32\drivers\etc)

image.png

保存后退出发现gitpush成功

image.png