1

I am having a bit of a problem here with git. I have a drupal set up. I have the proper .gitignore set up.

everytime i do git add . and git status. i get index file corrupt error.

I followed this How to resolve "Error: bad index – Fatal: index file corrupt" when using Git to fix it, but it keeps coming back. I tried removing entire .git folder. but it didnt work.

Does anyone know how to fix this?

Community
  • 1
  • 1
Funky Dude
  • 3,867
  • 2
  • 23
  • 33
  • What do you mean remove `.git`?/ After that you have nothing – manojlds Oct 13 '11 at 17:17
  • yes the entire .git folder. after removing it, i had nothing. so initiated a new git repo. and do git add . again. but the same error happened. – Funky Dude Oct 13 '11 at 17:18
  • Mhmm, my suggestion: try delete hole git project, then try clone it again and see if it works. By the way, in your provided link says: remove only index file, not hole .git folder... – ZeroSuf3r Oct 13 '11 at 17:56
  • cant delete the project. i tried both, removed index file and whole .git folder. neither works. – Funky Dude Oct 13 '11 at 18:04

1 Answers1

2

I was having this exact problem.

I figured out my problem was that there were two other .git folders in subdirectories. I had cloned two repos into these sub folders. I removed these two .git folders and I was able to use git again.

To find these other .git folders I ran this command:

find . -name ".git" -type d
amalloy
  • 89,153
  • 8
  • 140
  • 205
tedbow
  • 151
  • 1
  • 3