解决访问github图片不显示问题

最近我在做前端发送ajax请求获取github中比较排行靠前的项目作者名称和图片时,发现可以出现作者名字但是却图片却显示不出来,出于问题我就打开了查看github的图片是否能被打开,果不其然,github的图片加载不出来。

在这里插入图片描述

带着疑惑我在网上一顿搜索,终于解决了,在这里我向大家分享一下我的解决方案。

搜索如下目录,并打开hosts文件

C:\Windows\System32\drivers\etc\hosts

在hosts文件末尾添加如下:

#GitHub Start
192.30.253.112 Build software better, together
192.30.253.119 gist.github.com
151.101.184.133 assets-cdn.github.com
151.101.184.133 raw.githubusercontent.com
151.101.184.133 gist.githubusercontent.com
151.101.184.133 cloud.githubusercontent.com
151.101.184.133 camo.githubusercontent.com
151.101.184.133 avatars0.githubusercontent.com
151.101.184.133 avatars1.githubusercontent.com
151.101.184.133 avatars2.githubusercontent.com
151.101.184.133 avatars3.githubusercontent.com
151.101.184.133 avatars4.githubusercontent.com
151.101.184.133 avatars5.githubusercontent.com
151.101.184.133 avatars6.githubusercontent.com
151.101.184.133 avatars7.githubusercontent.com
151.101.184.133 avatars8.githubusercontent.com
#GitHub End

然后再次刷新github,界面中的图片就都出来啦!!!
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/liu19721018/article/details/106467711