Git and Gerrit Sync: push my changes made in gerrit to github repository

100 views
Skip to first unread message

Maitri Porwal

unread,
Feb 29, 2024, 8:48:31 AMFeb 29
to Repo and Gerrit Discussion

I have a existing client repository in Github which I am working on and wanted to add a review system on top of it; for that I configured Gerrit on my Ubuntu Server & installed the Github plugin as well.

Now I am able to login into Gerrit, created new project name which is same as Github repository name.

I have cloned the repo using my gerrit url http://gerrit-server:/8080/project-name.git. I can make changes to this clone commit and push the changes as well.

Now these changes are reflected onto my gerrit repository.

But once everything is reviewed and pushed I want this change to be reflected on the client repository too which is hosted on github. How do I make this happen? Is there a way to sync my gerrit repo with the github repo?

I tried using replication plugin for the same but that does not seem to be making sense. Is there any other plugin for the same or can we do this through some scripts?

Can anyone guide me on this.

Matthias Sohn

unread,
Feb 29, 2024, 8:50:55 AMFeb 29
to Maitri Porwal, Repo and Gerrit Discussion
I think using the replication plugin to replicate submitted changes from Gerrit to GitHub makes sense.
 

Can anyone guide me on this.

--
--
To unsubscribe, email repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/repo-discuss/c0daf506-45d4-4374-b04f-fff045281c9bn%40googlegroups.com.

Maitri Porwal

unread,
Feb 29, 2024, 8:55:56 AMFeb 29
to Repo and Gerrit Discussion
Thanks for your prompt reply.
Can you write down the steps to achieve this?

Sven Selberg

unread,
Feb 29, 2024, 9:00:23 AMFeb 29
to Repo and Gerrit Discussion
On Thursday, February 29, 2024 at 2:55:56 PM UTC+1 Maitri Porwal wrote:
Thanks for your prompt reply.
Can you write down the steps to achieve this?

Please don't top-post, use interleaving styles instead. Makes it easier for those who are trying to help you.
Read the plugin documentation, it should tell you what you need to know.
https://gerrit.googlesource.com/plugins/replication/+/refs/heads/master/src/main/resources/Documentation

Maitri Porwal

unread,
Mar 1, 2024, 2:00:53 AMMar 1
to Repo and Gerrit Discussion
Hi, I tried with the replication plugin to sync my gerrit push to git with the following  gerrit_testsite/etc/replication.config 

[remote "github"]

    url = g...@github.com:Maitriporwal16/hackathon_DevOps_Maitri.git

    push = +refs/*:refs/*

Then I cloned the project and made changes in the gerrit project and pushed those changes to the gerrit again. Then I reviewed and submitted those changes but nothing shown up in my Github account.

The logs gerrit_testsite/logs/replication_log are:

``` [2024-03-01 06:40:23,208] Replication to g...@github.com:Maitriporwal16/hackathon_DevOps_Maitri.git started... [CONTEXT pushOneId="ac74b3f9" ]

[2024-03-01 06:40:23,210] Push to g...@github.com:Maitriporwal16/hackathon_DevOps_Maitri.git references: RemoteRefUpdate{refSpec=refs/heads/gerrit-branch:refs/heads/gerrit-branch, status=NOT_ATTEMPTED, id=(null)..AnyObjectId[cb18ddf3bde6988bb89813aca4a17aa3acabdfd7], force=yes, delete=no, ffwd=no}, RemoteRefUpdate{refSpec=refs/changes/42/142/1:refs/changes/42/142/1, status=NOT_ATTEMPTED, id=(null)..AnyObjectId[f6ca33dd6c71509b1acf2369a8e1e3adf4ad9e0c], force=yes, delete=no, ffwd=no}, RemoteRefUpdate{refSpec=refs/changes/43/143/meta:refs/changes/43/143/meta, status=NOT_ATTEMPTED, id=(null)..AnyObjectId[3f9dad0471f13d90dc7a1ba0926438b513ece164], force=yes, delete=no, ffwd=no}, RemoteRefUpdate{refSpec=refs/changes/41/141/1:refs/changes/41/141/1, status=NOT_ATTEMPTED, id=(null)..AnyObjectId[3cdf0f4261ce38a169d5cf4da021f923d66263ad], force=yes, delete=no, ffwd=no}, RemoteRefUpdate{refSpec=refs/changes/42/142/meta:refs/changes/42/142/meta, status=NOT_ATTEMPTED, id=(null)..AnyObjectId[d336995bb958af6fcae5d040e2f44b6a86600211], force=yes, delete=no, ffwd=no}, RemoteRefUpdate{refSpec=refs/notes/review:refs/notes/review, status=NOT_ATTEMPTED, id=(null)..AnyObjectId[95da782ecf25e22dd2b5131d404b3519e0dfb1f1], force=yes, delete=no, ffwd=no}, RemoteRefUpdate{refSpec=refs/changes/43/143/1:refs/changes/43/143/1, status=NOT_ATTEMPTED, id=(null)..AnyObjectId[cb18ddf3bde6988bb89813aca4a17aa3acabdfd7], force=yes, delete=no, ffwd=no}, RemoteRefUpdate{refSpec=refs/changes/41/141/meta:refs/changes/41/141/meta, status=NOT_ATTEMPTED, id=(null)..AnyObjectId[89d1ccd08bdf53a9f1c76933de7be28c99fe2a73], force=yes, delete=no, ffwd=no}

[CONTEXT pushOneId="ac74b3f9" ]

[2024-03-01 06:40:23,398] Cannot replicate to g...@github.com:Maitriporwal16/hackathon_DevOps_Maitri.git [CONTEXT pushOneId="ac74b3f9" ]

org.eclipse.jgit.errors.TransportException: g...@github.com:Maitriporwal16/hackathon_DevOps_Maitri.git: Cannot log in at github.com:22

publickey: trying ssh-rsa key SHA256:YIdC7lPhICz5gln4eCjVlhhnvGtVA5e5Iib5wXDPkdw with signature type rsa-sha2-512

publickey: no more keys to try 

```

what I am missing here?

Sven Selberg

unread,
Mar 1, 2024, 2:12:26 AMMar 1
to Repo and Gerrit Discussion
On Friday, March 1, 2024 at 8:00:53 AM UTC+1 Maitri Porwal wrote:
Hi, I tried with the replication plugin to sync my gerrit push to git with the following  gerrit_testsite/etc/replication.config 

[remote "github"]

    url = g...@github.com:Maitriporwal16/hackathon_DevOps_Maitri.git

    push = +refs/*:refs/*

Then I cloned the project and made changes in the gerrit project and pushed those changes to the gerrit again. Then I reviewed and submitted those changes but nothing shown up in my Github account.

The logs gerrit_testsite/logs/replication_log are:

``` [2024-03-01 06:40:23,208] Replication to g...@github.com:Maitriporwal16/hackathon_DevOps_Maitri.git started... [CONTEXT pushOneId="ac74b3f9" ]

[2024-03-01 06:40:23,210] Push to g...@github.com:Maitriporwal16/hackathon_DevOps_Maitri.git references: RemoteRefUpdate{refSpec=refs/heads/gerrit-branch:refs/heads/gerrit-branch, status=NOT_ATTEMPTED, id=(null)..AnyObjectId[cb18ddf3bde6988bb89813aca4a17aa3acabdfd7], force=yes, delete=no, ffwd=no}, RemoteRefUpdate{refSpec=refs/changes/42/142/1:refs/changes/42/142/1, status=NOT_ATTEMPTED, id=(null)..AnyObjectId[f6ca33dd6c71509b1acf2369a8e1e3adf4ad9e0c], force=yes, delete=no, ffwd=no}, RemoteRefUpdate{refSpec=refs/changes/43/143/meta:refs/changes/43/143/meta, status=NOT_ATTEMPTED, id=(null)..AnyObjectId[3f9dad0471f13d90dc7a1ba0926438b513ece164], force=yes, delete=no, ffwd=no}, RemoteRefUpdate{refSpec=refs/changes/41/141/1:refs/changes/41/141/1, status=NOT_ATTEMPTED, id=(null)..AnyObjectId[3cdf0f4261ce38a169d5cf4da021f923d66263ad], force=yes, delete=no, ffwd=no}, RemoteRefUpdate{refSpec=refs/changes/42/142/meta:refs/changes/42/142/meta, status=NOT_ATTEMPTED, id=(null)..AnyObjectId[d336995bb958af6fcae5d040e2f44b6a86600211], force=yes, delete=no, ffwd=no}, RemoteRefUpdate{refSpec=refs/notes/review:refs/notes/review, status=NOT_ATTEMPTED, id=(null)..AnyObjectId[95da782ecf25e22dd2b5131d404b3519e0dfb1f1], force=yes, delete=no, ffwd=no}, RemoteRefUpdate{refSpec=refs/changes/43/143/1:refs/changes/43/143/1, status=NOT_ATTEMPTED, id=(null)..AnyObjectId[cb18ddf3bde6988bb89813aca4a17aa3acabdfd7], force=yes, delete=no, ffwd=no}, RemoteRefUpdate{refSpec=refs/changes/41/141/meta:refs/changes/41/141/meta, status=NOT_ATTEMPTED, id=(null)..AnyObjectId[89d1ccd08bdf53a9f1c76933de7be28c99fe2a73], force=yes, delete=no, ffwd=no}

[CONTEXT pushOneId="ac74b3f9" ]

[2024-03-01 06:40:23,398] Cannot replicate to g...@github.com:Maitriporwal16/hackathon_DevOps_Maitri.git [CONTEXT pushOneId="ac74b3f9" ]

org.eclipse.jgit.errors.TransportException: g...@github.com:Maitriporwal16/hackathon_DevOps_Maitri.git: Cannot log in at github.com:22

publickey: trying ssh-rsa key SHA256:YIdC7lPhICz5gln4eCjVlhhnvGtVA5e5Iib5wXDPkdw with signature type rsa-sha2-512

publickey: no more keys to try 

```

what I am missing here?

The user running the Gerrit process also performs the push to GitHub and needs to be authenticated against GitHub, this fails.
FWICT an rsa key was found, but the public key for it doesn't seem to have been registered in GitHub.

Maitri Porwal

unread,
Mar 1, 2024, 7:08:13 AMMar 1
to Repo and Gerrit Discussion
Thanks Sven Selberg, its working now!!
Reply all
Reply to author
Forward
0 new messages