最近想用Mac电脑访问github发现一直登不上去,在命令行终端ping www.github.com也是超时,以前访问github是没有问题的,不知道出了什么问题,于是各种百度。最后找到了一个解决方案:
1.新建一个访达窗口,同时按住shift command G三个键,进入前往文件夹页面

2.在输入框内输入/etc/hosts

3.找到hosts文件夹

4.由于hosts文件夹不可编辑,所以复制一份hosts文件先保存到本地桌面
5.在新的hosts文件夹里输入如下代码:
http://github.com 204.232.175.94 http://gist.github.com 107.21.116.220 http://help.github.com 207.97.227.252 http://nodeload.github.com 199.27.76.130 http://raw.github.com 107.22.3.110 http://status.github.com 204.232.175.78 http://training.github.com 207.97.227.243 http://www.github.com

然后点击保存。
6.将/etc/hosts原来的文件删除,删除的时候需要输入你的电脑开机密码
7.再将修改后的保存到桌面的hosts文件拖拽到/etc文件夹下,期间有可能需要你输入开机密码,文件名最好是hosts
8.以上完成后,我们来到终端命令行ping 一下github

发现可以ping通了,终于不再超时了,这时无法按耐住心中的喜悦了
9.接下来我们来浏览器里最终检测下是否可以访问github
发现终于可以了,见到了久违的界面

至此,mac电脑无法访问github的问题终于得到了解决
在此也感谢网上一些大佬的支持,参考链接https://www.cnblogs.com/hankleo/p/13563074.html
网友评论