1. 找到C盘host文件
C:\Windows\System32\drivers\etc\hosts
2. 查询IP地址
GitHub: Where the world builds software · GitHub
github.global.ssl.Fastly.net ᐅ Learn more about Fastly
assets-cdn.Github.com ᐅ Learn more about Github
raw.Githubusercontent.com ᐅ Learn more about Githubusercontent (ipaddress.com)
3. 记住以上ip地址。
修改 C:\Windows\System32\drivers\etc 中的hosts文件(PS:若没有修改权限,可以鼠标右键,属性,安全,修改权限。或者将hosts文件复制到桌面,修改之后,复制到原文件夹),将下面一段话添加到hosts文件中:
140.82.112.4 github.com
199.232.69.194 github.global.ssl.fastly.net
185.199.108.153 assets-cdn.github.com
185.199.109.153 assets-cdn.github.com
185.199.110.153 assets-cdn.github.com
185.199.111.153 assets-cdn.github.com
185.199.108.133 raw.githubusercontent.com
185.199.109.133 raw.githubusercontent.com
185.199.110.133 raw.githubusercontent.com
185.199.111.133 raw.githubusercontent.com
4. 保存hosts文件。
如果没有立即恢复正常,需要刷新DNS缓存,告诉电脑我的hosts文件已经修改。Windows下刷新DNS缓存的方法:
打开cmd,输入:
ipconfig /flushdns
重新打开Github网站,此时网站的访问应该可以恢复正常。
参考链接: