超大源码库使用git clone --mirror克隆远程代码制作镜像失败的处理办法

由于 git clone --mirror 对服务器的内存及计算压力需求过大经常导致服务端拒绝服务强制断开连接导致失败,我们可以通过以下步骤来解决:

1. 将远程仓库用bare方式clone下来,使用如下命令

git clone --bare https://www.xxx.com/src.git  'd:\\a'

2. 新建d:\b仓库

git init --bare

3. 将a仓库push到b

cd d:\a

git push --mirror 'd:\\b'

删除d:\a临时目录

4. 记事本打开d:\b\config文件,在[remote "origin"]节增加源码地址

url = https://www.xxx.com/src.git

5. 更新b仓库获取缺失的"分支跟踪"部分

git remote update

猜你喜欢

转载自blog.csdn.net/TDGX2004/article/details/111087359