Git is saying that I need to pull before pushing to fast-forward but when I issue git pull origin master
it returns this error:
fatal: failed to read object 12786e6d70d76ce47ecf69c30e4d0f994d1e2fc3: Invalid argument
fatal: The remote end hung up unexpectedly
I tried doing git cat-file -t 12786e6d70d76ce47ecf69c30e4d0f994d1e2fc3
but that returns 12786e6d70d76ce47ecf69c30e4d0f994d1e2fc3: bad file
How do I see which file is the bad one and how can I fix it?
EDIT: To the war chest!
EDIT 2: can I just delete everything and begin again?
I deleted everything and pulled again. Couldn't get any work done so I had to do it :( Anyone who has any answers feel free to post.
I experience the same problem. Luckily, In the same repository in the other machine can be found by the git cat-file <hash>
command. However, that file got packed.
So, I use
git cat-file commit [hash] > make_magic.txt
and copied that file to the corrupt repository machine, run
cat make_magic.txt | git hash-object -w -t commit --stdin
And after that, this problem got resolved.
This is really better way than fetch from the beginning. I have 30,000 revisions and take at least 14 days to restore the repository from the beginning.
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