jenkins 构建失败,git:stderr:权限被拒绝(公钥)

jenkins 构建失败,git:stderr:权限被拒绝(公钥)

我已将 jenkins 用户的公钥添加到我的 github 帐户 ssh 密钥区域。它还显示为已使用:

Added 7 minutes ago — Last used on August 04, 2014



Started by user Aaron Lote
Building in workspace /var/lib/jenkins/workspace/aaronlote.com
Checkout:aaronlote.com / /var/lib/jenkins/workspace/aaronlote.com - hudson.remoting.LocalChannel@168d410f
Using strategy: Default
Cloning the remote Git repository
Cloning repository github.com:azz0r/AaronLoteCom-BackboneJS.git
git --version
git version 1.7.9.5
ERROR: Error cloning remote repo 'origin' : Could not clone github.com:azz0r/AaronLoteCom-BackboneJS.git
hudson.plugins.git.GitException: Could not clone github.com:azz0r/AaronLoteCom-BackboneJS.git
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.clone(CliGitAPIImpl.java:218)
    at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:1002)
    at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:941)
    at hudson.FilePath.act(FilePath.java:922)
    at hudson.FilePath.act(FilePath.java:895)
    at hudson.plugins.git.GitSCM.determineRevisionToBuild(GitSCM.java:941)
    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1113)
    at hudson.model.AbstractProject.checkout(AbstractProject.java:1254)
    at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:624)
    at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:530)
    at hudson.model.Run.execute(Run.java:1732)
    at hudson.matrix.MatrixBuild.run(MatrixBuild.java:306)
    at hudson.model.ResourceController.execute(ResourceController.java:88)
    at hudson.model.Executor.run(Executor.java:234)
    at hudson.model.OneOffExecutor.run(OneOffExecutor.java:43)
Caused by: hudson.plugins.git.GitException: Command "/usr/bin/git clone --progress -o origin github.com:azz0r/AaronLoteCom-BackboneJS.git /var/lib/jenkins/workspace/aaronlote.com" returned status code 128:
stdout: Cloning into '/var/lib/jenkins/workspace/aaronlote.com'...

stderr: Permission denied (publickey).
fatal: The remote end hung up unexpectedly

    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:772)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.clone(CliGitAPIImpl.java:216)
    ... 15 more
Trying next repository
ERROR: Could not clone repository
FATAL: Could not clone
hudson.plugins.git.GitException: Could not clone
    at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:1014)
    at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:941)
    at hudson.FilePath.act(FilePath.java:922)
    at hudson.FilePath.act(FilePath.java:895)
    at hudson.plugins.git.GitSCM.determineRevisionToBuild(GitSCM.java:941)
    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1113)
    at hudson.model.AbstractProject.checkout(AbstractProject.java:1254)
    at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:624)
    at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:530)
    at hudson.model.Run.execute(Run.java:1732)
    at hudson.matrix.MatrixBuild.run(MatrixBuild.java:306)
    at hudson.model.ResourceController.execute(ResourceController.java:88)
    at hudson.model.Executor.run(Executor.java:234)
    at hudson.model.OneOffExecutor.run(OneOffExecutor.java:43)

但是,如果我这样做,那就没问题了:

root@ip-172-31-16-45:/home/ubuntu# sudo su jenkins
jenkins@ip-172-31-16-45:/home/ubuntu$ git ls-remote -h [email protected]:azz0r/AaronLoteCom-BackboneJS.git HEAD
jenkins@ip-172-31-16-45:/home/ubuntu$

相关内容