1

I realize this question has been answered in other threads. However, my issue (I believe) is unique.

Backstory: I am a git bash noob. I only recently started using it, and as a result, have done quite a few dumb things. I create a test file, AWACSfile.txt, staged it with git add. I then did git commit, and here is where the problems started.

It brought up a new screen & prompted me for notes (or some other requirement when staging) that I did not add to the commit line. At that point, I didn't know what to do and attempted to exit the bash shell.

It gave me a warning saying processes were still open. I ignored it, assuming that they would terminate when I exited the shell. Wrong. Following that, I was unable to merge branches, switch branches, I could not delete the file, I could not unstage the file, I cannot do anything really without it giving me the attached error:enter image description here

I attempted to delete the index.lock file as well, but same error was met. I'm at a point where I have no idea what to do - I even tried uninstalling & it wouldn't uninstall because the process is still open with no force kill.

Matthew
  • 817
  • 1
  • 13
  • 39

1 Answers1

4

It gave me a warning saying processes were still open. I ignored it, assuming that they would terminate when I exited the shell. Wrong.

Windows has mandatory file locking, meaning if a process has a file open you cannot delete it. Something is holding onto index.lock and shutting down the shell might not kill it.

Without seeing your previous Git history I can't say what that process might be. It could be any number of things which use index.lock hanging. An editor process used by git commit could be the culprit. You could find the process which is holding index.lock open and kill it.

Or you can try turning it off and on again: ie. restart your computer to ensure any hanging processes are stopped.

Schwern
  • 153,029
  • 25
  • 195
  • 336