今天打开 GitHub,发现里面图片都加载不出来,在网上查阅了很多文章后总结了一个方法,分享给大家
1、打开 https://www.ipaddress.com/,输入 avatars0.githubusercontent.com,会显示如下查询界面,记住框选的IP地址
2、修改 hosts 文件
Windows:C:\Windows\System32\drivers\etc\hosts
Mac:/etc/hosts
PS:因为我使用的是 Mac 系统,所以 hosts 文件在 Windows 系统下的位置是我直接百度的,如有不对请见谅
3、在 hosts 文件中添加如下内容
注意: 前两行的ip是固定的,后面用的ip199.232.28.133是上面从网站里获取到的,每个用户的都不相同,改成你获取到的结果即可。
192.30.253.112 github.com
192.30.253.119 gist.github.com
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
修改完成后即可成功访问到 GitHub 上的图片,小伙伴们赶紧去试一下吧~