0

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'
Rohit Lal
  • 2,791
  • 1
  • 20
  • 36
  • I met this question yesterday when pushing my code: 'testrepo.git is not configured to receive patchsets', but I have no idea how to handle it. – mingle08 Mar 18 '23 at 02:35

2 Answers2

0

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).

gertvdijk
  • 24,056
  • 6
  • 41
  • 67
  • I have a Gitblit repository already setup for my team and it will not be feasible to migrate to a different repo. Moreover, where can I get the Gerrit url string (HTTP/SSH port) that you mentioned? Please bear with me if that's a layman question, as I've just started out with gerrit code review. – Rohit Lal Oct 01 '19 at 13:37
  • 1
    Let's take one step back. If you're using Gerrit, Gerrit should be hosting the repositories and you'll be pushing and fetching from Gerrit. It seems that you're asking for a solution to host repositories in GitBlit, but using Gerrit as review tool. That's not how it works. In Gerrit, GitBlit can be installed as a plugin for code browsing, but it's unmaintained. URLs for fetching/pushing can be seen in the Gerrit Web UI, see project listing. – gertvdijk Oct 01 '19 at 13:44
  • Okay makes sense, thanks for the confirmation. I'll then migrate from Gitblit to another repository for code storage. – Rohit Lal Oct 24 '19 at 07:21
0

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.