当前位置:   article > 正文

ssh: connect to host github.com port 22: Connection refused_connection refused could not read

connection refused could not read

最近使用 git 拉取 Github 上的项目时老是出现 Connection refused

$ git pull origin master
ssh: connect to host github.com port 22: Connection refused
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

网上的解决办法

解决ssh: connect to host github.com port 22: Connection refused

vim ~/.ssh/config
  • 1
Host github.com  
User xxxxx@xx.com  
Hostname ssh.github.com  
PreferredAuthentications publickey  
IdentityFile ~/.ssh/id_rsa  
Port 443
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

但是在使用了这个方法后依然无法解决:

$ git pull origin master
ssh: connect to host ssh.github.com port 443: Connection refused
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

然后看见隔壁工位上大哥的搜索栏上赫然也是这个问题,交流一番应该是最近墙比较敏感的问题。
解决方法也从大哥那里找到了,不得不说大哥YYDS,我还是太年轻了:

  1. 首先到 ipaddress 输入 github.com 查找到其IP地址
  2. 将查到的IP地址和网址映射放到你的本地 hosts 文件中即可,例子:140.82.112.4 github.com
  3. PS: windows 下 host 默认地址: C:\Windows\System32\drivers\etc
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小丑西瓜9/article/detail/668901
推荐阅读
相关标签
  

闽ICP备14008679号