原因:
由于某些原因,国内访问Github有时会异常缓慢,通过修改系统hosts文件的办法,绕过国内dns解析,直接访问GitHub的CDN节点,从而达到加速的目的。该方法也可加速其他因为CDN被屏蔽导致访问慢的网站。
实现:
本地host文件中添加映射,步骤如下:
1、打开hosts文件:C:WindowsSystem32driversetc
2、保存文件,Windows+X打开系统命令行(管理员身份)或powershell运行ipconfig/flushdns
手动刷新系统DNS缓存
#GitHub 151.101.44.249 github.global.ssl.fastly.net 192.30.253.113 github.com 103.245.222.133 assets-cdn.github.com 23.235.47.133 assets-cdn.github.com 203.208.39.104 assets-cdn.github.com 204.232.175.78 documentcloud.github.com 204.232.175.94 gist.github.com 107.21.116.220 help.github.com 207.97.227.252 nodeload.github.com 199.27.76.130 raw.github.com 107.22.3.110 status.github.com 204.232.175.78 training.github.com 207.97.227.243 www.github.com 185.31.16.184 github.global.ssl.fastly.net 185.31.18.133 avatars0.githubusercontent.com 185.31.19.133 avatars1.githubusercontent.com
3、如果头像加载缓慢,或者无法加载,可以再增加如下映射
#GitHub头像显示不全问题修复 199.232.28.133 assets-cdn.github.com 199.232.28.133 raw.githubusercontent.com 199.232.28.133 gist.githubusercontent.com 199.232.28.133 cloud.githubusercontent.com 199.232.28.133 camo.githubusercontent.com 199.232.28.133 avatars0.githubusercontent.com 199.232.28.133 avatars1.githubusercontent.com 199.232.28.133 avatars2.githubusercontent.com 199.232.28.133 avatars3.githubusercontent.com 199.232.28.133 avatars4.githubusercontent.com 199.232.28.133 avatars5.githubusercontent.com 199.232.28.133 avatars6.githubusercontent.com 199.232.28.133 avatars7.githubusercontent.com 199.232.28.133 avatars8.githubusercontent.com
4、重新打开浏览器,重新访问。