最近使用 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.
网上的解决办法
解决ssh: connect to host github.com port 22: Connection refused
vim ~/.ssh/config
Host github.com
User xxxxx@xx.com
Hostname ssh.github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa
Port 443
但是在使用了这个方法后依然无法解决:文章来源:https://www.toymoban.com/news/detail-548215.html
$ 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.
然后看见隔壁工位上大哥的搜索栏上赫然也是这个问题,交流一番应该是最近墙比较敏感的问题。
解决方法也从大哥那里找到了,不得不说大哥YYDS,我还是太年轻了:文章来源地址https://www.toymoban.com/news/detail-548215.html
- 首先到 ipaddress 输入
github.com
查找到其IP地址 - 将查到的IP地址和网址映射放到你的本地
hosts
文件中即可,例子:140.82.112.4 github.com
- PS: windows 下
host
默认地址:C:\Windows\System32\drivers\etc
到了这里,关于ssh: connect to host github.com port 22: Connection refused的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!