Github加载图片异常

问题

最近不知道怎么回事,Github加载图片总是加载不出来,ping了一下raw.githubusercontent.com发现解析到了本地

$ ping raw.githubusercontent.com
PING raw.githubusercontent.com (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.010 ms
64 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 time=0.042 ms
64 bytes from localhost (127.0.0.1): icmp_seq=3 ttl=64 time=0.041 ms
64 bytes from localhost (127.0.0.1): icmp_seq=4 ttl=64 time=0.037 ms
^C
--- raw.githubusercontent.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3052ms
rtt min/avg/max/mdev = 0.010/0.032/0.042/0.013 ms

解决办法

执行dig @223.5.5.5 raw.githubusercontent.com
结果如下:

$ dig @223.5.5.5 raw.githubusercontent.com

; <<>> DiG 9.16.3 <<>> @223.5.5.5 raw.githubusercontent.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 10796
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;raw.githubusercontent.com. IN  A

;; ANSWER SECTION:
raw.githubusercontent.com. 30   IN  CNAME   github.map.fastly.net.
github.map.fastly.net.  30  IN  A   151.101.76.133

;; Query time: 76 msec
;; SERVER: 223.5.5.5#53(223.5.5.5)
;; WHEN: 四 5月 28 12:10:29 CST 2020
;; MSG SIZE  rcvd: 94

找到正确解析的 IP,
然后 sudo vim /etc/hosts,在文件末尾添加一行

151.101.76.133 raw.githubusercontent.com

现在图片就正常加载了。

GitHub加速访问

盘点提高国内访问 GitHub 的速度的 9 种方案

版权声明:
作者:Sunrise
链接:https://www.qlm.life/?p=76
来源:松间闻雪
文章版权归作者所有,未经允许请勿转载。

THE END
分享
二维码
< <上一篇
下一篇>>