2012-10-30 297 views
2

我正在通過在/ etc/sysconfig/hudson中將配置更改爲「HUDSON_USER = myuser」作爲自定義用戶運行Hudson服務(守護進程)。我已經確認SSH服務器已添加RSA密鑰,該密鑰存在於/home/myuser/.ssh中。Hudson SSH密鑰權限被拒絕

當我通過以「myuser」身份登錄系統運行Hudson時,它可以工作並可以從git存儲庫中獲取代碼。

nohup java -jar hudson.war --httpPort=8081 > /home/myuser/hudson.out 2>&1 & 

當我運行哈德森守護進程,然後在運行建立我無法提取從git倉庫,並顯示以下日誌與權限被拒絕的錯誤來源。

Started by user anonymous 
Checkout:workspace//home/myuser/.hudson/jobs/test/workspace - [email protected] 
Using strategy: Default 
Last Built Revision: Revision a0d97d4d7bf5ee08124f76e5eb98bab354754cad (origin/master) 
Checkout:workspace//home/myuser/.hudson/jobs/test/workspace - [email protected] 
Fetching changes from the remote Git repository 
Fetching upstream changes from ssh://[email protected]:20/home/git-repos/test-proj.git 
ERROR: Problem fetching from origin/origin - could be unavailable. Continuing anyway 
ha:AAAAWB+LCAAAAAAAAABb85aBtbiIQSmjNKU4P08vOT+vOD8nVc8DzHWtSE4tKMnMz/PLL0ldFVf2c+b/lb5MDAwVRQxSaBqcITRIIQMEMIIUFgAAckCEiWAAAAA=ERROR: (Underlying report) : Error performing command: /usr/bin/git fetch -t ssh://[email protected]:20/home/git-repos/test-proj.git +refs/heads/*:refs/remotes/origin/* 
Command "/usr/bin/git fetch -t ssh://[email protected]:20/home/git-repos/test-proj.git +refs/heads/*:refs/remotes/origin/*" returned status code 128: Permission denied (publickey,gssapi-keyex,gssapi-with-mic). 
fatal: The remote end hung up unexpectedly 

ha:AAAAWB+LCAAAAAAAAABb85aBtbiIQSmjNKU4P08vOT+vOD8nVc8DzHWtSE4tKMnMz/PLL0ldFVf2c+b/lb5MDAwVRQxSaBqcITRIIQMEMIIUFgAAckCEiWAAAAA=ERROR: Could not fetch from any repository 
ha:AAAAWB+LCAAAAAAAAABb85aBtbiIQSmjNKU4P08vOT+vOD8nVc8DzHWtSE4tKMnMz/PLL0ldFVf2c+b/lb5MDAwVRQxSaBqcITRIIQMEMIIUFgAAckCEiWAAAAA=FATAL: Could not fetch from any repository 
ha:AAAAWB+LCAAAAAAAAABb85aBtbiIQSmjNKU4P08vOT+vOD8nVc8DzHWtSE4tKMnMz/PLL0ldFVf2c+b/lb5MDAwVRQxSaBqcITRIIQMEMIIUFgAAckCEiWAAAAA=hudson.plugins.git.GitException: Could not fetch from any repository 
     at hudson.plugins.git.GitSCM$3.invoke(GitSCM.java:887) 
     at hudson.plugins.git.GitSCM$3.invoke(GitSCM.java:845) 
     at hudson.FilePath.act(FilePath.java:758) 
     at hudson.FilePath.act(FilePath.java:740) 
     at hudson.plugins.git.GitSCM.gerRevisionToBuild(GitSCM.java:845) 
     at hudson.plugins.git.GitSCM.checkout(GitSCM.java:622) 
     at hudson.model.AbstractProject.checkout(AbstractProject.java:1483) 
     at hudson.model.AbstractBuild$AbstractRunner.checkout(AbstractBuild.java:507) 
     at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:424) 
     at hudson.model.Run.run(Run.java:1366) 
     at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46) 
     at hudson.model.ResourceController.execute(ResourceController.java:88) 
     at hudson.model.Executor.run(Executor.java:145) 
+0

忘了提多說一點,運行哈德森,因爲它的工作原理java命令的時候,問我密碼的RSA密鑰。在使用Hudson作爲服務時,我如何傳遞類似的密碼。 –

+0

我已經嘗試過下面的建議,但沒有幫助http://stackoverflow.com/questions/2447878/how-to-configure-hudson-and-git-plugin-with-an-ssh-key http://stackoverflow.com/questions/6515039/jenkins-git-permission-denied-publickey http://stackoverflow.com/questions/10224574/jenkins-hudson-cant-connect-to-github-repo –

+1

這是一些Linux發行版Hudson包嗎?這將告訴我們你在'/ etc/sysconfig/hudson'中設置什麼以及它是如何作爲守護進程運行的。 – rakslice

回答

2

我已將RSA密鑰更改爲密碼更少並添加到Github服務器。它解決了在運行hudson作爲init.d服務時從Git獲取源代碼的問題。

此外,我這是怎麼添加關鍵Github上,任何人誰正在尋找如何https://help.github.com/articles/generating-ssh-keys