9

I am getting error while doing git clone.

fatal: pack has bad object at offset 824775943: inflate returned 1
fatal: index-pack failed

It is coming only on windows 10, on linux git clone is working fine

ThanhPhanLe
  • 1,315
  • 3
  • 14
  • 25
Lakshay Awasthi
  • 139
  • 1
  • 1
  • 7
  • there is a file in C:\Users\ADMIN\ called . gitconfig It was pointing to local rather than github.com. check it – MangduYogii Jul 29 '19 at 12:15

4 Answers4

13

Here are the two main causes of a fatal error.

1. Slow Internet connection

Cause of error: The repository is huge and Internet connection is simply too slow.

Solution: Changing to a faster and more stable Internet Connection Help.

2. Huge repository

Cause of error: The repository you are trying to clone is large, in terms of file size. While attempting to clone it, the remote server simply doesn’t have enough memory to cope with the execution.

Solution:

Turn of compression. Git clone partially. When it is successful, clone the rest.

1) First, turn off Git compression.

git config --global core.compression 0

2) Then do a partial clone of the repository with --depth 1 parameter. Replace username@domain.com/path/to/git_repo/ with the actual path to the repository.

git clone --depth 1 ssh://username@domain.com/path/to/git_repo/

3) Next, retrieve the rest of the repository.

git fetch --unshallow

4) Finally, finish it up with a regular pull.

git pull --all

These methods solved my problem. Hope it helps!

Ulysse BN
  • 10,116
  • 7
  • 54
  • 82
MangduYogii
  • 935
  • 10
  • 24
  • 1
    Able to download...But unable to fetch other branches tried multiple solution's like git fetch -all , git pull --all.. Please suggest how to fix this ? – infiniteLearner Sep 09 '22 at 08:37
2

The problem for my issue was on git repository a file with large size was pushed and git lfs was failing only on windows https://github.com/git-lfs/git-lfs/issues/2434

Lakshay Awasthi
  • 139
  • 1
  • 1
  • 7
0

Delete .git hidden file at your local code level and try again. Also try

git config --global --list

to see what configurations you have enabled. You can remove them if you find any unknown config.

If issue persists try reinstall git with default setting options.

Thanks.

Salman
  • 1,573
  • 3
  • 13
  • 24
  • I have tried cloning in new folder and also tried git pull. Is there no other fix for it other than reinstall – Lakshay Awasthi Jul 29 '19 at 09:26
  • Try git pull for some other repo. Check the size of the code you are fetching. I believe it to be a corrupt object on the remote server otherwise. – Salman Jul 29 '19 at 10:47
0

Update Jan. 2022: git-lfs/git-lfs issue 2434 just got closed.

It was handled by git-for-windows/git PR 3487: "Teach Git to handle huge files in smudge/clean", in commit cebe3c5.

It is fixed in Git for Windows 2.34, but not in Git 2.34.
The patch was specifically applied to Git for Windows, but has not been released in upstream Git yet.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250