问题原因

Github 访问速度很慢的原因是因为 Github 的 CDN 被某墙屏蔽了,由于网络代理商的原因,所以访问下载和访问速度很慢。Ping github.com 时,速度只有 300 多 ms,有时候甚至还会访问超时。

解决方法

Windows

打开 Dism++,点击工具箱 -> hosts 编辑器,编辑系统的 hosts 文件:
hosts.png
输入以下文本:

# =================== Github 2021-05-09 update ===================
# The hosts file is from: https://blog.sky390.cn/archives/33/
151.101.65.194    github.global.ssl.fastly.net
185.199.110.153    assets-cdn.github.com
185.199.108.153    documentcloud.github.com
192.30.255.113    gist.github.com
185.199.108.133    gist.githubusercontent.com
185.199.109.154    github.githubassets.com
185.199.109.154    help.github.com
192.30.255.121    nodeload.github.com
185.199.108.133    raw.github.com
140.82.112.18    status.github.com
185.199.110.153    training.github.com
185.199.111.133    avatars.githubusercontent.com
185.199.110.133    avatars0.githubusercontent.com
185.199.111.133    avatars1.githubusercontent.com
185.199.108.133    avatars2.githubusercontent.com
185.199.108.133    avatars3.githubusercontent.com
185.199.111.133    avatars4.githubusercontent.com
185.199.111.133    avatars5.githubusercontent.com
185.199.110.133    avatars6.githubusercontent.com
185.199.110.133    avatars7.githubusercontent.com
185.199.111.133    avatars8.githubusercontent.com
185.199.108.133    favicons.githubusercontent.com
192.30.255.121    codeload.github.com
52.216.76.172    github-cloud.s3.amazonaws.com
52.216.108.243    github-com.s3.amazonaws.com
52.217.33.204    github-production-release-asset-2e65be.s3.amazonaws.com
52.217.98.180    github-production-user-asset-6210df.s3.amazonaws.com
52.216.109.251    github-production-repository-file-5c1aeb.s3.amazonaws.com
185.199.110.153    githubstatus.com
64.71.168.201    github.community
185.199.109.133    media.githubusercontent.com
185.199.109.133    camo.githubusercontent.com
185.199.110.133    raw.githubusercontent.com
185.199.111.133    cloud.githubusercontent.com
185.199.110.133    user-images.githubusercontent.com
185.199.108.153    customer-stories-feed.github.com
185.199.111.153    pages.github.com
192.30.255.117    api.github.com
140.82.112.25    live.github.com
140.82.112.30    githubapp.com
192.30.255.113    github.com

MacOS/Linux

系统的hosts文件的位置如下:

/etc/hosts

编辑即可,也输入上述文本。
之后,重启浏览器,或刷新DNS缓存,告诉电脑 hosts 文件已经修改,MacOS/Linux执行 sudo /etc/init.d/networking restart 命令;Windows 在 cmd 中输入 ipconfig /flushdns 命令即可。

问题解决

访问速度明显提升,如下图:
Github.png
Ping.jpg

参考资料

https://blog.csdn.net/u013517229/article/details/81351885/

Ps: hosts 方法并非一定有效!

Last modification:May 9th, 2021 at 01:48 pm
赠人玫瑰,手有余香。您的赞赏是对我最大的支持!