remote rejected error in submitting patchset to gerrit via git review

343 Views Asked by At

I'm struggling to push changes to Gerrit by git review command.

Till now, I've performed the following steps:

  1. Installed a Gitblit server on my local pc as per official documentation.

  2. Installed Gerrit as per this tutorial.

Now, to push the changes for review, I performed the following operations.

git clone http://admin@localhost:8008/r/testrepo.git

modified some files

git add .
git commit -m 'my_trial_commit'

Everything worked fine till now, but when I run the git review -R for submitting new changes for review, I get the following error.

git review -R
To http://localhost:8008/r/testrepo.git
! [remote rejected] HEAD -> refs/for/master (testrepo.git is not configured to receive patchsets)
error: failed to push some refs to 'http://admin@localhost:8008/r/testrepo.git'
2

There are 2 best solutions below

3
gertvdijk On BEST ANSWER

It seems you're pushing to GitBlit, not Gerrit, because the error comes from GitBlit code. Try again, pushing to the Gerrit HTTP or SSH port.

Also, why GitBlit? The recommended (and supported) code repository browser is Gitiles (included as core plugin since 3.0).

0
Monty Taylor On

If you have a need for separate code hosting (although I agree with Gert, it'll be easier on you to just use gitiles) ... Then you might want to add a .gitreview file to your repo. The .gitreview file can point to the gerrit server. For instance:

https://opendev.org/zuul/zuul/src/branch/master/.gitreview

[gerrit]
host=review.opendev.org
port=29418
project=zuul/zuul.git

Is the zuul gitreview file - which allows cloning zuul from https://opendev.org/zuul/zuul - but let's git-review know that the gerrit for zuul is at review.opendev.org.