损坏的git树? [英] Corrupted git tree?

查看:107
本文介绍了损坏的git树?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我修改了一个文件,运行 git status 并且该文件显示为已修改。我使用 git add。添加了文件,并且它照常工作。但是,当我正要提交更改时,出现以下错误:

 错误:垃圾处于松散对象的末尾'e91ce852822d32e380ed7ddd04c93066e3c600ea '
fatal:object e91ce852822d32e380ed7ddd04c93066e3c600ea已损坏

运行 git cat -file -t e91ce852822d32e380ed7ddd04c93066e3c600ea ,我可以看到该对象是一棵树。



我已经看到了几种关于如何修复损坏的解决方案blob或commit,但这是一棵树,我无法找到可能出错的答案,或者如何解决它。



任何帮助表示赞赏: )

解决方案

如果您的git repo与外部资源(Github)同步,并且 ,您可以重新初始化您的回购



我所做的:

 #复制损坏的.git目录
mv -f .git .gitback
git init
#保留你的配置文件e
cp .gitback / config .git / config
#载入对象
git pull

它工作。显然,这不是一个好的解决方案,但它可以帮助

I'm having big problems with a git repository on my local machine.

I modified a file, ran git status and the file appeared as modified. I added the file using git add . and it worked as usual. But when i was about to commit the changes, i got the following error:

error: garbage at end of loose object 'e91ce852822d32e380ed7ddd04c93066e3c600ea'
fatal: object e91ce852822d32e380ed7ddd04c93066e3c600ea is corrupted

By running git cat-file -t e91ce852822d32e380ed7ddd04c93066e3c600ea, i can see that the object is a tree.

I've seen several solutions on how to repair a corrupt blob or commit, but this is a tree, and I can't find an answer on what could have went wrong, or how to fix it.

Any help appreciated :)

解决方案

If your git repo is synchronised with an external ressource (Github) and if any solution didn't work, you can re-init your repo

what I've done :

# copy the corrupted .git dir
mv -f .git .gitback
git init
# keep your config file
cp .gitback/config .git/config
# load objects
git pull

It worked. Obviously, it's not a great solution, but it can help

这篇关于损坏的git树?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆