Dec
9

Fix GIT Lock after GIT Crash

If you ever see the following message when trying to commit your code to a GIT repository.

If no other git process is currently running, this probably means a
git process crashed in this repository earlier. Make sure no other git
process is running and remove the file manually to continue.


The solution is very easy, just delete the .git/index.lock file
~ rm /yourhomedir/.git/index.lock

Then you need to do a git reset
~ git reset

That should do the trick. Let me know if this worked for you.

8 Comments to “Fix GIT Lock after GIT Crash”

  • It worked . Thanks a lot!

    • Great to hear that this solution worked for you.

  • I am getting the following error while push the commit

    git push origin master

    fatal: unable to create 'refs/heads/master.lock': File exists fatal:
    The remote end hung up unexpectedly

    I thought of removing the lock file (refs/heads/master.lock) from my local machine. But this file is not available.

    I think this file is in git server.

    If i remove this file from server will it solve the issue? ( if the file exists in server)

    What is the origin of this issue?

  • Merci beaucoup :)

  • Works! Thx!

  • Worked for me too. Thanks a lot! :)

  • another thankful git user :)

  • Thanks, worked like a charm.

Leave a comment