github - Gerrit - 复制到 github

标签 github gerrit

我通过配置gerrit复制

[remote "github"]
  url = git@github.com:MYUSERNAME/${name}.git
  push = +refs/heads/*:refs/heads/*
  push = +refs/tags/*:refs/tags/*
  timeout = 5
  replicationDelay = 0
  authGroup = Administrators

在 github 站点允许的范围内,我可以使用 gerrit2 用户登录 github。 Github 在已知主机中。 但是我收到以下错误:

[2013-06-04 20:04:54,472] ERROR com.googlesource.gerrit.plugins.replication.ReplicationQueue : Cannot replicate to git@github.com:MYUSERNAME/All-Projects.git
org.eclipse.jgit.errors.TransportException: git@github.com:MYUSERNAME/All-Projects.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:409)
    at com.googlesource.gerrit.plugins.replication.PushOne.doPushAll(PushOne.java:357)
    at com.googlesource.gerrit.plugins.replication.PushOne.generateUpdates(PushOne.java:350)
    at com.googlesource.gerrit.plugins.replication.PushOne.pushVia(PushOne.java:298)
    at com.googlesource.gerrit.plugins.replication.PushOne.runImpl(PushOne.java:252)
    at com.googlesource.gerrit.plugins.replication.PushOne.runPushOperation(PushOne.java:207)
    at com.googlesource.gerrit.plugins.replication.PushOne.access$000(PushOne.java:71)
    at com.googlesource.gerrit.plugins.replication.PushOne$1.call(PushOne.java:186)
    at com.googlesource.gerrit.plugins.replication.PushOne$1.call(PushOne.java:183)
    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:183)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206)
    at com.google.gerrit.server.git.WorkQueue$Task.run(WorkQueue.java:337)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)
Caused by: com.jcraft.jsch.JSchException: reject HostKey: github.com
    at com.jcraft.jsch.Session.checkHost(Session.java:712)
    at com.jcraft.jsch.Session.connect(Session.java:313)
    at org.eclipse.jgit.transport.JschConfigSessionFactory.getSession(JschConfigSessionFactory.java:116)
    ... 25 more

ssh访问的类似问题 与

url = ssh://git@ssh.github.com:443/MYUSERNAME/${name}.git

[2013-06-04 21:22:06,072] ERROR com.googlesource.gerrit.plugins.replication.ReplicationQueue : Cannot replicate to ssh://git@ssh.github.com:443/MYUSERNAME/All-Projects.git
org.eclipse.jgit.errors.TransportException: ssh://git@ssh.github.com:443/MYUSERNAME/All-Projects.git: reject HostKey: ssh.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:409)
    at com.googlesource.gerrit.plugins.replication.PushOne.doPushAll(PushOne.java:357)
    at com.googlesource.gerrit.plugins.replication.PushOne.generateUpdates(PushOne.java:350)
    at com.googlesource.gerrit.plugins.replication.PushOne.pushVia(PushOne.java:298)
    at com.googlesource.gerrit.plugins.replication.PushOne.runImpl(PushOne.java:252)
    at com.googlesource.gerrit.plugins.replication.PushOne.runPushOperation(PushOne.java:207)
    at com.googlesource.gerrit.plugins.replication.PushOne.access$000(PushOne.java:71)
    at com.googlesource.gerrit.plugins.replication.PushOne$1.call(PushOne.java:186)
    at com.googlesource.gerrit.plugins.replication.PushOne$1.call(PushOne.java:183)
    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:183)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206)
    at com.google.gerrit.server.git.WorkQueue$Task.run(WorkQueue.java:337)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)
Caused by: com.jcraft.jsch.JSchException: reject HostKey: ssh.github.com
    at com.jcraft.jsch.Session.checkHost(Session.java:712)
    at com.jcraft.jsch.Session.connect(Session.java:313)
    at org.eclipse.jgit.transport.JschConfigSessionFactory.getSession(JschConfigSessionFactory.java:116)
    ... 25 more

最佳答案

以运行 Gerrit 的用户身份登录(通过 SSH)。

我建议您像这样为 Gerrit 用户设置 ~/.ssh/config:

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

这会设置您的 SSH key 忽略有关(最初)未知主机的警告。

如果您可以通过 ssh github.com 连接,我们就快成功了。然后尝试使用 SSH URL 克隆 Github 存储库。

然后让 Gerrit 再次尝试复制。

此外,我建议从 replication.config 中删除 authGroup 设置。

关于github - Gerrit - 复制到 github,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16924985/

相关文章:

Git/Gerrit Jenkins 持续集成 : How to handle rebase needs

git - 在 Dockerfile 中使用 git clone "ssh://"

git - 在 Git 中删除本地提交而不更改工作目录

Azure 部署 - 授权后无法查看所有存储库

git - "git push"到带有跟踪分支的 Gerrit

git - 是否可以在不修改/压缩提交的情况下将补丁集添加到 Gerrit 审查中

github - 无法将 Jupyter Notebook 从 IBM Watson Studio 发布到 Github 存储库

GitHub:如何对超过 1500 行的新文件进行代码审查

ruby - 无法使 Travis-CI 工作

git - git push to gerrit repo时如何获取gerrit code review链接