国内云服务器高速下载GitHub方法-修改hosts
有时候在安装许多国外的软件/操作面板之类的东西时,遇到GitHub的,国内服务器得重试不知道多少次。今天老白博客分享一个:基于hosts修改的国内腾讯云服务器GitHub高速下载方法,详细教程如下
1.获取GitHub高速下载/访问IP
我们平常访问/下载GitHub的资料时,一般用到域名为:github.com、raw.githubusercontent.com。因此我们需要找到国内访问这两个域名效果较好的ip,此处分享两个小工具查询
https://sites.ipaddress.com/github.com/
https://ping.chinaz.com/github.com
以站长工具为例,进入后输入对应的网址,我们选择响应时间短的这几个ip就行,超时的就不要了
20.205.243.166、20.205.243.166
以此类推,选择好两个域名的ip,接下来就是添加到hosts中了
2.Linux服务器hosts修改
查看:
cat /etc/hosts
修改:
vim /etc/hosts
按 i 切换至编辑模式。
将上面查询到的合适ip加到hosts文件即可
20.205.243.166 github.com
185.199.111.133 raw.githubusercontent.com
185.199.111.133 raw.githubusercontent.com
输入完成后,按 Esc,输入 :wq,保存文件并返回。
3.GitHub高速IP快速获取
开源地址:https://github.com/521xueweihan/GitHub520
下面的地址无需访问 GitHub 即可获取到最新的 hosts 内容:
- 文件:
https://raw.hellogithub.com/hosts
- JSON:
https://raw.hellogithub.com/hosts.json
最新ip列表
# GitHub520 Host Start
140.82.114.25 alive.github.com
140.82.112.5 api.github.com
185.199.110.153 assets-cdn.github.com
185.199.109.133 avatars.githubusercontent.com
185.199.109.133 avatars0.githubusercontent.com
185.199.109.133 avatars1.githubusercontent.com
185.199.109.133 avatars2.githubusercontent.com
185.199.109.133 avatars3.githubusercontent.com
185.199.109.133 avatars4.githubusercontent.com
185.199.109.133 avatars5.githubusercontent.com
185.199.109.133 camo.githubusercontent.com
140.82.114.21 central.github.com
185.199.109.133 cloud.githubusercontent.com
140.82.114.10 codeload.github.com
140.82.112.22 collector.github.com
185.199.109.133 desktop.githubusercontent.com
185.199.109.133 favicons.githubusercontent.com
140.82.112.4 gist.github.com
54.231.131.57 github-cloud.s3.amazonaws.com
52.217.233.129 github-com.s3.amazonaws.com
54.231.232.41 github-production-release-asset-2e65be.s3.amazonaws.com
52.217.46.60 github-production-repository-file-5c1aeb.s3.amazonaws.com
52.217.202.169 github-production-user-asset-6210df.s3.amazonaws.com
192.0.66.2 github.blog
140.82.113.4 github.com
140.82.112.17 github.community
185.199.110.154 github.githubassets.com
151.101.1.194 github.global.ssl.fastly.net
185.199.110.153 github.io
185.199.109.133 github.map.fastly.net
185.199.110.153 githubstatus.com
140.82.112.25 live.github.com
185.199.109.133 media.githubusercontent.com
185.199.109.133 objects.githubusercontent.com
13.107.42.16 pipelines.actions.githubusercontent.com
185.199.109.133 raw.githubusercontent.com
185.199.109.133 user-images.githubusercontent.com
13.107.246.40 vscode.dev
140.82.114.22 education.github.com
# Update time: 2024-01-25T08:20:07+08:00
# Update url: https://raw.hellogithub.com/hosts
# Star me: https://github.com/521xueweihan/GitHub520
# GitHub520 Host End