解决 Github 无法加载的问题
背景
很明显,Github 上面的东西太多,以至于几乎都打不开。
对此我们只需要修改本机的 hosts 文件就可以解决这个问题,能不科学上网就不科学上网了。
解决方案
找到文件
windows 系统中,hosts 文件位于 C:\windows\system32\drivers\etc\ 目录中,在管理员模式下打开即可。
加入解析
# GitHub Start
140.82.112.4 github.com
140.82.113.3 gist.github.com
185.199.108.153 assets-cdn.github.com
199.232.68.133 raw.githubusercontent.com
199.232.68.133 gist.githubusercontent.com
199.232.68.133 cloud.githubusercontent.com
151.101.192.133 camo.githubusercontent.com
199.232.68.133 avatars0.githubusercontent.com
199.232.68.133 avatars1.githubusercontent.com
199.232.68.133 avatars2.githubusercontent.com
199.232.68.133 avatars3.githubusercontent.com
199.232.68.133 avatars4.githubusercontent.com
199.232.68.133 avatars5.githubusercontent.com
199.232.68.133 avatars6.githubusercontent.com
199.232.68.133 avatars7.githubusercontent.com
199.232.68.133 avatars8.githubusercontent.com
# GitHub End
刷新 DNS
将前文内容追加到 hosts 文件后,然后刷新 DNS 缓存
ipconfig /flushdns
使用 CMD 脚本
为了快速更新 hosts,可以新建一个 cmd 脚本,内容如下:
cd C:\Windows\System32\drivers\etc
notepad hosts
ipconfig /flushdns
使用管理员权限运行该脚本即可。