Gerrit项目未复制到bitbucket,错误:通道未打开

Ros*_*ibi 2 git replication bitbucket jsch gerrit

我们的Gerrit项目之一在某个日期之后停止工作,并出现以下错误:

Gerrit日志中的错误/ var / gerrit / logs / error_log:[2016-07-29 17:59:51,676]

com.googlesource.gerrit.plugins.replication.ReplicationQueue错误:无法复制到git@bitbucket.org:company / product.git org.eclipse.jgit.errors.TransportException:git@bitbucket.org:company / product.git:渠道没有打开。在org.eclipse.jgit.transport.JschSession $ JschProcess。(JschSession.java:154)在org.eclipse.jgit.transport.JschSession $ JschProcess。(JschSession.java:118)在org.eclipse.jgit.transport.JschSession org.eclipse.jgit.transport.TransportGitSsh $。 org.eclipse.jgit.transport.Transport.push(Transport.java:1167)的.eclipse.jgit.transport.PushProcess.execute(PushProcess.java:154)org.eclipse.jgit.transport.Transport.push(Transport) com.googlesource.gerrit.plugins.replication.PushOne.pushVia(PushOne.java:307)处的com.googlesource.gerrit.plugins.replication.PushOne.runImpl(PushOne.java:252)处的.java:1213)。 googlesource.gerrit.plugins.replication.PushOne。com.googlesource.gerrit.plugins.replication.PushOne.access $ 000(PushOne.java:71)处的runPushOperation(PushOne.java:207)com.googlesource.gerrit.plugins.replication.PushOne $ 1.call(PushOne.java: 186),位于com.google.gerrit.server.util.RequestScopePropagator的com.google.gerrit.server.util.RequestScopePropagator $ 5.call(Request.Propergator.java:222)的com.googlesource.gerrit.plugins.replication.PushOne $ 1.call(PushOne.java:183)处。 com.google.gerrit.server.git.PerThreadRequestScope $ Propagator $ 1.call(PerThreadRequestScope.java:75)的com.google.gerrit.server.git.PerThreadRequestScope $ Propagator $ 1.call(PerThreadRequestScope.java:75)的com.googlesource.gerrit.plugins .replication.PushOne.run(PushOne.java:183)(位于java.util.concurrent.Executors $ RunnableAdapter.call(Executors.java:471)位于java.util.concurrent.FutureTask.run(FutureTask.java:262) java.util.concurrent。在com.google.gerrit.server.git.WorkQueue $ Task.run()处的ScheduledThreadPoolExecutor $ ScheduledFutureTask.access $ 201(ScheduledThreadPoolExecutor.java:178)在java.util.concurrent.ScheduledThreadPoolExecutor $ ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292)。 .java:337),位于java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145),位于java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:615),位于java.lang.Thread.run( Thread.java:745)由以下原因引起:java.lang.Thread.run(Thread.java:745)上的runWorker(ThreadPoolExecutor.java:1145)在java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:615)在原因:java.lang.Thread.run(Thread.java:745)上的runWorker(ThreadPoolExecutor.java:1145)在java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:615)在原因: com.jcraft.jsch.JSchException:通道未打开。在org.eclipse.jgit.transport.JschSession $ JschProcess。(JschSession.java:150)的com.jcraft.jsch.Channel.connect(Channel.java:197)处... 25另外

我们的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
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?提前致谢!

CRO*_*OSP 5

这是已知问题。此问题是由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
Run Code Online (Sandbox Code Playgroud)

其次,在etc/secure.config文件中设置您的Bitbucket凭据,如下所示

[remote "bitbucket"]
    password = yourBitbucketPassword
Run Code Online (Sandbox Code Playgroud)

现在,重新加载插件设置,并尝试复制存储库。

我已经写了一篇有关通过HTTPS设置复制的文章,请参考该文章以获取有关配置过程的更多详细信息。 https://crosp.net/blog/administration/devops/setting-gerrit-bitbucket-replication-https/