Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I avoid Gerrit permission issues and migrate a GitHub repository to Gerrit?

Tags:

git

push

gerrit

I'm moving a GitHub project to Gerrit. I'm doing the following:

  1. Making a new project in Gerrit with no initial commit set

  2. Cloning the repo from GitHub onto my local machine.

  3. cd-ing into the repo directory on my machine

  4. Removing the GitHub remote (git remote remove origin)

  5. Adding the Gerrit remote (git remote add origin ssh://git.

  6. Making sure I've got Push rights on refs/* in the target repository in Gerrit

  7. Run git push origin master

I get the following error on running step 7: ! [remote rejected] master -> master (prohibited by Gerrit: update for creating new commit object not permitted)

I've confirmed that my push/fetch remote are in fact the Gerrit repository I want to push to. Furthermore, I've verified that I can make commits to this repository outside of my GitHub repo (e.g., I can submit a commit containing just an empty .txt file for review).

One other note: I didn't used to have this problem, but have been having it since upgrading Gerrit to 2.16.2

like image 662
snark17 Avatar asked Sep 05 '25 20:09

snark17


1 Answers

When you execute "git push origin master" you're trying to push straight to branch bypassing the code review on Gerrit (this is the usual push to review command: git push origin HEAD:refs/for/master"). The "master -> master (prohibited by Gerrit)" means you don't have permission to perform this push.

See more info about this error in Gerrit documentation here.

Note: this is a permission issue and it's not directly related to the upgrade to Gerrit 2.16.2.

like image 97
Marcelo Ávila de Oliveira Avatar answered Sep 11 '25 17:09

Marcelo Ávila de Oliveira