Jenkns无法从Github获取

时间:2018-10-17 15:54:50

标签: jenkins github

我正在为jenkins使用jenkins / jenkins:lts Docker映像。我已经在Docker容器上配置了SSH密钥,并将公用密钥添加到了我的Github帐户。我可以从Docker容器克隆我的Github存储库。

我的Jenkins作业配置为使用Git;我的分支是主人。我已经在Jenkins中配置了我的凭据,但是当我运行作业时,它挂起并出现以下错误。

     Started by user Administrator
        Building in workspace /var/jenkins_home/workspace/test
        Cloning the remote Git repository
        Cloning repository git@github.com:xxx/stateAnsible.git
         > git init /var/jenkins_home/workspace/test # timeout=10
        Fetching upstream changes from git@github.com:xxx/stateAnsible.git
         > git --version # timeout=10
        using GIT_SSH to set credentials 
         > git fetch --tags --progress git@github.com:xxx/stateAnsible.git +refs/heads/*:refs/remotes/origin/*
hudson.plugins.git.GitException: Command "git fetch --tags --progress git@github.com:xxx/stateAnsible.git +refs/heads/*:refs/remotes/origin/*" returned status code 143:
stdout: 
stderr: 
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2016)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1735)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:72)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:420)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:629)
    at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1146)
    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1186)
    at hudson.scm.SCM.checkout(SCM.java:504)
    at hudson.model.AbstractProject.checkout(AbstractProject.java:1208)
    at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:574)
    at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:499)
    at hudson.model.Run.execute(Run.java:1819)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:97)
    at hudson.model.Executor.run(Executor.java:429)
ERROR: Error cloning remote repo 'origin'
Finished: FAILURE

1 个答案:

答案 0 :(得分:0)

解决方案是将私钥复制并粘贴到Jenkins中Jenkins用户的凭据中。我回想起过去它会使用默认目录中的键,而不必这样做吗?奇。