解决GitHub中图片不显示的问题

解决GitHub中不显示图片的问题

今天用GitHub下载一个项目,突然发现上面的图片都显示不出来了,想看看项目中的样例图也看不了,然后就去查了半天看了许多博客,终于解决了这个问题。

解决办法:

主要思路就是使用本地hosts文件对网站进行域名解析,一般的DNS问题都可以通过修改hosts文件来解决,github的CDN域名被污染问题也不例外,同样可以通过修改hosts文件解决,将域名解析直接指向IP地址来绕过DNS的解析,以此解决污染问题。
修改host文件:C:/windows/system32/drivers/etc/hosts

#GitHub Start
52.74.223.119 github.com
52.74.223.119 gist.github.com
54.169.195.247 api.github.com
185.199.111.153 assets-cdn.github.com
199.232.96.133 raw.githubusercontent.com
199.232.96.133 gist.githubusercontent.com
199.232.96.133 cloud.githubusercontent.com
199.232.96.133 camo.githubusercontent.com
199.232.96.133 avatars0.githubusercontent.com
199.232.96.133 avatars1.githubusercontent.com
199.232.96.133 avatars2.githubusercontent.com
199.232.96.133 avatars3.githubusercontent.com
199.232.96.133 avatars4.githubusercontent.com
199.232.96.133 avatars5.githubusercontent.com
199.232.96.133 avatars6.githubusercontent.com
199.232.96.133 avatars7.githubusercontent.com
199.232.96.133 avatars8.githubusercontent.com
199.232.96.133 user-images.githubusercontent.com
185.199.109.154 github.githubassets.com
#GitHub End

将上面的内容追加到hosts,然后刷新DNS缓存:

ipconfig /flushdns

如果上面的还是不可用,或是速度表还是不理想,参考查找IP更新下对应的IP地址。

https://site.ip138.com这个是用来查询域名的
前面hosts里面域名里分为两类: - .http://githubusercontent.com -.http://github.com
.githubusercontent.com可以使用同一个IP,不需要每个单独查询。.github.com未经测试,目前看是需要单独查询对应的IP。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值