Search code examples
gitgit-push

fatal: unable to create 'refs/heads/master.lock': File exists fatal: - Getting this error while pushing the commits


I am getting the following error while pushing 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.

What is the origin of this issue? If I remove this file from the server, will it solve the issue if the file exists?


Solution

  • You need to remove existing .lock file and try to push,

    Linux

    rm -f .git/refs/heads/master.lock
    

    Windows

    del .git\refs\heads\master.lock