请注意:该方法只使用于 https 协议,不适用于 SSH 协议!
一、加速镜像
克隆加速
1 2 3 4 5 6 7 8 9 10 11
| 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下载加速
1 2 3 4 5
| wget https://github.com/goharbor/harbor/releases/download/v2.0.2/harbor-offline-installer-v2.0.2.tgz
wget https://hub.fastgit.org/goharbor/harbor/releases/download/v2.0.2/harbor-offline-installer-v2.0.2.tgz
|
raw文件下载加速
1 2 3 4 5
| wget https://raw.githubusercontent.com/kubernetes/kubernetes/master/README.md
wget https://raw.staticdn.net/kubernetes/kubernetes/master/README.md
|
二、一键免替换镜像地址
替换设置
可以直接在配置文件中动态替换 Github 的地址,这样不用每次克隆的时候都修改地址
1
| git config --global url."https://github.com.cnpmjs.org/".insteadOf "https://github.com/"
|
测试
1
| git clone https://github.com/kubernetes/kubernetes.git
|
取消设置
1
| git config --global --unset url.https://github.com/.insteadof
|
查看 Git 配置信息
1
| git config --global --list
|