Search code examples
gitgithubgerritgithub-enterprisegit-mirror

Mirroring Gerrit to GitHub Enterprise


I'm currently working on migration from Gerrit to GitHub. For that, I want to mirror the Gerrit repository to GitHub Enterprise.
I've run the following commands:

$ git cone --bare ssh://<gerrit_repo>
$ cd gerrit_repo.git
$ git push --mirror ssh://<github_repo>

The push is running into an error:

! [remote rejected] branch123 -> branch123 (failed)
// many more branches...
! [remote rejected] tag123 -> tag123 (failed)
// many more tags...

error: failed to push some refs to '<github_repo>'

Solution

  • The problem occurred due to bad commits in the git history.
    We truncated the git history from these faulty commits and mirrored the repo.
    Additionally we've backed up the entire Gerrit.