我试图使用以下命令在Gitlab上克隆一个存储库:
git clone git@gitlab.com:company/folder/project.git
每次我得到这个输出:
remote: Enumerating objects: 3860, done.
remote: Counting objects: 100% (482/482), done.
remote: Compressing objects: 100% (360/360), done.
fatal: pack has bad object at offset 152904485: inflate returned 1
fatal: fetch-pack: invalid index-pack output
问题是,它只发生在我的机器上,我测试了通过ssh
远程访问linux机器的完全相同的命令,它运行得很好。另外,值得一提的是,我在Windows 11上使用了git
,如何解决这个问题呢?
发布于 2022-07-02 05:50:46
与这条线一样,开始检查所使用的协议:
git -c protocol.version=1 git@gitlab.com:company/folder/project.git
就像在这个要旨中一样,您可以使用浅层克隆(--depth
)尝试增量克隆。
REPO=$1
DIR=$2
git clone --recurse-submodules $REPO $DIR --depth=1
cd $DIR
git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
git fetch --depth=10
git fetch --depth=100
...
另一种方法,克隆到问题提交:(--shallow-exclude=
)
git clone --shallow-exclude=anOlCommit
有一个围绕索引包正在进行的修补程序 (2022年6月),关于在流中解压大型对象。
它在Windows11cmd上没有工作,但在WSL2 (Ubuntu)上工作。
自论WSL以来,这可能是一个有效的解决办法。
https://stackoverflow.com/questions/72831506
复制相似问题