In normal work, you may encounter the same problem as the author that accessing GitHub is slow or cannot be opened. Here I have summarized some methods that may help you quickly access GitHub. There are different solutions for downloading large projects or obtaining small code and document projects.
One: Use a mirror site
If you need to download large projects, especially projects that take a long time to download (more than 5 minutes) and have large files (more than 30MB), it is strongly recommended to use a proxy website or transfer the project to Gitee for download.
There are many GitHub mirror sites in China that can speed up access. The following are some commonly used mirror sites:
- https://hub.fastgit.xyz/
- https://cdn.githubjs.cf/
- https://gitclone.com/
- https://www.github.do/
- https://ghproxy.com/
For smaller projects, such as code or documentation projects, you can try to use CDN acceleration to get a proper download speed.
Example: Using a GitHub mirror site
The GitHub mirror site is a convenient choice, just github.com
replace the in the project address with github.com.cnpmjs.org
:
Original address:
arduinoCopy code
https://github.com/xxx.git
Replace with:
arduinoCopy code
https://github.com.cnpmjs.org/xxx.git
Then use the following command to download:
bashCopy code
git clone https://github.com.cnpmjs.org/xxx.git
You can also try using other mirror sites like https://hub.fastgit.xyz/ .
Two: Proxy website download
If you need to download large files in GitHub Releases, it is recommended to use a proxy website. These proxy sites can significantly increase download speeds and require no registration.
Here are some recommended proxy sites:
Three: CDN acceleration (modify the Hosts file)
By modifying the system Hosts file, you can bypass domestic DNS resolution and directly access GitHub's CDN node, thereby achieving access acceleration. Here are the detailed steps to implement this method:
打开 https://www.ipaddress.com/ 查询以下四个链接的 DNS 解析地址:
- github.com
- assets-cdn.github.com
- github.global.ssl.fastly.net
- raw.githubusercontent.com
- 打开系统的 Hosts 文件,路径为
C:\Windows\System32\drivers\etc
,并添加以下内容(需管理员权限):
140.82.114.3 github.com
185.199.108.153 assets-cdn.github.com
199.232.69.194 github.global.ssl.fastly.net
185.199.108.133 raw.githubusercontent.com
请注意,对于 macOS 或其他 Linux 系统,需要进入 /etc
目录下的 Hosts 文件进行修改,并确保保存后刷新 DNS 缓存。
四:转入 Gitee 加速
如果你在 GitHub 上下载速度较慢,不妨尝试将项目转移到 Gitee,下载速度会显著提升。以下是实现这一方法的步骤:
- 找到想要下载的项目在 GitHub 上的地址,点击 "Fork" 按钮将项目复制到你自己的 GitHub 账号下。
- 登录 Gitee,将刚刚 Fork 的项目导入到 Gitee 中。
- 在 Gitee 上下载项目,你会感受到明显的下载加速。
五:安装浏览器插件
你还可以安装浏览器插件来加速访问 GitHub。例如,你可以尝试 Fast-GitHub 插件。
六:使用 FastGitHub 软件
如果你想要更稳定的加速解决方案,可以考虑安装 FastGitHub 软件。以下是软件的安装部署方式:
- 对于 Windows-x64 桌面用户,双击运行
FastGithub.UI.exe
。 对于 Windows-x64 服务用户,使用以下命令进行操作:
arduinoCopy code
`fastgithub.exe start // 以 Windows 服务安装并启动
fastgithub.exe stop // 以 Windows 服务卸载并删除`对于 Linux-x64 终端用户,可以使用以下命令启动:
bashCopy code
sudo ./fastgithub
同样,你可以将系统的自动代理设置为
http://127.0.0.1:38457
,或手动代理设置为http/https
为127.0.0.1:38457
。- 对于 macOS-x64 用户,双击运行
fastgithub
文件,并安装并设置fastgithub.cer
证书。
七:使用 Dev-Sidecar 软件
另一个值得推荐的解决方案是使用 Dev-Sidecar 软件。它可以作为其他机器的代理,适用于 Ubuntu 和 Windows 操作系统。
优点: 可以作为其他机器的代理,适用于 Ubuntu 和 Windows 操作系统。
缺点: 稳定性不如 FastGitHub,但比起一些其他方法,仍然是一个不错的选择。