[Solved-1 Solution] How to fix GIT error: object file is empty?
Error Description:
When we try to commit changes, we get this error:
Solution 1:
Step 1: Make a backup of .git (in fact I do this in between every step that changes something, but with a new copy-to name, e.g. .git-old-1, .git-old-2, etc.):
Step 2: Run git fsck --full
Step 3: Remove the empty file.
Step 3: Run git fsck again. Continue deleting the empty files. We can also cd into the .gitdirectory and run find . -type f -empty -delete -print to remove all empty files. Eventually git will start to tell it was actually doing something with the object directories:
Step 4: After deleting all of the empty files, we eventually come to git fsck actually running:
Step 5: Try git reflog. Fail because the HEAD is broken.
Step 6: Google. Find thisManually get the last two lines of the reflog:
Step 7: Note that from Step 6 we learned that the HEAD is currently pointing to the very last commit. So let's try to just look at the parent commit:
Step 8: So now we need to point HEAD to 9f0abf890b113a287e10d56b66dbab66adc1662d.
Which didn't complain
Step 9: See what fsck says:
Step 10: The invalid sha1 pointer in cache-tree seemed like it was from a (now outdated) index file .So we kill it and reset the repo.
Step 11: Looking at the fsck again...
The dangling blobs are not errors
Step 12: Catching up with the local edits:
Related Searches to How to fix GIT error: object file is empty ?
git fatal loose object is corruptedfatal: bad object headgit unable to readgit missing bloberror: head: invalid sha1 pointergit fatal object is corruptedfatal: could not parse headerror encountered while fetching object not found no matching loose objectgit fatal bad object headgit object file is emptygit fatal object is corruptedfatal: could not parse headgit loose object filegit loose object is emptygit object is empty corruptgit fatal: unable to read