Git Push Error "cannot lock ref" "reference already exists"
TL;DR: try removing their branch fix
, i.e., their refs/heads/fix
, which I suspect is in the way. (Be sure they don't care if you remove it!)
The error message is very odd. If the reference refs/heads/fix/add_overlay
exists, that's not a problem! Git should be able to lock it, and if it can't, the reason it can't is not "because it exists".
I suspect that this may be a misleading error message: it may be that the reference refs/heads/fix
—not refs/heads/fix/add_overlay
—exists, so it's impossible to create a directory refs/heads/fix/
in which to hold the sub-reference refs/heads/fix/add_overlay
because the existing reference refs/heads/fix
is in the way.
You can tell whether this is the case by examining the set of references that exist (by using git ls-remote
, or after a git fetch -p
, by looking at your own set of remote-tracking names that are based on their branch names). And, if it is the case, you should convince them—whoever they are—to rename or remove their branch fix
so that you can have them create a directory named fix/
containing branch names like fix/add_overlay
.
Mike6679
Updated on June 26, 2022Comments
-
Mike6679 almost 2 years
The full error is:
remote: error: cannot lock ref 'refs/heads/fix/add_overlay': reference already exists
I'm using SourceTree, but that should not matter I don't think. I keep trying to push and I keep getting this error, how can I resolve it?