gitolite - 与Jenkins的git - 无法访问

时间:2012-12-28 06:09:23

标签: git gitolite jenkins-plugins

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

我正在尝试使用git项目(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”..

任何想法都表示赞赏。感谢

1 个答案:

答案 0 :(得分:0)

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

  • Jenkins确实(在执行作业时)定义了与您的shell会话相同的HOME
  • $HOME/.ssh存在并包含config文件,id_rsaid_rsa.pub(私钥和公钥):测试{{1}中是否存在这些文件Jenkins的工作用于测试目的。
  • Siddharth引用in the comments您的私钥可能带有you need to add to an ssh-agent的密码。 首先尝试使用无密码密钥,然后注册到gitolite。

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

helloworld

使用配置文件:

 .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 ,这不应成为问题。