git “error: corrupt loose object” after moving a directory

左心房为你撑大大i 提交于 2019-12-24 08:22:35

问题


I'm not sure if I had this error because I moved the directory that had all project files and .git but the error appeared around that time.

> git fsck 
error: corrupt loose object '25a196217ebb6e341909205575f491022eafc4d9'
fatal: loose object 25a196217ebb6e341909205575f491022eafc4d9 (stored in .git/objects/25/a196217ebb6e341909205575f491022eafc4d9) is corrupt

I searched for an answer and tried few things nothing worked.

How to recover Git objects damaged by hard disk failure? resulted in

mv: cannot stat `.git/objects/pack/*': No such file or directory
fixgit.sh: line 3: tmpgit/*.pack: No such file or directory
rm: cannot remove `tmpgit/*': No such file or directory

.git/objects/pack/ is empty. It puzzles me why it's empty.

--full option didn't help.

My next option is to revert and start over. And for the next time, I'll keep a backup up and will check git before backing up.

Additional info: here is what i get when i look at the content of the object

> git cat-file -p 25a196217ebb6e341909205575f491022eafc4d9
error: corrupt loose object '25a196217ebb6e341909205575f491022eafc4d9'
fatal: loose object 25a196217ebb6e341909205575f491022eafc4d9 (stored in .git/objects/25/a196217ebb6e341909205575f491022eafc4d9) is corrupt

and type:

> git cat-file -t 25a196217ebb6e341909205575f491022eafc4d9
blob

来源:https://stackoverflow.com/questions/10049101/git-error-corrupt-loose-object-after-moving-a-directory

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!