开发者

Git Bad File Fatal Error

开发者 https://www.devze.com 2023-04-11 14:45 出处:网络
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:

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 j开发者_JS百科ust 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.


Have you tried git clean && git pull? You might want to backup your untracked files prior to issuing the commands.


When I get The remote end hung up unexpectedly (under Windows) it usually means the network drive containing origin is not mounted.

Can you rule out git was just having connection problems?


"git checkout -- ." from the root project directory usually fixes such errors for me, if the connection / authentication is working .

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号