docker-gerrit icon indicating copy to clipboard operation
docker-gerrit copied to clipboard

Replication failed for private gitlab server

Open yihongyuelan opened this issue 5 years ago • 2 comments

I'm running 3.0.4 gerrit in docker, and I got replication fail log as below: Caused by: org.eclipse.jgit.errors.UnsupportedCredentialItem: ssh://[email protected]:22: org.eclipse.jgit.transport.CredentialItem$YesNoType:The authenticity of host 'git.xx.com' can't be established. RSA key fingerprint is 4e:87:0d:3d:c4:4a:5f:21:b5:af:22:99:41:02:de:0d.

replication.config: [remote "git.xx.com"] url = [email protected]:my-group/${name}.git push = +refs/heads/:refs/heads/ push = +refs/tags/:refs/tags/ push = +refs/changes/:refs/changes/ threads = 3 rescheduleDelay = 15 [replication] maxRetries = 1 [gerrit] autoReload = true replicateOnStartup = true

I want to know where to config the ssh keys?I've tried these two options, but replication still failed.

  1. docker exec -it myGerrit /bin/bash and then ssh-keygen -t rsa -C [email protected], cat /root/.ssh/id_rsa.pub and add to private gitlab server. Add /root/.ssh/config file: Host git.xx.com: IdentityFile ~/.ssh/id_rsa PreferredAuthentications publickey

Opiton 1 result: Caused by: org.eclipse.jgit.errors.UnsupportedCredentialItem: ssh://[email protected]:22: org.eclipse.jgit.transport.CredentialItem$YesNoType:The authenticity of host 'git.xx.com' can't be established. RSA key fingerprint is 4e:87:0d:3d:c4:4a:5f:21:b5:af:22:99:41:02:de:0d.

  1. docker exec -it myGerrit /bin/bash and then su -s /bin/bash gerrit2, and process ssh-keygen -t rsa -C [email protected]. cat ~/.ssh/id_rsa.pub and add to private gitlab server. Add /var/gerrit/.ssh/config file (If switch to gerrit2, cd ~ then the home path is /var/gerrit): Host git.xx.com: IdentityFile ~/.ssh/id_rsa PreferredAuthentications publickey

Option2 result: Cannot replicate to [email protected]:my-group/GerritTest.git org.eclipse.jgit.errors.TransportException: [email protected]:my-group/GerritTest.git: Auth fail

If I generate a ssh key, both two options process ssh -T [email protected] success (outputs:elcome to GitLab, gerrit.admin!)

My question is how to config replication plugin for gerrit in docker.

Thanks BR

yihongyuelan avatar Dec 19 '19 10:12 yihongyuelan

I've never used replicating over ssh. I'm using http instead. However, according to the document. The format of local user's key should be pem. I wounder if this info may helps.

thinkernel avatar Mar 09 '20 11:03 thinkernel

@yihongyuelan Did you solve it? I also have this problem on k8s

w-huaqiang avatar Apr 18 '20 10:04 w-huaqiang