Hudson SSH密钥权限被拒绝

时间:2012-10-30 09:17:59

标签: git ssh hudson centos

我通过在/ etc / sysconfig / hudson中将配置更改为“HUDSON_USER = myuser”来将Hudson服务(守护程序)作为自定义用户运行。我已经确认SSH服务器添加了RSA密钥,该密钥存在于/home/myuser/.ssh中。

当我通过以“myuser”身份登录系统来运行Hudson时,它可以运行并可以从git存储库中获取代码。

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

当我运行Hudson守护程序然后在运行构建时,我无法从git存储库获取源代码并显示以下具有权限拒绝错误的日志。

Started by user anonymous
Checkout:workspace / /home/myuser/.hudson/jobs/test/workspace - hudson.remoting.LocalChannel@6083969e
Using strategy: Default
Last Built Revision: Revision a0d97d4d7bf5ee08124f76e5eb98bab354754cad (origin/master)
Checkout:workspace / /home/myuser/.hudson/jobs/test/workspace - hudson.remoting.LocalChannel@6083969e
Fetching changes from the remote Git repository
Fetching upstream changes from ssh://myuser@10.10.10.10: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://myuser@10.10.10.10:20/home/git-repos/test-proj.git +refs/heads/*:refs/remotes/origin/*
Command "/usr/bin/git fetch -t ssh://myuser@10.10.10.10: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)

1 个答案:

答案 0 :(得分:2)

我已将RSA密钥更改为密码更少并添加到Github服务器。它解决了在运行hudson作为init.d服务时从Git获取源代码的问题。

此外,这是我为Github添加密钥的方式,对于任何正在搜索“{3}}

的人”