问题
I have configured the replication with following configurations
$cat /var/gerrit/review_site/etc/replication.config
[gerrit]
autoReload=true
[remote "bt-git"]
projects = ^vt-(.*)$
push = refs/heads/*:refs/heads/*
url = git@git.something.com:/${name}.git
My ssh config file looks like this one,
Host git
HostName git.something.com
User git
IdentityFile /var/gerrit/.ssh/id_rsa
StrictHostKeyChecking no
UserKnownHostsFile /dev/null
Although I have already added the right set of hostkeys in my ~/.ssh/known_hosts the replication plugin fails with the following stacktrace
[2017-08-02 13:08:55,194] [a6b3228d] Replication to git@git.something.com:/vt-test.git started...
[2017-08-02 13:08:55,320] [a6b3228d] Push to git@git.something.com:/vt-test.git references: [RemoteRefUpdate[remoteName=refs/heads/master, NOT_ATTEMPTED, (null)...990c876ff3860fbfd421a9785c87506126b89d1b, srcRef=refs/heads/master, message=null]]
[2017-08-02 13:08:55,379] [a6b3228d] Cannot replicate to git.something.com:/vt-test.git
org.eclipse.jgit.errors.TransportException: git.something.com:/vt-test.git: reject HostKey: git.something.com
at org.eclipse.jgit.transport.JschConfigSessionFactory.getSession(JschConfigSessionFactory.java:160)
at org.eclipse.jgit.transport.SshTransport.getSession(SshTransport.java:137)
at org.eclipse.jgit.transport.TransportGitSsh$SshPushConnection.<init>(TransportGitSsh.java:322)
at org.eclipse.jgit.transport.TransportGitSsh.openPush(TransportGitSsh.java:167)
at org.eclipse.jgit.transport.PushProcess.execute(PushProcess.java:160)
at org.eclipse.jgit.transport.Transport.push(Transport.java:1272)
at org.eclipse.jgit.transport.Transport.push(Transport.java:1318)
at com.googlesource.gerrit.plugins.replication.PushOne.pushVia(PushOne.java:437)
at com.googlesource.gerrit.plugins.replication.PushOne.runImpl(PushOne.java:416)
at com.googlesource.gerrit.plugins.replication.PushOne.runPushOperation(PushOne.java:318)
at com.googlesource.gerrit.plugins.replication.PushOne.access$000(PushOne.java:86)
at com.googlesource.gerrit.plugins.replication.PushOne$1.call(PushOne.java:284)
at com.googlesource.gerrit.plugins.replication.PushOne$1.call(PushOne.java:281)
at com.google.gerrit.server.util.RequestScopePropagator$5.call(RequestScopePropagator.java:221)
at com.google.gerrit.server.util.RequestScopePropagator$4.call(RequestScopePropagator.java:200)
at com.google.gerrit.server.git.PerThreadRequestScope$Propagator$1.call(PerThreadRequestScope.java:75)
at com.googlesource.gerrit.plugins.replication.PushOne.run(PushOne.java:281)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at com.google.gerrit.server.git.WorkQueue$Task.run(WorkQueue.java:417)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: com.jcraft.jsch.JSchException: reject HostKey: git.something.com
at com.jcraft.jsch.Session.checkHost(Session.java:791)
at com.jcraft.jsch.Session.connect(Session.java:342)
at org.eclipse.jgit.transport.JschConfigSessionFactory.getSession(JschConfigSessionFactory.java:117)
... 24 more
However I am able to clone the repository from the same machine and it works seamlessly.
来源:https://stackoverflow.com/questions/45462161/gerrit-replicating-to-gitolite-fails