hobbes
hobbes

Reputation: 467

Why is git review failing with 'failed to push refs' message?

I've installed GitLab, and Gerrit and am currently testing out Gerrit using the Gerrit Wiki. However, whenever I try to push my change to gerrit using the gerrit_test branch, I'm getting this message when running git review -R. Any idea why this error is coming up?

$ git review -R
remote: error: cannot lock ref 'refs/publish/master/gerrit_test': 'refs/publish/master' exists; cannot create 'refs/publish/master/gerrit_test'
To git@git.<host>.com:<user>/scripts.git
 ! [remote rejected] HEAD -> refs/publish/master/gerrit_test (failed to update ref)
error: failed to push some refs to 'git@git.<host>.com:<user>/scripts.git

If there are any details I'm missing that may be helpful, let me know and I can share.

Upvotes: 0

Views: 513

Answers (1)

jedifans
jedifans

Reputation: 2297

If the remote has a branch foo, you can't push the foo/test branch because foo has been created as a file rather than a directory in the remote's refs directory.

Try creating a review of the non-master branch, perhaps feature/test-gerrit, or perhaps there is a setting for the pattern to use when creating a review branch from git review.

Upvotes: 1

Related Questions