仓库主体部分
以 https://github.com/grpc/grpc 仓库为示例;
-
方法一:Gitee 克隆 github 仓库;
-
方法二:使用替换网址的加速服务
1 2 3 4 5 6 7
# 原网址 git clone https://github.com/grpc/grpc.git # 加速服务网址 git clone https://hub.fastgit.org/grpc/grpc.git git clone https://gitclone.com/github.com/grpc/grpc.git git clone https://github.com.cnpmjs.org/grpc/grpc.git
gitmodule 部分
以 https://github.com/grpc/grpc 仓库为示例;
-
打开仓库中 .gitmodules 文件,替换所有的
https://github.com/
为下面加速网址中的一个:如果效果不好,就更换一个再尝试;
https://hub.fastgit.org/
https://gitclone.com/github.com/
https://github.com.cnpmjs.org/
可以直接替换命令进行替换:
1 2 3 4 5 6 7 8
# 替换服务1:hub.fastgit.org sed -i 's/https:\/\/github.com\//https:\/\/hub.fastgit.org\//g' .gitmodules # 替换服务2:gitclone.com/github.com sed -i 's/https:\/\/github.com\//https:\/\/gitclone.com\/github.com\//g' .gitmodules # 替换服务3:github.com.cnpmjs.org sed -i 's/https:\/\/github.com\//https:\/\/github.com.cnpmjs.org\//g' .gitmodules
-
接着更新所有子模块
1
git submodule update --init