Push an existing repo to gerrit instance

I run gerrit local in a container podman run -ti -p 8080:8080 -p 29418:29418 gerritcodereview/gerrit

I want to add an existing repo but there are some nuances which I didnt find an answer so far.

So after created a new repo without init commit then I try to push git push -f gerrit "refs/heads/master" [--tags]

 ! [remote rejected]     master -> master (more than 10000 commits, and skip-validation not set)
error: failed to push some refs to 'http://localhost:8080/openQA'

I am not sure how would I work around this. I would like to know how can I import existing project or how is it working in gerrithub.io where the import for github is so smooth? is there a plugin for it?

Problem:

You’re getting this error from Gerrit:

(more than 10000 commits, and skip-validation not set)

Gerrit is rejecting your push because it’s trying to validate too many commits at once.


Solution:

  1. **Add skip-validation flag to allow big pushes:**Add this to the project.config of your Gerrit project:
[receive]
    skipValidation = true

Or, run this command inside your container (replace openQA with your repo name):

git config -f /var/gerrit/git/openQA/config receive.skipValidation true
  1. Restart Gerrit (if needed):
    If setting in config doesn’t take effect right away.
  2. Now push again:
git push -f gerrit HEAD:refs/heads/master

Alternative (Cleaner Way):

Instead of pushing manually:

  • Use git clone --mirror and then copy to Gerrit’s repo directory.
  • Or use repo import plugin or Gerrit REST API for more automation (though this needs scripting).

About GerritHub.io:

They have automation around project creation, permissions, and GitHub OAuth. They likely use:

  • Gerrit plugins (e.g., github-plugin)
  • Preconfigured replication / import tools

You can replicate that by using:

  • gerrit-github-plugin
  • Or scripting your own GitHub-to-Gerrit import process using the REST API.