解决mac os下连接github出现 ‘Failed to connect to github.com port 443: Connection refused’

最近两天push项目代码到github,突然出现Failed to connect to github.com port 443: Connection refused错误,一直无法正常push

期间升级git版本,Google,度娘各种问,均未能解决问题

猛然想起为了翻越长城曾经修改过host文件,一看,果然如此,解决方法也很简单,将host文件恢复到默认即可

以下为命令行和原版的host,操作host文件需要root权限, 将host内容粘贴进去然后wq退出即可

[code lang=”shell”]
$ sudo -i
$ cd /etc
$ rm hosts
$ vi hosts
[/code]

[code lang=”shell”]
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
[/code]

8 thoughts on “解决mac os下连接github出现 ‘Failed to connect to github.com port 443: Connection refused’

  1. 太感谢博主了,网上那些解决办法全都没有用。 找了一圈,还是这个方法解决问题

回复 Smartisan 取消回复

您的电子邮箱地址不会被公开。 必填项已用*标注