Question

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?

Was it helpful?

Solution

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.

OTHER TIPS

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top