3

我所拥有的是:

a.b.c.d:/x/www/app

现在,如果我发出命令:

git clone abcd:/x/www/app /home/user

系统提示我输入我的 LDAP 密码,然后成功克隆应用程序。

但是当我对 Jenkins 使用同样的方法时,Jenkins 给出了错误:

无法连接到存储库:命令“/usr/bin/git ls-remote -h abcd:/x/www/app HEAD”返回状态码 128:stdout:stderr:主机密钥验证失败。致命:远端意外挂断

我正在使用 Jenkins 版本 1.500 和 Git 插件版本 1.1.26

错误:

Using strategy: Default
Cloning the remote Git repository
Cloning repository git:///$GIT_USER@a.b.c.d:/var/www/app
git --version
git version 1.7.9.5
ERROR: Error cloning remote repo 'origin' : Could not clone git:///$GIT_USER@a.b.c.d:/var/www/app
hudson.plugins.git.GitException: Could not clone git:///$GIT_USER@a.b.c.d:/var/www/app
    at hudson.plugins.git.GitAPI.clone(GitAPI.java:273)
    at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:1044)
    at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:986)
    at hudson.FilePath$FileCallableWrapper.call(FilePath.java:2348)
    at hudson.remoting.UserRequest.perform(UserRequest.java:118)
    at hudson.remoting.UserRequest.perform(UserRequest.java:48)
    at hudson.remoting.Request$2.run(Request.java:326)
    at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
    at java.util.concurrent.FutureTask.run(FutureTask.java:166)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:679)
Caused by: hudson.plugins.git.GitException: Command "/usr/bin/git clone --progress -o origin git:///$GIT_USER@a.b.c.d:/var/www/app /home/user/workspace/app" returned status code 128:
stdout: Cloning into '/home/user/workspace/app'...

stderr: fatal: unable to connect to :
: Name or service not known


    at hudson.plugins.git.GitAPI.launchCommandIn(GitAPI.java:897)
    at hudson.plugins.git.GitAPI.access$000(GitAPI.java:42)
    at hudson.plugins.git.GitAPI$1.invoke(GitAPI.java:269)
    at hudson.plugins.git.GitAPI$1.invoke(GitAPI.java:248)
    at hudson.FilePath.act(FilePath.java:865)
    at hudson.FilePath.act(FilePath.java:838)
    at hudson.plugins.git.GitAPI.clone(GitAPI.java:248)
    ... 12 more
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:1056)
    at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:986)
    at hudson.FilePath$FileCallableWrapper.call(FilePath.java:2348)
    at hudson.remoting.UserRequest.perform(UserRequest.java:118)
    at hudson.remoting.UserRequest.perform(UserRequest.java:48)
    at hudson.remoting.Request$2.run(Request.java:326)
    at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
    at java.util.concurrent.FutureTask.run(FutureTask.java:166)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:679)
4

2 回答 2

1

git:// 协议不使用身份验证。

如果要使用该协议,则需要在服务器端存储库上启动 git-daemon。

如果您想要使用基于用户名/密钥的身份验证的 ssh,请改用 ssh://$USER/path。

于 2013-02-12T18:54:46.380 回答
0

你可以使用 git+ssh://mylogin@mygithost:/var/git/race.git

如果您使用 ssh,您可以在 jenkins 用户主目录中编辑或创建:~/.ssh/config 以存储 ssh 密钥

Host mygithost
        HostName 192.168.130.43
        User mylogin
        IdentityFile ~/.ssh/.id_rsa

使用 ssh 密钥,您可以在 git 服务器 (~/.ssh/authorized_keys) 上添加公钥以防止密码验证...

于 2013-02-12T20:37:15.703 回答