解决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’

  • Joseph
    2016年7月22日 at 下午2:36

    真的太感谢了, 折腾了好多天,Google满屏都是点过的, 终于解决了. 感谢感谢

    • 龚杰洪
      2016年7月25日 at 上午10:08

      哈哈,不谢,能解决你的问题是我的荣幸

  • WTYN
    2016年8月3日 at 下午7:50

    感谢了!完美解决!

  • Smartisan
    2016年8月4日 at 下午7:35

    简直太帅了,问题就解决了

  • crazy_heng
    2020年6月22日 at 上午9:28

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

    • 龚杰洪
      2020年6月22日 at 上午9:36

      不谢,能解决您的问题,深表荣幸

发表回复

Your email address will not be published. Required fields are marked *.

*
*