Home > Back-end >  pack has bad object at offset 152904485
pack has bad object at offset 152904485

Time:07-03

I'm trying to clone a repository on Gitlab with the command:

git clone [email protected]:company/folder/project.git

And every time I get this output:

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

The thing is, it happens only on my machine, I tested the exact same command accessing a linux machine remotely through ssh and it works just fine. Also, it's relevant to mention that I'm using git on Windows 11. How can I solve this?

CodePudding user response:

As in this thread, start checking the protocol used:

git -c protocol.version=1 [email protected]:company/folder/project.git

As bit as in this gist, you could try an incremental clone, using a shallow clone (--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
...

Another approach, clone up to the problematic commit: (--shallow-exclude=<revision>)

git clone --shallow-exclude=anOlCommit

There is a patch in progress around index-pack (June 2022), about unpacking large object in a stream.


The OP Otávio Augusto Silva confirms in the comments:

It didn't worked on Windows 11 cmd but it worked on WSL2 (Ubuntu)

And since Git can be installed on Windows AND on WSL, that could be a valid workaround.

  • Related