1

我将 Jenkins 安装为守护进程(在 mac os x 10.7 上),并且我使用 ' real-os-user' 作为 JENKINS USER。

我正在尝试使用 git project ( helloworld) 配置作业,但出现以下错误:

    Failed to connect to repository : Command "git ls-remote -h git-server-name:helloworld HEAD" returned status code 128:
    stdout: 
    stderr: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,keyboard-interactive). 
    fatal: The remote end hung up unexpectedly

如果我git ls-remote -h git-server-name:helloworld HEAD在终端窗口中运行“”,它工作正常。

我打印了 ' env' 变量,我看到 Jenkins 正在使用 ' real-os-user'..

任何想法表示赞赏。谢谢

4

1 回答 1

0

git-server-name:helloworld是一个 ssh 地址,因此您需要确保:

  • Jenkins 确实定义了(在执行作业时)与HOME您的 shell 会话相同
  • $HOME/.ssh存在并包含该config文件,id_rsa并且id_rsa.pub(私钥和公钥):测试这些文件是否存在于您的helloworldJenkins 作业中以用于测试目的。
  • Siddharth在评论中引用了这样一个事实,即您的私钥可能具有您需要添加到 ssh-agent的密码。
    首先尝试使用您将注册到 gitolite 的无密码密钥。

请注意,如果您确实在用户名之后重命名了您的公钥和私钥(因为 gitolite 期望其公钥以用户 id 命名),您的配置文件需要引用该新名称:

 .ssh
    real-os-user
    real-os-user.pub
    config

使用配置文件:

Host git-server-name
    HostName git-server-name
    IdentityFile ~/.ssh/real-os-user
    User git # or whatever account is managing gitolite on the server side

考虑到您的git ls-remote,这应该不是问题。

于 2012-12-28T08:39:59.723 回答