github 快速访问 hosts文件修改

访问github的时候,常常遇到访问速度慢的问题,这边提供一种解决方案,经亲测

其实访问速度慢的大概率是因为DNS污染,DNS就相当于是IP地址和网址的桥梁,不过有可能这时候DNS将网址指向错误的IP地址使得网页访问错误等等的出现。所以如果我们能手动指向正确的IP地址就可以解决上述问题,下面给出具体的操作步骤

  • C:\Windows\System32\drivers\etc打开此路径下的hosts文件添加如下指定ip
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# update: 20230220
# author: Kevin
# Github Hosts
# domain: github.com
140.82.114.3 github.com
140.82.112.10 nodeload.github.com
140.82.112.6 api.github.com
140.82.114.10 codeload.github.com
140.82.113.3 www.github.com

185.199.108.133 raw.github.com
185.199.108.153 training.github.com
185.199.108.153 assets-cdn.github.com
185.199.108.153 documentcloud.github.com
140.82.113.17 help.github.com

# domain: githubstatus.com
185.199.108.153 githubstatus.com

# domain: fastly.net
151.101.129.194 github.global.ssl.fastly.net

# domain: githubusercontent.com
185.199.108.133 raw.githubusercontent.com
185.199.108.154 pkg-containers.githubusercontent.com
185.199.108.133 cloud.githubusercontent.com
185.199.108.133 gist.githubusercontent.com
185.199.108.133 marketplace-screenshots.githubusercontent.com
185.199.108.133 repository-images.githubusercontent.com
185.199.108.133 user-images.githubusercontent.com
185.199.108.133 desktop.githubusercontent.com
185.199.108.133 avatars.githubusercontent.com
185.199.108.133 avatars0.githubusercontent.com
185.199.108.133 avatars1.githubusercontent.com
185.199.108.133 avatars2.githubusercontent.com
185.199.108.133 avatars3.githubusercontent.com
185.199.108.133 avatars4.githubusercontent.com
185.199.108.133 avatars5.githubusercontent.com
185.199.108.133 avatars6.githubusercontent.com
185.199.108.133 avatars7.githubusercontent.com
185.199.108.133 avatars8.githubusercontent.com
# End of the section


  • 打开cmd,输入ipconfig /flushdns清楚缓存

当然由于一些原因上述的IP地址并不是绝对固定的,但是一般只有前四个IP地址改变,如果一旦访问速度又打回原形,那么就可以自行在

https://www.ipaddress.com

进行IP地址查阅,我也会不定时(👻)更新

  • IP地址 - 操作方法(比如 github.com )

在这边输入网址然后就可以看到其目前的IP地址

其余方法同上,同时网上不少人提到的图片显示的问题,直接将我上面的hosts文件源码贴进去应该可以解决

**如果方法可以实现功能的话,please star me😁😁**

https://github.com/HY-Kevin/share_exploring.git