程序員必備的GitHub加速指南,真香!
不知道從什么時(shí)候我訪問 github 就無法展示圖片了,而且有時(shí)候(尤其晚上)打開網(wǎng)頁速度極其滴慢,就問大家受不受的了吧?我反正是頂不??!
GitHub 圖片可以正常加載。并且呀,劃重點(diǎn)了:一次配置,永久自動(dòng)更新,再也不需要你訪問不了的時(shí)候手動(dòng)去找最新的 ip 更新到本地了。hosts 然后上傳到遠(yuǎn)程倉庫,你直接拿來即用就好。相關(guān)代碼我上傳到了 github 上,感興趣的記著給個(gè) star 不迷路。站點(diǎn)地址:https://github.com/isevenluo/github-hosts
使用方法
# GitHub Host Start
185.199.108.154 github.githubassets.com
140.82.114.21 central.github.com
185.199.108.133 desktop.githubusercontent.com
185.199.108.153 assets-cdn.github.com
185.199.108.133 camo.githubusercontent.com
185.199.108.133 github.map.fastly.net
199.232.69.194 github.global.ssl.fastly.net
140.82.113.4 gist.github.com
185.199.108.153 github.io
140.82.114.3 github.com
140.82.113.6 api.github.com
185.199.108.133 raw.githubusercontent.com
185.199.108.133 user-images.githubusercontent.com
185.199.108.133 favicons.githubusercontent.com
185.199.108.133 avatars5.githubusercontent.com
185.199.108.133 avatars4.githubusercontent.com
185.199.108.133 avatars3.githubusercontent.com
185.199.108.133 avatars2.githubusercontent.com
185.199.108.133 avatars1.githubusercontent.com
185.199.108.133 avatars0.githubusercontent.com
185.199.108.133 avatars.githubusercontent.com
140.82.112.9 codeload.github.com
52.216.81.160 github-cloud.s3.amazonaws.com
52.217.95.169 github-com.s3.amazonaws.com
52.217.168.17 github-production-release-asset-2e65be.s3.amazonaws.com
52.216.206.155 github-production-user-asset-6210df.s3.amazonaws.com
52.217.49.68 github-production-repository-file-5c1aeb.s3.amazonaws.com
185.199.108.153 githubstatus.com
64.71.168.201 github.community
185.199.108.133 media.githubusercontent.com
# Please Star: https://github.com/isevenluo/github-hosts
# Update at: 2021年6月27日 上午10:01:37
# GitHub Host End
macOS
hosts 文件位置:/etc/hostsmacOS 修改需要管理員權(quán)限,所以需要按照如下方式配置:首先,打開(訪達(dá))Finder。 使用組合鍵 Shift+Command+G打開 "前往文件夾",輸入框中輸入/etc/hosts。然后就會(huì)跳轉(zhuǎn)到 hosts文件位置。
hosts 文件到桌面上,鼠標(biāo)右鍵右擊它,選擇「打開方式」—「文本編輯」,打開這個(gè) hosts文件,把上面的 hosts 內(nèi)容復(fù)制進(jìn)來。hosts 文件替換掉:/etc/hosts 文件。注意:如果你使用 VS Code,可以直接用VS Code修改和保存,不需要復(fù)制文件。
sudo killall -HUP mDNSResponder
Windows
hosts文件位置:C:/windows/system32/drivers/etc/hosts。hosts 內(nèi)容追加到 hosts文件,然后刷新 DNS 緩存:ipconfig /flushdns
star 我這個(gè)項(xiàng)目,然后來獲取最新的 hosts 內(nèi)容去替換你本地的。SwitchHosts 這種自動(dòng)更新一勞永逸的方法。SwitchHosts 感興趣的同學(xué),可以訪問其官網(wǎng)查看:https://swh.app/zh/
Windwos 和 macOS 系統(tǒng),使用方式是一樣的。設(shè)置定時(shí)同步云端最新hosts
Hosts類型:遠(yuǎn)程
Hosts標(biāo)題:github-hosts(自定義即可)
URL:https://cdn.jsdelivr.net/gh/isevenluo/github-hosts/hosts
自動(dòng)刷新:1小時(shí)

hosts 了,再也不用擔(dān)心 github 無法訪問,圖片加載不了了。PS:記著不要忘記點(diǎn)擊側(cè)邊欄的開關(guān)哦~~

有道無術(shù),術(shù)可成;有術(shù)無道,止于術(shù)
歡迎大家關(guān)注Java之道公眾號(hào)
好文章,我在看??
