简介
国内访问 GitHub 还是时不时的抽风,有些时候配置代理需要额外且花费大量的代价,今天这个项目将使用修改 hosts 的方式加速访问 GitHub 的速度
下面的地址无需访问 GitHub 即可获取到最新的 hosts 内容:
- 文件:
https://raw.hellogithub.com/hosts
- JSON:
https://raw.hellogithub.com/hosts.json
hosts 文件在每个系统的位置不一,详情如下:
- Windows 系统:
C:\Windows\System32\drivers\etc\hosts
- Linux 系统:
/etc/hosts
- Mac(苹果电脑)系统:
/etc/hosts
- Android(安卓)系统:
/system/etc/hosts
- iPhone(iOS)系统:
/etc/hosts
手动复制
点击展开
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
# GitHub520 Host Start
140.82.112.26 alive.github.com
140.82.112.5 api.github.com
185.199.109.153 assets-cdn.github.com
185.199.111.133 avatars.githubusercontent.com
185.199.111.133 avatars0.githubusercontent.com
185.199.111.133 avatars1.githubusercontent.com
185.199.111.133 avatars2.githubusercontent.com
185.199.111.133 avatars3.githubusercontent.com
185.199.111.133 avatars4.githubusercontent.com
185.199.111.133 avatars5.githubusercontent.com
185.199.111.133 camo.githubusercontent.com
140.82.113.21 central.github.com
185.199.111.133 cloud.githubusercontent.com
140.82.112.10 codeload.github.com
140.82.113.22 collector.github.com
127.0.0.100 desktop.githubusercontent.com
185.199.111.133 favicons.githubusercontent.com
140.82.112.4 gist.github.com
16.15.176.0 github-cloud.s3.amazonaws.com
16.182.106.249 github-com.s3.amazonaws.com
52.216.62.241 github-production-release-asset-2e65be.s3.amazonaws.com
52.216.48.33 github-production-repository-file-5c1aeb.s3.amazonaws.com
3.5.0.201 github-production-user-asset-6210df.s3.amazonaws.com
192.0.66.2 github.blog
140.82.114.3 github.com
140.82.114.17 github.community
185.199.108.154 github.githubassets.com
151.101.193.194 github.global.ssl.fastly.net
185.199.109.153 github.io
185.199.111.133 github.map.fastly.net
185.199.109.153 githubstatus.com
140.82.113.25 live.github.com
185.199.111.133 media.githubusercontent.com
185.199.111.133 objects.githubusercontent.com
13.107.42.16 pipelines.actions.githubusercontent.com
185.199.111.133 raw.githubusercontent.com
185.199.111.133 user-images.githubusercontent.com
140.82.114.21 education.github.com
185.199.111.133 private-user-images.githubusercontent.com
# Update time: 2025-03-23T14:07:29+08:00
# Update url: https://raw.hellogithub.com/hosts
# Star me: https://github.com/521xueweihan/GitHub520
# GitHub520 Host End
|
激活生效
大部分情况下是直接生效,如未生效可尝试下面的办法,刷新 DNS:
- Windows:在 CMD 窗口输入:
ipconfig /flushdns
- Linux 命令:
sudo nscd restart
,如报错则须安装:sudo apt install nscd
或 sudo /etc/init.d/nscd restart
- Mac 命令:
sudo killall -HUP mDNSResponder
自动更新
推荐 SwitchHosts 工具管理 hosts
以 SwitchHosts 为例,看一下怎么使用的,配置参考下面:
- Hosts 类型:
Remote
- Hosts 标题: 随意
- URL:
https://raw.hellogithub.com/hosts
- 自动刷新: 最好选
1 小时
Windows
Linux
1
|
sudo sh -c 'sed -i "/# GitHub520 Host Start/Q" /etc/hosts && curl https://raw.hellogithub.com/hosts >> /etc/hosts'
|
Docker
1
|
cp /etc/hosts ~/hosts.new && sed -i "/# GitHub520 Host Start/Q" ~/hosts.new && curl https://raw.hellogithub.com/hosts >> ~/hosts.new && cp -f ~/hosts.new /etc/hosts
|
AdGuard
在 过滤器>DNS 封锁清单>添加阻止列表>添加一个自定义列表,配置如下:
- 名称:随意
- URL:
https://raw.hellogithub.com/hosts
(和上面 SwitchHosts 使用的一样)
更新间隔在 设置 > 常规设置 > 过滤器更新间隔(设置一小时一次即可),记得勾选上 使用过滤器和 Hosts 文件以拦截指定域名