解决Github访问慢等问题

第一,解决方法:修改Hosts文件
1、访问 https://www.ipaddress.com/ip-lookup

2、分别查询以下 5个链接 对应的 IP地址,查询一个之后,在下面的“Perform another IP Lookup”框里可以继续查询。

github.com
gist.github.com
github.global.ssl.fastly.net
assets-cdn.github.com
raw.githubusercontent.com


在https://www.ipaddress.com/ip-lookup上面的搜索框中复制上面的五个地址,查询到对应的IP地址,然后将得到的IP地址复制到cmd中,并ping通,看五个IP地址中谁的最快
在这里插入图片描述
我的是第一个IP五任何丢失,以下将使用此IP来进行域名解析

140.82.114.4
203.98.7.65
199.232.69.194
199.232.69.194
199.232.69.194




3、修改hosts文件,添加内容(因为每个人网络环境不同,请务必自行采用本地查询结果,不要直接复制!!!)

其中第5行到最后的IP地址,都和上面第5行查询得到IP的一样,如:

140.82.112.3 github.com
140.82.113.4 gist.github.com
199.232.69.194 github.global.ssl.fastly.net
185.199.110.153 assets-cdn.github.com
 140.82.114.4  raw.githubusercontent.com
 140.82.114.4 cloud.githubusercontent.com
 140.82.114.4 camo.githubusercontent.com
 140.82.114.4 avatars0.githubusercontent.com
 140.82.114.4 avatars1.githubusercontent.com
 140.82.114.4 avatars2.githubusercontent.com
 140.82.114.4 avatars3.githubusercontent.com
 140.82.114.4 avatars4.githubusercontent.com
 140.82.114.4 avatars5.githubusercontent.com
 140.82.114.4 avatars6.githubusercontent.com
 140.82.114.4 avatars7.githubusercontent.com
 140.82.114.4 avatars8.githubusercontent.com

注意:

windows系统的hosts文件的位置如下:C:\Windows\System32\drivers\etc\hosts

mac/linux系统的hosts文件的位置如下:/etc/hosts

因为需要管理员权限,无法直接在文件上修改,请复制hosts到桌面,更改之后再复制替换。
4.cmd运行以下代码刷新DNS

ipconfig /flushdns

5.打开Github进行测试,成功!
在这里插入图片描述
6.打开Github,可以看到不会出现无法连接的情况了
在这里插入图片描述
7.之所以要修改Github的映射地址,是因为里面很有很多的开源项目。相比gitee,gitee里面项目比较少

猜你喜欢

转载自blog.csdn.net/liuxiaobao666/article/details/115049040
今日推荐