【问题标题】:Hudson git error ssh哈德森 git 错误 ssh
【发布时间】:2011-03-31 19:27:55
【问题描述】:

如果有人可以帮助我理解为什么这个 git repo 不能克隆,那就太棒了。

我从它工作的终端运行了相同的命令。我希望找出我可以将密码放在哪里,以便服务器可以验证连接。

请,谢谢。

ERROR: Error cloning remote repo 'origin' : Could not clone ssh://build@kdmanalytics.net/usr/local/repository/kdm/git/TestCaseGenerator.git
ERROR: Cause: Error performing /usr/bin/git clone -o origin ssh://build@kdmanalytics.net/usr/local/repository/kdm/git/TestCaseGenerator.git /var/lib/hudson/jobs/KDM_Test_Case_Generator/workspace
Command returned status code 128: Initialized empty Git repository in /var/lib/hudson/jobs/KDM_Test_Case_Generator/workspace/.git/
No protocol specified

(ssh-askpass:12523): Gtk-WARNING **: cannot open display: :0.0
Host key verification failed.
fatal: The remote end hung up unexpectedly

Trying next repository
ERROR: Could not clone repository
FATAL: Could not clone
hudson.plugins.git.GitException: Could not clone
    at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:719)
    at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:658)
    at hudson.FilePath.act(FilePath.java:753)
    at hudson.FilePath.act(FilePath.java:735)
    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:658)
    at hudson.model.AbstractProject.checkout(AbstractProject.java:1046)
    at hudson.model.AbstractBuild$AbstractRunner.checkout(AbstractBuild.java:479)
    at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:411)
    at hudson.model.Run.run(Run.java:1248)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
    at hudson.model.ResourceController.execute(ResourceController.java:88)
    at hudson.model.Executor.run(Executor.java:129)

【问题讨论】:

  • 您是从终端以 hudson 身份运行它还是以您自己的身份运行它?
  • Hudson 无法建立 ssh 连接,因为您的密钥受密码保护。

标签: git ssh continuous-integration hudson


【解决方案1】:

你应该在你的 repo 和 git 服务器之间建立一个 ssh 信任关系。

您只需执行一次。

简而言之,qs 如下:

以运行 hudson 的用户身份登录

ssh-keygen

使用空密码

这会在 .ssh 中创建 2 个文件:id_dsa 和 id_dsa.pub。

cat .ssh/id_dsa.pub

现在复制代表公钥的乱码。

ssh repo-server

确认您要将主机密钥添加到 known_hosts。使用访问 repo 的帐户登录。

cat - >>.ssh/authorized_keys

(仔细检查您是否有 2 个 >,否则可能会激怒您的同事) 然后粘贴你刚刚复制的乱码。

注销并验证您现在无需提供密码即可 ssh。

这适用于基于 Unix 的主机。对于 github、gitosis、windows 的过程类似,当然也不一样。

Hudson 现在应该可以连接了。

【讨论】:

  • 谢谢!我一直在苦苦挣扎,不明白为什么我的 SSH 密钥不起作用,直到我阅读了您的说明,特别是“以运行 hundson 的用户身份登录”这一行 :-)
【解决方案2】:

该网址应该是:

ssh://build@kdmanalytics.net:/usr/local/repository/kdm/git/TestCaseGenerator.git

?

(“.net”后缺少冒号)

【讨论】:

  • 如果您提供“明确”使用的协议,则不需要':'。
【解决方案3】:

如果一切正常,但奇怪的是无法正常工作,请确保您的项目是在您配置的从站上重新构建的。

【讨论】:

    【解决方案4】:

    您必须检查以下内容:

    1. 您正在使用运行 hudson 守护程序的用户的 ssh 密钥。例如,如果 user=hudson,那么您应该以 hudson 身份登录并生成 ssh 密钥
    2. 您已从正确的 .ssh/id_rsa.pub 文件(即运行 hudson daemon 的同一用户)将您的公钥加载到您的服务器(github、assembla)
    3. 您已将服务器的 RSA 指纹添加到您的 .ssh/known_hosts 文件中

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-08-12
      • 2011-04-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多