Github打開慢的原因:
DNS解析的問題聘殖;
服務(wù)器在國外芹关。
解決方案:
修改本地host文件续挟,增加配置內(nèi)容,繞過域名解析侥衬,達(dá)到加速的目的诗祸。
操作步驟:
1跑芳、找見hosts文件
Windows:
C:\Windows\System32\drivers\etc\hosts
Mac\Linux:
/etc/hosts
2、在文件末尾追加內(nèi)容(一般情況下直颅,復(fù)制下面的內(nèi)容到hosts中即可)
199.232.69.194 github.global.ssl.fastly.net
140.82.113.3 github.com
185.199.108.154 github.githubassets.com
3博个、刷新dns緩存,在cmd中輸入 ipconfig/flushdns
4际乘、Github的IP地址是不斷變化的坡倔,如果發(fā)現(xiàn)網(wǎng)站打不開了,可以獲取新的IP地址修改hosts里面的內(nèi)容脖含。
DEMO:(ubuntu)
打開終端命令行罪塔,輸入命令:sudo gedit /etc/hosts 打開hosts文件,修改里面的內(nèi)容如下
127.0.0.1 localhost
127.0.1.1 intasect-HP-Desktop-Pro-G2-MT
xxx.xxx.xxx.xxx github.com git
13.250.177.223 github.com
# github.com
192.30.253.112 github.com
192.30.253.119 gist.github.com
151.101.100.133 assets-cdn.github.com
151.101.100.133 raw.githubusercontent.com
151.101.100.133 gist.githubusercontent.com
151.101.100.133 cloud.githubusercontent.com
151.101.100.133 camo.githubusercontent.com
151.101.100.133 avatars0.githubusercontent.com
151.101.100.133 avatars1.githubusercontent.com
151.101.100.133 avatars2.githubusercontent.com
151.101.100.133 avatars3.githubusercontent.com
151.101.100.133 avatars4.githubusercontent.com
151.101.100.133 avatars5.githubusercontent.com
151.101.100.133 avatars6.githubusercontent.com
151.101.100.133 avatars7.githubusercontent.com
151.101.100.133 avatars8.githubusercontent.com
185.199.108.153 assets-cdn.github.com
185.199.109.153 assets-cdn.github.com
185.199.110.153 assets-cdn.github.com
185.199.111.153 assets-cdn.github.com
151.101.113.194 github.global.ssl.fastly.net
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
上面的xxx.xxx.xxx.xxx 是本機(jī)的ipv4地址养葵, 13.250.177.223 是利用站長(zhǎng)工具征堪,獲取的github數(shù)據(jù)庫的ipv4地址。
可以點(diǎn)擊這里跳轉(zhuǎn):站長(zhǎng)鏈接
原文鏈接:https://blog.csdn.net/qq_41221030/article/details/106711019