3

For some reason my Git index file keeps on getting corrupted.

For example if I do git status I get

error: bad index file sha1 signature and fatal: index file corrupt

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.

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.

Anyone have any ideas?

user229044
  • 232,980
  • 40
  • 330
  • 338
garethhallnz
  • 327
  • 1
  • 3
  • 12
  • It's been quite a while since you've asked this question. Did you find an answer? Because our setup at work is very similar, and some of the colleagues have the same problem. We work on OSx, in phpStorm directly in our (samba) mounted serverfolders. – Pjetr Oct 21 '13 at 07:18
  • Sorry no. Since then I switched to Centos and I no longer have the issue. – garethhallnz Nov 12 '13 at 02:43

2 Answers2

3

Your workaround is a good one (recommended at "“Index file corrupt”").

But if samba is problematic, it would be best to get two repos:

  • one on the Mac, where you can:
    • locally edit your files
    • setup a Git server (got daemon, ssh, https, ...)
  • one on the VM, where you can pull from the Mac repo and update your working repo there (on the VM) in order to run your PHP site.
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I don't think I was very clear on my dev environment. My VM is my dev environment not my mac. I move around from computer to computer a bit so it make sense to have dev setup in a VM to be portable. This is why I samba setup so I can simply connect to the share. I don't know for a fact that it's samba causing the issue I only suspect so. – garethhallnz Oct 29 '12 at 22:28
  • @garethhallnz ok, so reverse mac and VM, but the idea stays: edit locally, goes to the other environment and pull from the VM repo. – VonC Oct 29 '12 at 22:33
  • But this does not solve my issue. The index file still gets corrupted – garethhallnz Oct 30 '12 at 04:21
  • @gar in that case, samba isn't the problem. – VonC Oct 30 '12 at 04:31
  • @garethhallnz I suspect you ended up changing your setup in order to resolve the index corruption? – VonC Apr 23 '13 at 05:16
0

You should check this though :) do a little git reset --keep. The one @VonC recommended for!

Community
  • 1
  • 1
mochadwi
  • 1,190
  • 9
  • 32
  • 87