error: cannot lock ref ‘refs/remotes/origin/xxx’: there is a non-empty directory ‘.git/refs/remotes/origin/xxx’ blocking reference ‘refs/remotes/origin/xxx

error: cannot lock ref 'refs/remotes/origin/xxx': there is a non-empty directory 

This issue usually occurs when there are 2 branches with conflicting names. Suppose let us say you have a branch “QA” and when you have another branch with a name something like “qa/feature/test”, then the above issue might occur when you are trying to build a new branch (see the lowercase at the starting of branch name qa/feature/test)

Solution: The best solution for this issue is to rename the new branch with uppercase or lowercase like the existing branch that starts with the similar name.

This issue is very similar to the one with only error name being different – http://www.azuredevopsguide.com/cannot-lock-refs-remotes-origin-xxx-xxxx-refs-remotes-origin-xxx-exists/

You may also like...