Jenkins获取远程repo'origin'时出错

时间:2016-04-17 14:49:45

标签: .net git jenkins

我最近尝试集成jenkins,我正面临将代码本身从git拉入jenkins工作区。如果有人可以帮助我,请输入以下错误消息:

Started by user anonymous
Building in workspace C:\Program Files (x86)\Jenkins\jobs\sample Test App\workspace
 > C:\Program Files\Git\cmd\git.exe rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
 > C:\Program Files\Git\cmd\git.exe config remote.origin.url https://github.com/sample/windows-sample-client.git # timeout=10
Fetching upstream changes from https://github.com/sample/windows-sample-client.git
 > C:\Program Files\Git\cmd\git.exe --version # timeout=10
using .gitcredentials to set credentials
 > C:\Program Files\Git\cmd\git.exe config --local credential.username balraj-sample # timeout=10
 > C:\Program Files\Git\cmd\git.exe config --local credential.helper store --file=\"C:\Windows\TEMP\git6022918740990470673.credentials\" # timeout=10
 > C:\Program Files\Git\cmd\git.exe -c core.askpass=true fetch --tags --progress https://github.com/sample/windows-sample-client.git +refs/heads/*:refs/remotes/origin/*
ERROR: Timeout after 10 minutes
 > C:\Program Files\Git\cmd\git.exe config --local --remove-section credential # timeout=10
ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from https://github.com/sample/windows-sample-client.git
    at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:810)
    at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1066)
    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1097)
    at hudson.scm.SCM.checkout(SCM.java:485)
    at hudson.model.AbstractProject.checkout(AbstractProject.java:1269)
    at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:607)
    at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:529)
    at hudson.model.Run.execute(Run.java:1738)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:98)
    at hudson.model.Executor.run(Executor.java:410)
Caused by: hudson.plugins.git.GitException: Command "C:\Program Files\Git\cmd\git.exe -c core.askpass=true fetch --tags --progress https://github.com/sample/windows-sample-client.git +refs/heads/*:refs/remotes/origin/*" returned status code -1:
stdout: 
stderr: 
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1719)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1463)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:63)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:314)
    at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:808)
    ... 11 more
ERROR: null
Finished: FAILURE

为本地git添加SSH RSA密钥以访问我的存储库后,我在jenkin中收到以下错误:

Started by user anonymous
Building in workspace C:\Program Files (x86)\Jenkins\jobs\sample Test App\workspace
 > C:\Program Files\Git\cmd\git.exe rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
 > C:\Program Files\Git\cmd\git.exe config remote.origin.url git@github.com:sample/windows-sample-client.git # timeout=10
Fetching upstream changes from git@github.com:sample/windows-sample-client.git
 > C:\Program Files\Git\cmd\git.exe --version # timeout=10
 > C:\Program Files\Git\cmd\git.exe -c core.askpass=true fetch --tags --progress git@github.com:sample/windows-sample-client.git +refs/heads/*:refs/remotes/origin/*
ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from git@github.com:sample/windows-sample-client.git
        at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:810)
        at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1066)
        at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1097)
        at hudson.scm.SCM.checkout(SCM.java:485)
        at hudson.model.AbstractProject.checkout(AbstractProject.java:1269)
        at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:607)
        at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
        at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:529)
        at hudson.model.Run.execute(Run.java:1738)
        at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
        at hudson.model.ResourceController.execute(ResourceController.java:98)
        at hudson.model.Executor.run(Executor.java:410)
Caused by: hudson.plugins.git.GitException: Command "C:\Program Files\Git\cmd\git.exe -c core.askpass=true fetch --tags --progress git@github.com:sample/windows-sample-client.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout: 
stderr: Host key verification failed.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

        at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1719)
        at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1463)
        at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:63)
        at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:314)
        at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:808)
        ... 11 more
ERROR: null
Finished: FAILURE

我重新安装了git,并将jshkins的ssh私钥添加为全局凭证。之后我收到以下错误:

Building in workspace C:\Program Files (x86)\Jenkins\jobs\Gitsample\workspace
 > C:\Program Files\Git\cmd\git.exe rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
 > C:\Program Files\Git\cmd\git.exe config remote.origin.url git@github.com:sample/windows-sample-client.git # timeout=10
Fetching upstream changes from git@github.com:sample/windows-sample-client.git
 > C:\Program Files\Git\cmd\git.exe --version # timeout=10
using GIT_SSH to set credentials 
 > C:\Program Files\Git\cmd\git.exe -c core.askpass=true fetch --tags --progress git@github.com:sample/windows-sample-client.git +refs/heads/*:refs/remotes/origin/*
ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from git@github.com:sample/windows-sample-client.git
    at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:810)
    at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1066)
    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1097)
    at hudson.scm.SCM.checkout(SCM.java:485)
    at hudson.model.AbstractProject.checkout(AbstractProject.java:1269)
    at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:607)
    at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:529)
    at hudson.model.Run.execute(Run.java:1738)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:98)
    at hudson.model.Executor.run(Executor.java:410)
Caused by: hudson.plugins.git.GitException: Command "C:\Program Files\Git\cmd\git.exe -c core.askpass=true fetch --tags --progress git@github.com:sample/windows-sample-client.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout: 
stderr: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1719)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1463)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:63)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:314)
    at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:808)
    ... 11 more
ERROR: null

1 个答案:

答案 0 :(得分:0)

这是因为可能与Visual Studio之类的Microsoft产品一起安装的不兼容的git版本,你可以做什么:

尝试卸载 GIT Git Credential Manager for Windows ,然后再次安装GCM,这将安装git的propriate virsion,然后你就不会有这个问题了。