问题现象
GitHub在国内访问奇慢,图片常常不能加载,git clone
等速度奇慢。
问题原因
GitHub在国内访问速度慢的原因其实有很多,但最主要的原因就是GitHub的分发加速网络(CDN)域名遭到DNS污染。
解决方法
0. 2022.1 再更新FastGithub
https://github.com/dotnetcore/FastGithubv
1. 2021.12 再更新Devsidecar
https://github.com/docmirror/dev-sidecar/releases
https://gitee.com/docmirror/dev-sidecar/releases
安装使用即可
1. 正确上网
这里只能说懂的都懂,懂的自然懂。
2. 修改hosts文件
×:手动查询
- 打开IP Address网站,查询下面网址对应的IP地址
github.com
gist.github.com
assets-cdn.github.com
raw.githubusercontent.com
gist.githubusercontent.com
cloud.githubusercontent.com
camo.githubusercontent.com
user-images.githubusercontent.com
avatars0.githubusercontent.com
avatars1.githubusercontent.com
avatars2.githubusercontent.com
avatars3.githubusercontent.com
avatars4.githubusercontent.com
avatars5.githubusercontent.com
avatars6.githubusercontent.com
avatars7.githubusercontent.com
avatars8.githubusercontent.com
api.github.com
documentcloud.github.com
help.github.com
nodeload.github.com
codeload.github.com
raw.github.com
status.github.com
training.github.com
github.global.ssl.fastly.net
github.githubassets.com
central.github.com
desktop.githubusercontent.com
github.map.fastly.net
github.io
raw.githubusercontent.com
favicons.githubusercontent.com
github-cloud.s3.amazonaws.com
github-com.s3.amazonaws.com
github-production-release-asset-2e65be.s3.amazonaws.com
github-production-user-asset-6210df.s3.amazonaws.com
github-production-repository-file-5c1aeb.s3.amazonaws.com
githubstatus.com
github.community
media.githubusercontent.com
- 写成类似
140.82.113.4 github.com
的格式再写入hosts文件里- Windows 系统:
C:\Windows\System32\drivers\etc\hosts
- Linux 系统:
/etc/hosts
- Mac(苹果电脑)系统:
/etc/hosts
- Android(安卓)系统:
/system/etc/hosts
- iPhone(iOS)系统:
/etc/hosts
- Windows 系统:
- 刷新DNS缓存
- Windows:在 CMD 窗口输入:
ipconfig /flushdns
- Linux 命令:
sudo rcnscd restart
- Mac 命令:
sudo killall -HUP mDNSResponder
- Windows:在 CMD 窗口输入:
Tips: 上述方法无效可以尝试重启机器。
✓:自动查询
一、exe/jar
有大佬写了个JAVA小工具,这里我把它打包成exe文件
,方便大家使用。
下载地址:https://xiadengma.lanzoui.com/iwuiPmpk5pc
- 使用方法:
- 打开
exe文件
,访问http://127.0.0.1:8880 - 等待进度条加载完成,将输出的信息放入
hosts文件
中 - 然后刷新DNS缓存。
- 打开
二、GitHub520(推荐)
有大佬写了GitHub520这个项目,每天自动定时更新,保证最新有效。
使用项目里面的hosts文件
也是很不错的,使用一些工具还可以自动更换hosts文件
。
三、UsbEAm Hosts Editor by 羽翼城
羽翼城大佬写了个小工具UsbEAm Hosts Editor,可以用来加速Github、Steam等的访问,真的很不错!
3. 插件/脚本
油猴脚本(推荐)
X.I.U大佬写了这个脚本,可以很方便的在网页上加速github的各种服务。
Chrome插件
和上面的油猴脚本的效果相似。
4. 通过 Gitee 中转
- 访问 gitee 网站 并登录,在顶部选择“从 GitHub/GitLab 导入仓库”
- 在导入页面中粘贴你的Github仓库地址,点击导入
- 等待导入操作完成,然后在导入的仓库中下载浏览对应的该 GitHub 仓库代码,你也可以点击仓库顶部的“刷新”按钮进行 Github 代码仓库的同步
5. 码云 GitHub 镜像站
“Gitee 极速下载” 是为了提升国内下载速度的镜像仓库,每日同步一次。
看仓库数量,有大概22k的项目。
6. 最新发现:UU加速器
听网友说有这种有趣的用法,感兴趣可以去试试.
Comments | NOTHING