【问题标题】:Hudson SSH key permission deniedHudson SSH 密钥权限被拒绝
【发布时间】:2012-10-19 14:35:55
【问题描述】:

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

当我以“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)

【问题讨论】:

标签: git ssh hudson centos


【解决方案1】:

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

此外,这是我向 Github 添加密钥的方式,供任何正在搜索 HOW TO https://help.github.com/articles/generating-ssh-keys 的人使用

【讨论】:

    猜你喜欢
    • 2016-10-15
    • 1970-01-01
    • 2018-04-12
    • 1970-01-01
    • 2019-11-24
    • 2014-11-08
    • 2019-03-11
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多