'SourceTree Error: 'git status' failed with code 128: error: inflate: data stream error (incorrect header check)

I got this error with open SourceTree

$ git fsck --full
error: inflate: data stream error (incorrect header check)
error: unable to unpack 06c147f2771e280dfb4758c9a83b94346993d172 header
error: inflate: data stream error (incorrect header check)
fatal: loose object 06c147f2771e280dfb4758c9a83b94346993d172 (stored in .git/objects/06/c147f2771e280dfb4758c9a83b94346993d172) is corrupt

also, try this, and remove the all corrupted objects. after removing objects i write this command,

$ git reset --hard
error: unable to read sha1 file of 3X/3X.Core/Resources/Resource.Designer.cs (d46f74436ae02ec61a659a8a487aee5747e2feda)
error: unable to read sha1 file of 3X/3X.Core/Resources/Resource.resx (63342162564404ccae4917489dc78ebb65075f8a)
error: unable to read sha1 file of 3X/3X.Web/Views/Job/ConfirmationAdvice.cshtml (ff39e42f5cf0e0703bd9dfe84a4b746ff91eea40)
error: unable to read sha1 file of 3X/3X.Web/Views/Job/Create.cshtml (3a97827faac6c62fd24f347dd0b0951c27c03751)
error: unable to read sha1 file of 3X/3X.Web/Views/Job/DataEntry.cshtml (89f381bafaeff53eeaf64a26d8c9608e9e86b6a1)
error: unable to read sha1 file of 3X/3X.Web/wwwroot/js/viewjs/Job/create.js (1b62c618c31add2ca28d107c1a49604492409ecf)
fatal: Could not reset index file to revision 'HEAD'.

and got above error



Solution 1:[1]

Try with removing your index file which is in .git folder

Windows System:

del .git\index
git reset

Linux System:

rm -f .git/index
git reset

And if you have deleted index file manually then you need to do

git reset

Solution 2:[2]

It should be corrupted. Try removing this .git/objects/06/c147f2771e280dfb4758c9a83b94346993d172

If you are getting same error with another object try removing all those and fetch again.

Solution 3:[3]

Here is the solution that worked for me i opened my server and went to .git/ and downloaded index file from there then deleted the local .git/index file manually and replace the file with the downloaded index file

Solution 4:[4]

Tried all answers and none worked with me.

Finally figured out that the problem is that you have probably configured your Source Tree repo to be located at repo_local_url/.git

The solution is to make it point at repo_local_url instead

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Yash Patel
Solution 2 smilyface
Solution 3 SalluBhai
Solution 4 Ahmed Gamal