解决 raw.githubusercontent.com 无法访问的问题
解决 raw.githubusercontent.com 无法访问的问题
电信默认 DNS 直接遮蔽 github
DNS 1: 61.139.2.69
DNS 2: 218.6.200.139
C:\Users\XXXXX>dig @114.114.114.114 raw.githubusercontent.com
; <<>> DiG 9.10.3-P4 <<>> @114.114.114.114 raw.githubusercontent.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 16002
;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;raw.githubusercontent.com. IN A
;; ANSWER SECTION:
raw.githubusercontent.com. 3318 IN A 185.199.108.133
raw.githubusercontent.com. 3318 IN A 185.199.109.133
raw.githubusercontent.com. 3318 IN A 185.199.110.133
;; Query time: 31 msec
;; SERVER: 114.114.114.114#53(114.114.114.114)
;; WHEN: Mon Nov 21 11:58:12 ?D1ú±ê×?ê±?? 2022
;; MSG SIZE rcvd: 102
C:\Users\XXXXX>dig @61.139.2.69 raw.githubusercontent.com
; <<>> DiG 9.10.3-P4 <<>> @61.139.2.69 raw.githubusercontent.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 47795
;; flags: qr rd ra ad; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;raw.githubusercontent.com. IN A
;; ANSWER SECTION:
raw.githubusercontent.com. 30 IN A 0.0.0.0
;; Query time: 19 msec
;; SERVER: 61.139.2.69#53(61.139.2.69)
;; WHEN: Mon Nov 21 11:58:23 ?D1ú±ê×?ê±?? 2022
;; MSG SIZE rcvd: 59
C:\Users\XXXXX>dig @218.6.200.139 raw.githubusercontent.com
; <<>> DiG 9.10.3-P4 <<>> @218.6.200.139 raw.githubusercontent.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 8368
;; flags: qr rd ra ad; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;raw.githubusercontent.com. IN A
;; ANSWER SECTION:
raw.githubusercontent.com. 30 IN A 0.0.0.0
;; Query time: 15 msec
;; SERVER: 218.6.200.139#53(218.6.200.139)
;; WHEN: Mon Nov 21 11:58:37 ?D1ú±ê×?ê±?? 2022
;; MSG SIZE rcvd: 59
我说这几天怎么会拉取失败。
情况描述
今天访问 raw.githubusercontent.com/ 时,提示无法访问,可能是因为某些众所周知的原因导致 DNS 污染,最终通过修改 host 解决问题。
解决方案
查询真实 IP
通过 IPAddress.com 查询 raw.githubusercontent.com/ 的真实 IP,
可知其真实 IP 为 199.232.68.133。
修改 hosts
CentOS 及 macOS 直接在终端输入
sudo vi /etc/hosts
编辑 hosts 文件,新增下列内容
199.232.68.133 raw.githubusercontent.com
保存即可。
大佬维护的开源项目(推荐)
github.com/521xueweihan/GitHub520
Talk is cheap. Show me the code