即使在安装复制插件之后,“gerrit:replicate:not found”

时间:2014-01-16 06:12:24

标签: git github rsa gerrit

我正在使用gerrit进行代码审查,我使用复制插件来保持repo与github.com同步。

但是,复制不起作用。它引发了我的错误:

[2014-01-16 11:23:04,694] ERROR com.googlesource.gerrit.plugins.replication.ReplicationQueue : Cannot replicate to git@github.com:visitvinoth/gerrit_prj_1.git
org.eclipse.jgit.errors.TransportException: git@github.com:visitvinoth/gerrit_prj_1.git: reject HostKey: github.com
    at org.eclipse.jgit.transport.JschConfigSessionFactory.getSession(JschConfigSessionFactory.java:142)
    at org.eclipse.jgit.transport.SshTransport.getSession(SshTransport.java:121)
    at org.eclipse.jgit.transport.TransportGitSsh$SshFetchConnection.<init>(TransportGitSsh.java:248)
    at org.eclipse.jgit.transport.TransportGitSsh.openFetch(TransportGitSsh.java:147)
    at com.googlesource.gerrit.plugins.replication.PushOne.listRemote(PushOne.java:468)
    at com.googlesource.gerrit.plugins.replication.PushOne.doPushAll(PushOne.java:416)
    at com.googlesource.gerrit.plugins.replication.PushOne.generateUpdates(PushOne.java:409)
    at com.googlesource.gerrit.plugins.replication.PushOne.pushVia(PushOne.java:357)
    at com.googlesource.gerrit.plugins.replication.PushOne.runImpl(PushOne.java:340)
    at com.googlesource.gerrit.plugins.replication.PushOne.runPushOperation(PushOne.java:267)
    at com.googlesource.gerrit.plugins.replication.PushOne.access$000(PushOne.java:78)
    at com.googlesource.gerrit.plugins.replication.PushOne$1.call(PushOne.java:240)
    at com.googlesource.gerrit.plugins.replication.PushOne$1.call(PushOne.java:237)
    at com.google.gerrit.server.util.RequestScopePropagator$5.call(RequestScopePropagator.java:222)
    at com.google.gerrit.server.util.RequestScopePropagator$4.call(RequestScopePropagator.java:201)
    at com.google.gerrit.server.git.PerThreadRequestScope$Propagator$1.call(PerThreadRequestScope.java:75)
    at com.googlesource.gerrit.plugins.replication.PushOne.run(PushOne.java:237)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
    at java.util.concurrent.FutureTask.run(FutureTask.java:166)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292)
    at com.google.gerrit.server.git.WorkQueue$Task.run(WorkQueue.java:360)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:724)
Caused by: com.jcraft.jsch.JSchException: reject HostKey: github.com
    at com.jcraft.jsch.Session.checkHost(Session.java:780)
    at com.jcraft.jsch.Session.connect(Session.java:342)
    at org.eclipse.jgit.transport.JschConfigSessionFactory.getSession(JschConfigSessionFactory.java:116)
    ... 25 more

我已经在我的帐户中在github.com上注册了gerrit用户的RSA密钥。

当我尝试手动触发复制命令时,

ssh -p 29412 vinoth@xxx.xxx.xx.xx gerrit replicate gerrit_prj_1

我收到了错误,

gerrit: replicate: not found

请帮忙

1 个答案:

答案 0 :(得分:2)

如果您有权访问gerrit服务器,则可以使用StephenKinganswer,并添加~/.ssh/config文件,该文件将指定要使用的密钥的位置:

Host github.com
    User git
    IdentityFile /path/to/the/private/key
    StrictHostKeyChecking no
    UserKnownHostsFile /dev/null

但是如果您使用了默认id_rsaid_rsa.pub(应该由ssh选择),那么请检查同一个Gerrit服务器上$HOME的值,正如我在提到的那样一个previous answer

由于StephenKing提及in the comments

  

有助于识别问题的错误消息部分被拒绝HostKey:github.com

如果sshid_rsa(.pub)中找不到有效$HOME/.ssh,则会查找其中包含“~/.ssh/config”条目的github.com个文件会告诉ssh在哪里找到正确的ssh密钥以连接到由“github.com”表示的服务器。


问题是:

  

因为我用sudo开始使用gerrit,所以它以root身份运行。现在我改变了,它工作正常

因此,如果密钥已在用户HOME中注册,则root用户启动的进程无法看到这些密钥。