Trying to add some new projects. Previously, everything was thrown, but now Git Bash knocks an error, no matter what command I enter, for example, git add . or git commit -m "new" . I can not understand what is wrong.

fatal: Unable to create 'D: /testgit/.git/index.lock': File exists. This is a git process crashed in this repository earlier. It is necessary to continue the process.

enter image description here

  • 2
    Read. Translate. Do what is asked. - D-side
  • 2
    The screenshot should be replaced with the text of the error. - Pavel Mayorov
  • 2
    @ SashaBlack, the fact is that there it is directly written what to do . - D-side
  • one
    Thanks for the tip. And he did. Within 30 minutes I found a solution and fixed the problem) - Vladimir Lebedev
  • one
    $ rm -f ./.git/index.lock $ rm -Force ./.git/index.lock $ git status $ git add. $ git status $ git commit -m "new work" $ git push test master (if not working then) $ git push -f - Vladimir Lebedev

1 answer 1

I will translate the last sentence of the error:

Make sure no other Git processes are running and manually delete the file to continue.

Without leaving Git Bash, you can delete the file with the rm command (the -f better not to use, because if there is a typo somewhere, no error text will be displayed). In your case we enter the following:

$ rm ./.git/index.lock

The index.lock file index.lock deleted, you can continue to work.