Git Issue

git pull error: cannot lock refs | cannot lock ref ‘refs’ is at but expected | git error

Advertisement

After cloning from remote git repository I made some changes, committed and tried to push or

Tried to pull latest code from remote repository but getting below error?

Errors with like error: cannot lock ref

error: cannot lock existing info/refs
fatal: git-http-push failed

This case regards already existing repository.

I’m using Windows. The detailed error was:

error: cannot lock existing info/refs
fatal: git-http-push failed

Solution

git remote prune origin

What this command will do?
This will do is remove references to remote branches in the folder .git/refs/remotes/origin. So this will not affect your local branches and it will not change anything remotely, but it will update the local references you have to remote branches. It seems in some cases these references can contain data Git cannot handle correctly.

This should ideally work, if not working, checkout repository again.

  • If this doesn’t work, you can try deleting that branch from local and checkout again.

Also Read: Microservices Interview Questions

Advertisement

Leave a Reply

Your email address will not be published. Required fields are marked *

2 + one =

Share on Social Media