4

I keep getting this message about once an hour:

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

I've already looked online and know how to resolve it, but trying to figure out whats causing it.

I use command line tools on the server, but have the directory mounted (through sshfs) on my local computer. But i don't use local git, only the version on the remote server.

The only other thing i can think of is IntelliJ, but i stopped using there git commands thinking it was causing the conflict.

Does anyone have any clues as to what the issue could be?

dbers
  • 608
  • 5
  • 16
  • 1
    "know how to resolve it" - what are you doing to resolve this? – Greg Hewgill Aug 29 '13 at 21:22
  • rm .git/index; git reset – dbers Aug 30 '13 at 15:10
  • 1
    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:15
  • @Pjetr your setup seems very similar to mine, but i wasn't able to find an exact solution. I try to only use the cli for git and that seams to help. – dbers Oct 31 '13 at 04:14

3 Answers3

2

i don't use local git, only the version on the remote server.

There's my bet for your problem right there.

Do your work in your repo. Push to the server repo when you've got your work in some shape fit to publish. If you want to share your work-in-progress see e.g. Git push/pull between team members local repositories

(edit: you're using sshfs. Don't Do That for anything the least bit multi-user. it's a single-user convenience FUSE frontend for sftp. Even if you shut off its caching that still wouldn't close the races.)

Community
  • 1
  • 1
jthill
  • 42,819
  • 4
  • 65
  • 113
  • Ok, i guess i'll have to do that then. Thanks Dan – dbers Sep 19 '13 at 14:38
  • In my case, this answer is merely a workaround, and not optimal. Like a commenter on the OP, I am using PHPStorm on a Mac, with a samba-mounted Ubuntu VM as the git repo. This setup worked fine with a "lightweight" IDE like Dreamweaver, but since using PHPStorm my git index is regularly getting corrupted. – Adam Friedman Dec 30 '15 at 17:43
2

If you have git installed on a remote server location that also serves as the root for an IntelliJ project, then you are going to have lock contention on git. IntelliJ will continually corrupt your git index as you may also be (for instance) using git in your repo on the command-line in a terminal session.

The solution is to de-register any version control within the IntelliJ software by going to Settings > Version Control and removing your project from that listing. This should tell your IDE to completely ignore the existence of git in that project root folder, and forever cease competing for control of the git index.

See also this question: How to disable version control in phpstorm?

Community
  • 1
  • 1
Adam Friedman
  • 469
  • 4
  • 18
1

Unless you find a way of resolving the Git index file directly, run the following commands which delete the Git index file from the .git directory in your repository and "take the current branch and reset it to point somewhere else, and bring the index and work tree along" (but before, remember to backup your .git/index just in case):

$ rm .git/index
$ git reset
Community
  • 1
  • 1