前言
最近网站大部分图片访问变慢, 原因出在jsdelivr加速失效, 为此我更换了CDN域名, 顺带总结一下github加速小技巧
GitHub访问加速
1. 使用镜像访问
这相当于是克隆版的 GitHub , 网站的内容和 GitHub 是完整同步, 可以在这个网站里面进行下载克隆等操作, 镜像地址如下:
使用示范:
1 | https://github.com/typecho/typecho |
2.修改Host文件加速
首先需要获取对应域名实际ip地址, 可以通过以下网站查询:

需要查询的地址有:
1 | # 基本地址 |
一个一个查询太过麻烦, 可以使用python脚本快速批量获取, 代码如下:
1 | #!/usr/bin/env python |
执行脚本后, 得到如下结果:
1 | # GitHub Start |
将以上内容拷贝到系统Host文件中即可, 不同操作系统host文件所在路径不一样:
- Windows系统:修改
C:\Windows\System32\drivers\etc\hosts文件
1 | # 网络刷新 |
Linux系统:修改
C:\Windows\System32\drivers\etc\hosts文件1
2# 网络刷新
systemctl restart network
仓库Clone下载加速
1. 将仓库克隆到Gitee

2.使用Fast-GitHub浏览器插件

3.第三方网站解析加速




Raw资源加速
1. 使用fastgit
将raw.githubusercontent.com替换成raw.staticdn.net或者raw.gitmirror.com
使用示例
实际上fastgit功能很丰富, 几乎囊括了github所有. 具体如下表:
反代列表
| 站源 | 地址 | 缓存 |
|---|---|---|
| github.com | hub.fastgit.xyz | 无 |
| raw.githubusercontent.com | raw.staticdn.net | 无 |
| github.githubassets.com | assets.fastgit.org | 无 |
| customer-stories-feed.github.com | customer-stories-feed.fastgit.org | 480 分钟 |
| Github Download | download.fastgit.org | 480 分钟 |
| GitHub Archive | archive.fastgit.org | 无 |
2.使用ghproxy
在https://raw.githubusercontent.com地址前面添加https://ghproxy.com/
比如:
1 | https://ghproxy.com/https://raw.githubusercontent.com/stilleshan/ServerStatus/master/Dockerfile |
本文为作者原创转载时请注明出处 谢谢
