gerrit 到 github 复制:jsch 问题

发布于 2024-12-05 05:40:58 字数 3802 浏览 1 评论 0原文

尝试设置从 gerrit 到我的 github 存储库的复制。获取此堆栈跟踪:

[2011-09-20 00:11:58,470] com.google.gerrit.server.git.PushReplication 错误:无法复制到 [电子邮件受保护]:myuser/myrepo.git
org.eclipse.jgit.errors.TransportException:[电子邮件受保护]:myuser /myrepo.git:Session.connect:java.net.SocketTimeoutException:读取定时出
在 org.eclipse.jgit.transport.JschConfigSessionFactory.getSession(JschConfigSessionFactory.java:138)
在 org.eclipse.jgit.transport.SshTransport.getSession(SshTransport.java:121)
在 org.eclipse.jgit.transport.TransportGitSsh$SshFetchConnection。(TransportGitSsh.java:248)
在 org.eclipse.jgit.transport.TransportGitSsh.openFetch(TransportGitSsh.java:147)
在 com.google.gerrit.server.git.PushOp.listRemote(PushOp.java:358)
在 com.google.gerrit.server.git.PushOp.generateUpdates(PushOp.java:312)
在 com.google.gerrit.server.git.PushOp.pushVia(PushOp.java:258)
在 com.google.gerrit.server.git.PushOp.runImpl(PushOp.java:213)
在 com.google.gerrit.server.git.PushOp.run(PushOp.java:166)
在 java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
在 java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
在 java.util.concurrent.FutureTask.run(FutureTask.java:138)
在 java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
在 java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206)
在 com.google.gerrit.server.git.WorkQueue$Task.run(WorkQueue.java:324)
在 java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
在 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
在 java.lang.Thread.run(Thread.java:662)

原因:com.jcraft.jsch.JSchException:Session.connect:java.net.SocketTimeoutException:读取超时
在 com.jcraft.jsch.Session.connect(Session.java:504)
在 org.eclipse.jgit.transport.JschConfigSessionFactory.getSession(JschConfigSessionFactory.java:128)

我的配置文件如下:

replication.config:

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

secure.config:

[database]
    password = secret
[ssh]
    file = /home/gerrit2/.ssh/config

.ssh/config:

Host github.com:
  IdentityFile ~/.ssh/id_rsa
  PreferredAuthentications publickey

我尝试运行

ssh -i etc/ssh_host_dsa_key [email protected]
ssh -i etc/ssh_host_rsa_key [email protected]
ssh -i ~/.ssh/id_rsa [email protected]
ssh -i ~/.ssh/id_dsa  [email protected]

并能够“点击”github所以密钥导入正常,不确定问题是什么, 任何建议表示赞赏。

Trying to setup replication from gerrit to my github repo. Getting this stacktrace:

[2011-09-20 00:11:58,470] ERROR com.google.gerrit.server.git.PushReplication : Cannot replicate to [email protected]:myuser/myrepo.git
org.eclipse.jgit.errors.TransportException: [email protected]:myuser/myrepo.git: Session.connect: java.net.SocketTimeoutException: Read timed out
at org.eclipse.jgit.transport.JschConfigSessionFactory.getSession(JschConfigSessionFactory.java:138)
at org.eclipse.jgit.transport.SshTransport.getSession(SshTransport.java:121)
at org.eclipse.jgit.transport.TransportGitSsh$SshFetchConnection.(TransportGitSsh.java:248)
at org.eclipse.jgit.transport.TransportGitSsh.openFetch(TransportGitSsh.java:147)
at com.google.gerrit.server.git.PushOp.listRemote(PushOp.java:358)
at com.google.gerrit.server.git.PushOp.generateUpdates(PushOp.java:312)
at com.google.gerrit.server.git.PushOp.pushVia(PushOp.java:258)
at com.google.gerrit.server.git.PushOp.runImpl(PushOp.java:213)
at com.google.gerrit.server.git.PushOp.run(PushOp.java:166)
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:324)
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: Session.connect: java.net.SocketTimeoutException: Read timed out
at com.jcraft.jsch.Session.connect(Session.java:504)
at org.eclipse.jgit.transport.JschConfigSessionFactory.getSession(JschConfigSessionFactory.java:128)

My config files are as follows:

replication.config:

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

secure.config:

[database]
    password = secret
[ssh]
    file = /home/gerrit2/.ssh/config

.ssh/config:

Host github.com:
  IdentityFile ~/.ssh/id_rsa
  PreferredAuthentications publickey

I tried running

ssh -i etc/ssh_host_dsa_key [email protected]
ssh -i etc/ssh_host_rsa_key [email protected]
ssh -i ~/.ssh/id_rsa [email protected]
ssh -i ~/.ssh/id_dsa  [email protected]

and was able to "hit" github so the keys are imported OK, not sure what the problem is,
any suggestions appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

晨敛清荷 2024-12-12 05:40:58

正如异常的名称 SocketTimeoutException 所说(及其 文档详细信息):

表示套接字读取或接受发生超时的信号。

查看Gerrit的replication.config文档:

远程。<名称>.超时

放弃并声明远程端之前等待网络读取或写入完成的秒数
没有回应。如果为0,则没有超时,推送客户端无限期等待。

超时应该足够大,以便将大部分对象传输到另一端。 1秒可能太小
对于较大的项目,尤其是通过 WAN 链接的项目,10-30 秒是更合理的超时值。

默认为 0 秒,无限期等待。

您的值是 5 秒,您可以尝试使用更大的值。

(该问题仅与 JSch 间接相关 - JSch 的 Session.connect(int) 将简单地获取超时参数并将其传递给它创建的 Socket。 href="https://github.com/ePaul/jsch-documentation/issues/2" rel="nofollow">提醒我我应该记录 JSch 的超时单位 - 秒或毫秒。)

As the name of the exception SocketTimeoutException says (and its documentation details):

Signals that a timeout has occurred on a socket read or accept.

Looking in the documentation of Gerrit's replication.config:

remote.<name>.timeout

Number of seconds to wait for a network read or write to complete before giving up and declaring the remote side
is not responding. If 0, there is no timeout, and the push client waits indefinitely.

A timeout should be large enough to mostly transfer the objects to the other side. 1 second may be too small
for larger projects, especially over a WAN link, while 10-30 seconds is a much more reasonable timeout value.

Defaults to 0 seconds, wait indefinitely.

Your value is 5 seconds, you could try it with a larger value instead.

(The problem is only indirectly related to JSch - JSch's Session.connect(int) will simply take the timeout parameter and pass it on to the Socket it creates. That reminds me that I should document which unit this timeout is for JSch - seconds or milliseconds.)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文