问题描述:
某次在拉取大仓库(2.2G)时,报错如下
[root@localhost ~]# git clone http://git.aaa.net/xxx/bbb_ios.git
正克隆到 'bbb_ios'...
Username for 'http://git.aaa.net': ccc
Password for 'http://ccc@git.aaa.net':
remote: Counting objects: 26216, done.
remote: aborting due to possible repository corruption on the remote side.
fatal: protocol error: bad pack header
经过大量资料查询,其中给到一种原因及解决方法是这样的:
发生这个问题一般是项目中某些资源太大导致,可以尝试ssh方式clone ,或者解决方式如下
首次clone的层数定位在第一层
#git clone 仓库地址 --depth 1
然后cd到项目目录中
#cd 项目目录
在此下拉内部文件,--unshallow 即不使用浅克隆
#git fetch --unshallow
然而这样操作完之后,有两个问题:
- 得到的代码不全的
- 执行git fetch --unshallow依然会报同样的错
然后有人又给到解决方案,继续实践:
git config --global pack.windowMemory “200m”
git config --global pack.SizeLimit “200m”
git config --global pack.threads 1
git cl