2012-12-28 27 views
1

我安装了Jenkins作为守护进程(在mac os x 10.7上),我使用'real-os-user'作为JENKINS USER。gitolite - 与詹金斯混帐 - 无法访问

我想配置使用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' ..

任何想法赞赏。由于

+0

看看这是否解决您的问题http://stackoverflow.com/questions/14064502/git-push-gives-permission-denied-publickey-fatal-the-remote-end-hung-up-unex – Siddharth

回答

0

git-server-name:helloworld是一个ssh地址,所以你需要确保:

  • 詹金斯没有定义(在执行任务时)相同HOME比你的shell会话
  • $HOME/.ssh存在,并且包含config文件,id_rsaid_rsa.pub(私钥和公钥):测试您的helloworld Jenkins作业是否存在测试目的。
  • Siddharth参考in the comments事实上,您的私钥可能有一个密码you need to add to an ssh-agent
    首先尝试使用您将注册到gitolite的密码短语密钥。

请注意,如果你没有用户名后重命名你的公钥和私钥(如gitolite预计User 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,这不应该是一个问题。

+0

谢谢你您的反馈。 – Madhu

+0

谢谢VonC的反馈意见。 1)我打印了'env'变量。我看到JENKINS_HOME和HOME变量。 HOME指向真实用户主目录,它有.ssh文件夹,并且我将.ssh文件夹复制到了JENKINS_HOME,并尝试过但没有运气。 .ssh文件夹具有config文件夹,.pub和私钥以及known_hosts文件。 2)让我尝试使用无密码密钥。我完全忘了它。 3)我没有重命名用git服务器进行身份验证的real-os-user,所以这不是问题,正如你所说的。 – Madhu

+0

密码短语密钥选项正常工作。谢谢你VonC。 – Madhu