After a hard reset of my laptop that freezed after a git commit, I have the following error when I enter any command on my git repository:
$ git status
fatal: failed to read object de02e6d5cd7823ea788429a33583bede09221163: Invalid argument
Is there anyway to recover my git repository?
I did not find a solution from the two following questions:
EDIT: I did not found what caused the corruption of my git repository nor any solution to restore it... I finally started over a new clone from my SVN repository!
For me, none of the above answers worked. I just re-cloned my git repo and all was well. Before cloning, I opened up all the files that were changed and just overwrote them after the pull.
That's why you should commit often :).
Did you push your repository to anywhere like github or bitbucket recently? You could get another clone and copy the objects directory.
Otherwise:
See how many of these run:
git fsck
git branch -a
git branch -a | xargs -n 1 git log -1
git reflog
With the reflog, see which one of those you can do a successful log from. hopefully it's just your latest commit that's corrupt or one of it's trees.
Hope this helps
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With