【gitHub】GitHub网页githubusercontent地址无法访问问题
GitHub里面图片都在githubusercontent.com域名上,我们只需要在hosts里面加上相关地址即可。
1. hosts内容
# GitHub Start
52.74.223.119 github.com
52.74.223.119 gist.github.com
54.169.195.247 api.github.com
185.199.111.153 assets-cdn.github.com
199.232.96.133 raw.githubusercontent.com
199.232.96.133 gist.githubusercontent.com
199.232.96.133 cloud.githubusercontent.com
199.232.96.133 camo.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
199.232.96.133 user-images.githubusercontent.com
185.199.109.154 github.githubassets.com
# GitHub End
注意 : 这里域名对应的ip是通过dns查询工具查询得到的,你应当选择的是延时相对较小且比较稳定的ip。 如果发现不起作用,或者速度不理想,参考"查找域名IP"。
2. 如何修改
2.1 Windows
hosts文件位置:C:/windows/system32/drivers/etc/hosts。
将前文内容追加到hosts,然后命令刷新DNS缓存:
ipconfig /flushdns
2.2 Mac
hosts文件位置:/etc/hosts。
Mac系统下修改需要按照如下方式:
1:首先,打开(访达)Finder。
2:使用组合键Shift+Command+G打开"前往文件夹",在输入框输入/etc/hosts。
3:然后就会跳转到hosts文件位置。复制hosts文件到桌面上,鼠标右键点击/右击它,选择「打开方式」—「文本编辑」,打开这个hosts文件,然后将你要修改的内容直接在里面修改就好了。
然后把你修改好的hosts文件在复制回hosts文件的所在(文件夹下)路径:/etc/hosts 之下替换原始的hosts文件就好了。
注意:如果弹出密码输入框,你需要输入你当前电脑登录账号的密码。
最后刷新下缓存:
sudo killall -HUP mDNSResponder