我们的一个 Gerrit 项目在特定日期后停止工作并出现以下错误:
来自 Gerrit 日志的错误/var/gerrit/logs/error_log:[2016-07-29 17:59:51,676]
ERROR com.googlesource.gerrit.plugins.replication.ReplicationQueue : Cannot replicate to git@bitbucket.org:company/product.git org.eclipse.jgit.errors.TransportException: git@bitbucket.org:company/product.git: channel is not opened. at org.eclipse.jgit.transport.JschSession$JschProcess.(JschSession.java:154) at org.eclipse.jgit.transport.JschSession$JschProcess.(JschSession.java:118) at org.eclipse.jgit.transport.JschSession.exec(JschSession.java:91) at org.eclipse.jgit.transport.TransportGitSsh$SshPushConnection.(TransportGitSsh.java:306) at org.eclipse.jgit.transport.TransportGitSsh.openPush(TransportGitSsh.java:152) at org.eclipse.jgit.transport.PushProcess.execute(PushProcess.java:154) at org.eclipse.jgit.transport.Transport.push(Transport.java:1167) at org.eclipse.jgit.transport.Transport.push(Transport.java:1213) at com.googlesource.gerrit.plugins.replication.PushOne.pushVia(PushOne.java:307) 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:471) at java.util.concurrent.FutureTask.run(FutureTask.java:262) 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:337) 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:745) Caused by: com.jcraft.jsch.JSchException: channel is not opened. at com.jcraft.jsch.Channel.connect(Channel.java:197) at org.eclipse.jgit.transport.JschSession$JschProcess.(JschSession.java:150) ... 25 more
我们的 Gerrit 版本是 2.6.1,安装在 AWS 的 CentOS 6.8 版上。
我的 gerrit 复制配置是:
[remote "bitbucket"]
url = git@bitbucket.org:qpidhealth/${name}.git
push = +refs/heads/*:refs/heads/*
push = +refs/tags/*:refs/tags/*
threads = 2
authGroup = Replication
有什么想法吗?提前致谢!
最佳答案
这是已知问题。这个问题是由 Git 在后台使用的 SSH 引起的。 Bitbucket 禁用了 SSH 多路复用,因此我们收到此错误。有一些建议的解决方案,但它们都不适合我。 https://community.atlassian.com/t5/Bitbucket-questions/Can-t-repo-sync-anymore/qaq-p/354231
所以我决定尝试使用 HTTPS,它确实有效。
首先你需要添加一个远程部分到replication.config
文件
[remote "bitbucket"]
url = https://USER@bitbucket.org/USER/${name}.git
push = +refs/tags/*:refs/tags/*
push = +refs/heads/*:refs/heads/*
mirror = true
projects = NameOfYourProject
replicateOnStartup = true
replicatePermissions = false
其次,在 etc/secure.config
文件中设置您的 Bitbucket 凭证,如下所示
[remote "bitbucket"]
password = yourBitbucketPassword
现在重新加载插件设置并尝试复制一个存储库。
我写了一篇关于通过 HTTPS 设置复制的文章,请参阅它以获取有关配置过程的更多详细信息。 https://crosp.net/blog/administration/devops/setting-gerrit-bitbucket-replication-https/
关于git - Gerrit 项目未复制到 bitbucket,错误 : channel is not opened,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38884232/