解决github图片不显示的问题

解决github图片不显示的问题(Mac版)

主要思路解决方法如下:

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

1、找到GitHub上图片的域名

使用Google浏览器,右击”检查“,

在这里插入图片描述

点击”open in new tab“ 打开图片链接: https://raw.githubusercontent.com/ShiYaoHua/personalBlog/master/img/4_1.png?token=ABXPYHXNV4IM43QWY5V52CS7CAAHE

复制域名:raw.githubusercontent.com

2、到IPAddress.com网站

复制域名进去解析ip地址:199.232.68.133

 

在这里插入图片描述

3、修改hosts

前往文件夹 /etc 打开hosts文件 添加

199.232.68.133 raw.githubusercontent.com

如图所示(我只添加了一个,不同项目图片域名可能也不同,其他所有图片域名解析后的ip地址都添加进去就可访问了):

在这里插入图片描述


解决github图片不显示的问题(Windows版)

打开路径C:\Windows\System32\drivers\etc下的hosts文件增加如下内容:
# GitHub Start
192.30.253.112 github.com
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

 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值