2

I have a weird problem. Today, as I was working in multiple Git repositories, all of a sudden, I started getting

$ git st
error: bad signature
fatal: index file corrupt

in every single repository.

I already tried Jakub's reply in this post How to resolve "Error: bad index – Fatal: index file corrupt" when using Git, but it didn't work. If fixed the issue for a second, but as soon as I'm doing changes to the repository (like git add somefile) the error comes back.

I know it is a really broad and unspecific question... How can I solve this?

I'm running a Mac on El Capitan (10.11.1)

Update:

I wanted to restart my computer after that incident and the Mac crashed at the startup with massive kernel errors. I booted once into SafeMode to analyse it, but couldn't find anything. So I restarted my Mac, and the kernel error was gone, including the git problem that it caused the file corrupt error. The index file of all my git repositories I did work in where still broken, but thanks to Timemachine I could restore them.

So, I think the problem was maybe related to some kernel problems, which caused that strange behaviour. Now, everything is working again.

But I will still have an eye on that, because the problem is really wired...

Community
  • 1
  • 1
Sebastian
  • 1,873
  • 4
  • 25
  • 57
  • 1
    Which version of Git are you using? Also, please refrain from using undefined aliases in your question; stick to built-in Git commands. – jub0bs Jan 28 '16 at 12:07
  • Possible duplicate of [How to resolve "Error: bad index – Fatal: index file corrupt" when using Git](http://stackoverflow.com/questions/1115854/how-to-resolve-error-bad-index-fatal-index-file-corrupt-when-using-git) – Thomas Ayoub Jan 28 '16 at 12:08
  • Git version is v2.3.0, and no its not a duplicate because I tried that already, it fixed it for a second and as soon as i did some changes (like a `git commit`) the error was back. – Sebastian Jan 28 '16 at 12:09

2 Answers2

1

I wanted to restart my computer after that incident and the Mac crashed at the startup with massive kernel errors. I booted once into SafeMode to analyse it, but couldn't find anything. So I restarted my Mac, and the kernel error was gone, including the git problem that it caused the file corrupt error. The index file of all my git repositories I did work in where still broken, but thanks to Timemachine I could restore them.

So, I think the problem was maybe related to some kernel problems, which caused that strange behaviour. Now, everything is working again.

But I will still have an eye on that, because the problem is really wired...

Sebastian
  • 1,873
  • 4
  • 25
  • 57
0

try:

rm -f .git/index
git reset