ankur
ankur

Reputation: 69

How to sync gerrit repository with github repository?

I am trying to sync a github repository with the exisiting gerrit repository. So the process I follow is as shown below;

So I cloned the gerrit repo and pulled the branch from the github and while pushing I am getting

Writing objects: 100% (114/114), 18.10 KiB | 18.10 MiB/s, done.
Total 85 (delta 41), reused 61 (delta 31)
remote: Resolving deltas: 100% (41/41)
remote: Processing changes: refs: 1, done
remote: ERROR: commit 4d6f8bf: missing Change-Id in message footer
remote:
remote: Hint: to automatically insert a Change-Id, install the hook:
remote:   gitdir=$(git rev-parse --git-dir); scp -p [email protected]:hooks/commit-msg ${gitdir}/hooks/
remote: and then amend the commit:
remote:   git commit --amend --no-edit
remote: Finally, push your changes again
remote:
To ssh://[email protected]/example/directory
 ! [remote rejected]     HEAD -> refs/for/master(commit 4d6f8bf: missing Change-Id in message footer)
error: failed to push some refs to 'ssh://[email protected]/example/directory'

I used git push gerrit-url origin HEAD:refs/for/master for pushing. So can someone help me out with this.

And also github is actually a clone of the code from gerrit and github has some changes being made which I want to sync in gerrit.

Upvotes: 0

Views: 2371

Answers (1)

uncletall
uncletall

Reputation: 6842

The problem is that the person who committed the changes to github did not add a change id to the commit message. This is not a problem because you do not want to review those changes as they have already been merged to the master branch in Github.

From your ID it looks like you will have admin rights. In this case you should not push the changes for review but push them to a branch and merge that branch to your gerrit master.

Assuming that the remote origin is gerrit and github points to github then you could try this:

  1. Create branch github on Gerrit
  2. git checkout -B github github/master
  3. push origin HEAD:github
  4. git checkout -B master origin/master
  5. git merge github
  6. git push origin HEAD:refs/for/master
  7. After this has been merged you can remove your github branch

Upvotes: 1

Related Questions