方案一:
最近GitHub无法访问?试了好多种方法,终于找到了你
一、进入hosts文件夹
command + shift + G
输入
/private/etc/hosts
enter
二、修改hosts文件
hosts文件夹不可修改,可拷贝一份到桌面,打开桌面的hosts文件
添加
# Github Hosts
# update: 2021-01-26
140.82.114.3 github.com
140.82.114.10 nodeload.github.com
140.82.113.5 api.github.com
140.82.114.10 codeload.github.com
185.199.108.153 training.github.com
#185.199.108.153 assets-cdn.github.com
185.199.108.153 documentcloud.github.com
185.199.108.154 help.github.com
185.199.108.153 githubstatus.com
199.232.69.194 github.global.ssl.fastly.net
199.232.96.133 raw.github.com
199.232.96.133 raw.githubusercontent.com
199.232.96.133 cloud.githubusercontent.com
199.232.96.133 gist.githubusercontent.com
199.232.96.133 marketplace-screenshots.githubusercontent.com
199.232.96.133 repository-images.githubusercontent.com
199.232.96.133 user-images.githubusercontent.com
199.232.96.133 desktop.githubusercontent.com
199.232.5.194 github.global.ssl.fastly.net
199.232.96.133 avatars.githubusercontent.com
199.232.96.133 avatars0.githubusercontent.com
199.232.96.133 avatars1.githubusercontent.com
199.232.96.133 avatars2.githubusercontent.com
199.232.96.133 avatars3.githubusercontent.com
199.232.96.133 avatars4.githubusercontent.com
199.232.96.133 avatars5.githubusercontent.com
199.232.96.133 avatars6.githubusercontent.com
199.232.96.133 avatars7.githubusercontent.com
199.232.96.133 avatars8.githubusercontent.com
# End of the section
删除/private/etc/路径下的hosts文件
将拷贝修改后的hosts文件拖入/private/etc/下
删除和拖入hosts文件 可能需要输入密码
三、终端操作
打开终端输入sudo killall -HUP mDNSResponder
enter
输入密码
enter
至此,打开你的浏览器,就可以访问GitHib 了!!!大功告成!!!
方案二:
2021年 6月9号 刚测试:最新解决办法:
在etc/host 中底部加入代码,不需要使用上面的代码,只需要加入下面几行就行
140.82.114.3 github.com
199.232.69.194 github.global.ssl.fastly.net
185.199.108.153 assets-cdn.github.com
185.199.110.153 assets-cdn.github.com
185.199.111.153 assets-cdn.github.com
最后别忘记打开终端 加入 打开终端输入sudo killall -HUP mDNSResponder
enter
输入密码
enter
最后就可以访问