2012-12-28 40 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