首先來(lái)說(shuō)hosts文件一般位于路徑C:\Windows\System32\drivers\etc中
hosts的作用有:
1. 加快域名解析作用
我們會(huì)經(jīng)常訪問(wèn)網(wǎng)站,那么我們則可以通過(guò)hosts文件來(lái)配置域名以及IP之間的關(guān)系,提高域名解析速度。這主要是因?yàn)閮烧咧g的映射關(guān)系,簡(jiǎn)單來(lái)說(shuō)就是我們輸入域名計(jì)算機(jī)就能很快解析出IP。而不是在網(wǎng)絡(luò)上請(qǐng)求服務(wù)器。
作用2.方便局域網(wǎng)用戶
在很多的局域網(wǎng)中,我們會(huì)有很多的服務(wù)器提供給用戶進(jìn)行使用。而在局域網(wǎng)中是缺少DNS服務(wù)器的,那么輸入進(jìn)去的IP地址就很難記住。hosts文件則是能夠有效減少這樣的麻煩,方便用戶使用。
作用3.屏蔽網(wǎng)站
在很多的網(wǎng)站中,我們會(huì)看見(jiàn)很多沒(méi)有經(jīng)過(guò)用戶同意就安裝上去的插件。在這些插件中存在木馬病毒的可能性很大,使用hosts文件可以將錯(cuò)誤IP映射到本地IP之中,將網(wǎng)站屏蔽。
(一)通過(guò)修改hosts文件加速
1. 在右下角輸入框輸入cmd,選擇“命令提示符(以管理員身份運(yùn)行)”;
2. 在命令行窗口中輸入“cd C:\Windows\System32\Drivers\etc”
3. 輸入“notepad hosts”
隨后便可以打開(kāi)hosts文件并對(duì)其進(jìn)行修改和保存。
往其中加入相應(yīng)的GitHub代碼對(duì)其進(jìn)行保存
# GitHub520 Host Start
140.82.112.4 alive.github.com
140.82.112.4 live.github.com
18.207.134.67 github.githubassets.com
140.82.112.4 central.github.com
3.220.169.176 desktop.githubusercontent.com
140.82.112.4 assets-cdn.github.com
3.238.132.1 camo.githubusercontent.com
151.101.1.6 github.map.fastly.net
151.101.1.6 github.global.ssl.fastly.net
140.82.112.4 gist.github.com
185.199.108.153 github.io
140.82.112.4 github.com
192.0.66.2 github.blog
140.82.112.4 api.github.com
18.212.214.173 raw.githubusercontent.com
44.204.227.149 user-images.githubusercontent.com
18.208.143.190 favicons.githubusercontent.com
3.227.11.2 avatars5.githubusercontent.com
44.192.25.139 avatars4.githubusercontent.com
54.197.35.64 avatars3.githubusercontent.com
44.211.83.233 avatars2.githubusercontent.com
3.238.132.1 avatars1.githubusercontent.com
3.238.199.124 avatars0.githubusercontent.com
44.210.19.120 avatars.githubusercontent.com
140.82.112.4 codeload.github.com
72.21.206.80 github-cloud.s3.amazonaws.com
72.21.206.80 github-com.s3.amazonaws.com
72.21.206.80 github-production-release-asset-2e65be.s3.amazonaws.com
72.21.206.80 github-production-user-asset-6210df.s3.amazonaws.com
72.21.206.80 github-production-repository-file-5c1aeb.s3.amazonaws.com
185.199.108.153 githubstatus.com
140.82.113.18 github.community
52.224.38.193 github.dev
140.82.112.4 collector.github.com
3.238.235.79 pipelines.actions.githubusercontent.com
18.207.249.155 media.githubusercontent.com
35.172.164.199 cloud.githubusercontent.com
54.198.215.57 objects.githubusercontent.com
13.107.219.40 vscode.dev
加入代碼后保存即可
修改后如果沒(méi)有生效
大部分情況下是直接生效,如未生效可嘗試下面的辦法,刷新 DNS:
Windows:在 CMD 窗口輸入:ipconfig?/flushdns
最后如果上述方法無(wú)效請(qǐng)嘗試重啟電腦
(二)通過(guò)下載軟件進(jìn)行加速
微軟商城已有對(duì)應(yīng)的軟件可以解決該問(wèn)題,獲取路徑更為安全。
1、找到微軟商城搜索watt? toolkit:
點(diǎn)擊進(jìn)行下載,安裝完成后找到GitHub選項(xiàng)勾選進(jìn)行加速即可。
文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-813456.html
這是本人在使用GitHub時(shí)找到的做法,這兩種還是使用極慢的話建議就使用“梯子”了,希望對(duì)大家有所幫助?。?!文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-813456.html
到了這里,關(guān)于如何打開(kāi)hosts文件往里面添加GitHub相應(yīng)代碼加速其啟動(dòng)的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!