Hudson无法从Git仓库获取代码

3

我有一个运行在我们的服务器(一台Ubuntu机器上)上的Hudson服务器和Git仓库。
每当我尝试使用Hudson构建我的应用程序时,它会显示以下信息:

Iniciado pelo usuário anonymous
Checkout:workspace / /usr/share/tomcat6/.hudson/jobs/ECF/workspace - hudson.remoting.LocalChannel@176150c
Using strategy: Default
Checkout:workspace / /usr/share/tomcat6/.hudson/jobs/ECF/workspace - hudson.remoting.LocalChannel@176150c
Fetching changes from the remote Git repository
Fetching upstream changes from ssh://git@192.168.0.10/git/germantech.git
ERROR: Problem fetching from servidor / servidor - could be unavailable. Continuing anyway
ERROR:  (Underlying report) : Error performing command: git fetch -t ssh://git@192.168.0.10/git/germantech.git +refs/heads/*:refs/remotes/origin/*
Command "git fetch -t ssh://git@192.168.0.10/git/germantech.git +refs/heads/*:refs/remotes/origin/*" returned status code 128: Host key verification failed.
fatal: The remote end hung up unexpectedly

ERROR: Could not fetch from any repository
FATAL: Could not fetch from any repository
hudson.plugins.git.GitException: Could not fetch from any repository

我在这里缺少什么?有什么想法吗?谢谢提前。

编辑

好的,解决了!
首先,我用我的Hudson用户登录(sudo su - -s /bin/bash tomcat6),然后删除了我的.ssh文件夹。
之后,我只需按照此链接进行操作,进行无密码ssh登录
现在,Hudson可以进行获取而无需指定密码。

2个回答

9
您需要在Hudson和Git服务器之间建立ssh连接。
您只需执行一次此操作。
步骤:
1. 使用Hudson用户登录到Hudson机器。
2. 创建ssh私钥和公钥:
`ssh-keygen -t dsa` 不要输入密码,现在在Hudson主目录的.ssh文件夹下有两个文件:id_dsa和id_dsa.pub。
3. 使用以下命令将密钥复制到您的repo:
`ssh-copy-id -i ~/.ssh/id_dsa.pub hudson@gitserver.machine.com`
4. 退出并验证您现在可以通过ssh连接而无需提供密码。
Hudson现在应该能够成功连接。

我已经登录到'tomcat6' (sudo su - -s /bin/bash tomcat6)用户,这是运行Hudson的用户。现在的错误是:https://gist.github.com/1633627。我仍然无法通过ssh登录。在'sudo su - -s /bin/bash tomcat6'之后,我尝试了'ssh 127.0.0.1',但仍然要求输入密码,不允许我登录。我错过了什么? - Luiz E.
Hudson在hudson用户下运行。 - German Attanasio
@GermanAttanasioRuiz 为什么我必须保持密码为空?它不能使用密码吗? - Asad Iqbal
每次连接时,您都需要编写密码短语。 - German Attanasio

2

我删除了tomcat6主目录下的.ssh文件夹(因为我使用hudson的war,所以hudson在此处以tomcat6用户运行),然后按照这篇教程操作,最终成功了。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接