如果是下载比较大的项目,比如耗时5min往上,大小30mb往上,十分推荐使用代理网站下载,或者转入gitee的方式下载.
如果仅仅是下载比较小的项目,类似代码性质,文档性质的项目,使用cdn加速,提升到100多KB/s也就够用了
例如:使用github的镜像网站:http://cnpmjs.org
原地址:
https://github.com/xxx.git
替换为:
https://github.com.cnpmjs.org/xxx.git
示例:
git clone https://github.com.cnpmjs.org/xxx.git
说白了,就在http://github.com后面加个.cnpmjs.org
即可
推荐:https://hub.fastgit.xyz/
是否推荐 | 网址 | 操作 |
---|---|---|
https://hub.fastgit.xyz/ 或https://hub.fastgit.org/ | git clone https://hub.fastgit.xyz/…… | |
https://hub.おうか.tw/ | git clone https://hub.xn--p8jhe.tw/…… | |
https://hub.連接.台灣/ | git clone https://hub.xn--gzu630h.xn--kpry57d/…… | |
https://cdn.githubjs.cf/ | 只能看,不能git | |
https://gitclone.com/ | git clone https://gitclone.com/github.com/…… | |
https://www.github.do/ | git clone https://github.do/https://github.com/…… | |
https://ghproxy.com/ | git clone https://ghproxy.com/https://github.com/…… |
对于github release中下载的大文件,推荐代理网站,速度起飞,无需注册,亲测有效。
推荐:
https://ghproxy.com/
https://toolwa.com/github/
通过修改系统hosts文件的办法,绕过国内dns解析,直接访问GitHub的CDN节点,从而达到github访问加速的目的。不需要海外的服务器辅助。
GitHub在国内访问速度慢的问题原因有很多,但最直接和最主要的原因是GitHub的分发加速网络的域名遭到dns污染,下载网站上任何东西的时候会下半天,有时还会失败需要从头再来,多失败了几次又因访问次数过多被做了ip限制,让人恼火
做到以上需要三步
首先,打开 https://www.ipaddress.com/
查询以下4个链接的DNS解析地址
github.com
assets-cdn.github.com
github.global.ssl.fastly.net
raw.githubusercontent.com
接着,打开系统hosts文件(需管理员权限)。
路径:C:\Windows\System32\drivers\etc
mac或者其他linux系统的话,是/etc下的hosts文件,需要切入到root用户修改
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
echo "
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
185.199.108.154 github.githubassets.com
" >> /etc/hosts
并在末尾添加三行记录并保存。(需管理员权限,注意IP地址与域名间需留有空格)
最后,Windows+X 打开系统命令行(管理员身份)或powershell
运行 ipconfig /flushdns
手动刷新系统DNS缓存。
mac系统修改完hosts文件,保存并退出就可以了.不要要多一步刷新操作. centos系统执行/etc/init.d/network restart命令 使得hosts生效
最终下载速度对比
github 42KB/s (加了github访问cdn)
imggithub下载速度
gitee 1034KB/s 大约25倍与github的速度
gitee下载速度
例:我们要下载https://github.com/DoubleLabyrinth/navicat-keygen
先访问要下载的仓库的地址(在chrome中打
点击fork (fork会把这个仓库复制一份到你的github账号的名下,所以你需要有个githu账号,没有的注册一下,有了的记得登陆)
点完之后
注意到这个仓库已经到了我们的名下
好了 github这边的事我们暂时做完了
现在登陆gitee (没有账号的注册一个账号)
然后点击
gitee
接着会出现一个授权
然后可能会出现第一输入密码的地方
这儿输入mac的登陆密码 并点击始终允许
然后出现
输入 github账号的密码 之后出现
选择我们刚刚的项目 navicat-keygen -> 导入
gitee正在帮我们从github下载(gitee从github下载的速度一定是很快的,毕竟大网站)
一般来说30s内就处理好自动刷新了
然后我们复制这个网址
然后我们下载这个地址
可以看到速度
地址:https://github.com/fhefh2015/Fast-GitHub
使用方式:
从设置->更多工具->扩展程序 打开扩展程序页面,或者地址栏输入 chrome://extensions/ 按下回车打开扩展程序页面
安装插件:开发者模式 -> 刷新页面 -> 下载好的 .crx 文件拖入扩展程序
如果在添加谷歌插件的时候,却发现谷歌浏览器显示 程序包无效:"CRX_HEADER_INVALID"
谷歌浏览器显示 程序包无效:"CRX_HEADER_INVALID" 解决方式
在扩展安装页面打开右上角的【开发者模式】按钮,然后刷新页面,将下载好的.crx文件拖入扩展安装页面内。
github:https://github.com/dotnetcore/fastgithub/releases
官网:https://fastgithub.cn/
fastgithub.exe start
// 以windows服务安装并启动fastgithub.exe stop
// 以windows服务卸载并删除sudo ./fastgithub
http://127.0.0.1:38457
,或手动代理http/https为127.0.0.1:38457
wget https://github.com/dotnetcore/FastGithub/releases/download/2.1.4/fastgithub_linux-x64.zip
unzip fastgithub_linux-x64.zip -d /usr/local/
cd /usr/local/fastgithub_linux-x64/
./fastgithub start
systemctl status fastgithub.service
sudo ./fastgithub start
// 以systemd服务安装并启动sudo ./fastgithub stop
// 以systemd服务卸载并删除http://127.0.0.1:38457
,或手动代理http/https为127.0.0.1:38457
http://127.0.0.1:38457
,或手动代理http/https为127.0.0.1:38457
https://github.com/docker/compose
curl --insecure -L https://download.fastgit.org/docker/compose/releases/download/v2.6.0/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
docker-compose -v
cat > docker-compose.yml <<"EOF"
version: "3.7"
services:
fastgithub:
image: slcnx/fastgithub
network_mode: host
restart: always
volumes:
- cacert:/fastgithub/cacert/
sample:
depends_on:
- fastgithub
image: slcnx/ubuntu:18.04
volumes:
- cacert:/tmp/cacert
- build_data:/build_data
working_dir: /build_data
restart: on-failure
tty: true
entrypoint: sh -c 'cp /tmp/cacert/fastgithub.cer /usr/local/share/ca-certificates/fastgithub.crt && update-ca-certificates && git clone https://github.com/kubernetes/kubernetes.git'
command: ""
environment:
https_proxy: http://0.0.0.0:38457
http_proxy: http://0.0.0.0:38457
network_mode: host
build:
working_dir: /build_data
depends_on:
- sample
image: nginx
volumes:
- build_data:/build_data
volumes:
cacert: {}
build_data: {}
EOF
连接到 github.com 时发生错误。对等端的证书有一个无效的签名。 错误代码:SEC_ERROR_BAD_SIGNATURE
解决办法
1、地址栏输入:about:config
2、 输入首选项名称:security.enterprise_roots.enabled
3、修改值为:true
设置->隐私与安全->证书->查看证书->证书颁发机构,导入cacert/fastgithub.cer,勾选“信任由此证书颁发机构来标识网站”
fatal: unable to access 'https://github.com/xxx.git/' SSL certificate problem: unable to get local issuer certificate
解决办法
管理员身份运行:cmd
在cmd输入:git config --global http.sslverify false
1、开启该代理后,picgo不能上传图片,报错“RequestError: Error: unable to verify the first certificate”,目前无解
2、目前只能代理本机的github加速,不能作为其它机器的代理。
https://github.com/docmirror/dev-sidecar
https://github.com/docmirror/dev-sidecar/releases/tag/v1.7.3
windows下载安装即可。
Ubuntu:
wget https://github.com/docmirror/dev-sidecar/releases/download/v1.7.3/DevSidecar-1.7.3.AppImage
chmod +x ./DevSidecar-1.7.3.AppImage
./DevSidecar-1.7.3.AppImage --no-sandbox
可以作为其它机器的代理,可以在Ubuntu或windows上使用。
稳定性不如fastgithub好,即加速效果不如fastgithub好。
但是,不影响picgo上传图片,对我来说比较合适。
连接到 github.com 时发生错误。对等端的证书有一个无效的签名。
错误代码:SEC_ERROR_BAD_SIGNATURE
解决:
方法一:将服务端的crt文件拷贝过来,并导入证书。
方法二:取消“启用拦截”的选项。
image-20220608093608125
1、代理网站:https://ghproxy.com/
2、安装软件:fastgithub 或 dev-sidecar
参考:https://blog.csdn.net/Ejzq1/article/details/123560340