git索引损坏 [英] git Index corruption
问题描述
由于某些原因,我的Git索引文件不断损坏.
For some reason my Git index file keeps on getting corrupted.
例如,如果我执行git status
我会得到
For example if I do git status
I get
错误:索引文件sha1签名错误,并且致命:索引文件损坏
error: bad index file sha1 signature and fatal: index file corrupt
这件事在我身上已经发生过好几次了.我认为这可能与我的开发环境有关.我在Mac上工作,并且有一个运行Debian并带有Apache MySQL,PHP和Git的VMWare虚拟机.我使用Samba连接到vm,以在IDE中编辑文件.所以我认为这与桑巴舞有关系吗?为什么有更好的理由来连接/共享工作空间?
This has happened to me several times now. I am thinking perhaps it's something to do with my dev environment. I work on a Mac and have a VMWare Virtual Machine running Debian with Apache MySQL, PHP and Git. I use Samba to connect to the vm to edit my files in my IDE. So I am thinking it has something to do with samba? Is there a better why to connect/share the work space?
问题是我什至不知道该如何重现问题,我尝试了各种方法来打开和关闭编辑并关闭,重新启动以及还不是很幸运的事情.
The thing is I don't know how to even recreate the problem, I tried varies things to open and close edit and close, restart and what not still no luck.
但是后来我无故意识到突然又收到了错误消息.目前,我的工作是删除索引文件.git/index并执行git reset.
But then for no reason I am aware of suddenly I get the error again. My work around at the moment is to delete the index file .git/index and do a git reset.
有人有什么主意吗?
推荐答案
您的解决方法是一个很好的解决方法(建议在"索引文件损坏" ").
Your workaround is a good one (recommended at ""Index file corrupt"").
但是,如果samba出现问题,则最好获得两个 仓库:
But if samba is problematic, it would be best to get two repos:
-
在Mac上的
- 一个,您可以在其中:
- 本地编辑文件
- 设置 Git服务器(获取守护程序,ssh,https等)
- one on the Mac, where you can:
- locally edit your files
- setup a Git server (got daemon, ssh, https, ...)
这篇关于git索引损坏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!