Github国内加速克隆及下载
Github在国内的镜像地址
- fastgit.org
- https://doc.fastgit.org/
- gitclone.com
- https://gitclone.com/
- gitee
- https://gitee.com/mirrors
- cnpmjs.org
- https://github.com.cnpmjs.org/
克隆加速
主要是对github.com进行替换,替换成镜像地址。这种方法只适合克隆源本身,如果想把源里面链接的其它源也克隆下来,需要使用免替换方法。例子:
- # 原地址
- git clone https://github.com/kubernetes/kubernetes.git
- # 改为
- git clone https://github.com.cnpmjs.org/kubernetes/kubernetes.git
- # 或者
- git clone https://hub.fastgit.org/kubernetes/kubernetes.git
- # 或者
- git clone https://gitclone.com/github.com/kubernetes/kubernetes.git
release下载加速
同样地,也是对github.com进行替换。例子:
- # 原地址
- wget https://github.com/goharbor/harbor/release/download/v2.0.2/harbor-offline-installer-v2.0.2.tgz
- # 改为
- wget https://gitclone.com/goharbor/harbor/release/download/v2.0.2/harbor-offline-installer-v2.0.2.tgz
免替换方法
对git config进行设置
- git config --global url."https://hub.fastgit.org".insteadOf https://github.com
- # 测试
- git clone https://github.com/NVIDIA/apex
查看git配置信息
- git config --global list
取消设置
- git config --global --unset url.https://github.com/.
但是发现上面取消设置的命令行会在config文件中再加一条替换设置,不好用。可以直接在.gitconfig文件中删除与替换相关的设置。
由于服务器上大家用的是同一个账号,免替换方法会影响到其他人,所以不推荐这个免替换方法。
raw文件下载加速
- # 原地址
- wget https://raw.githubusercontent.com/kubernetes/kubernetes/master/README.md
- # 替换为
- wget https://raw.staticdn.net/kubernetes/kubernetes/master/README.md
提供web界面的github资源加速网站
- Github文件加速: https://gh.api.99988866.xyz/
- Github仓库加速: https://github.zhlh6.cn/
- Github仓库加速: http://toolwa.com/github/