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?
git/refs/ . In Git, a head is a ref that points to the tip (latest commit) of a branch. You can view your repository's heads in the path . git/refs/heads/ . In this path you will find one file for each branch, and the content in each file will be the commit ID of the tip (most recent commit) of that branch.
It is because some other git operation might have died ( or even still running in the rare ) in the middle and left a lock file. Once you see that no git related process is running on the server, just to be safe, you can delete the file and try to push again.
You need to remove existing .lock
file and try to push,
rm -f .git/refs/heads/master.lock
del .git\refs\heads\master.lock
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With