错误:获取远程仓库'origin'时出错,返回状态代码-1:

时间:2016-05-24 06:52:31

标签: git jenkins

我在Windows上运行Jenkins,当我尝试通过jenkins构建项目时,会发生以下错误:

git.exe -c core.askpass=true fetch --tags --progress <url>Assist-Ops.git +refs/heads/*:refs/remotes/origin/*
ERROR: Timeout after 10 minutes
 > git.exe config --local --remove-section credential # timeout=10
ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from <url>
    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 "git.exe -c core.askpass=true fetch --tags --progress <URL>/Assist-Ops.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)   

更改密码后开始收到此错误 我创建了新的SSH密钥并将其添加到github存储库。我能够克隆存储库并通过命令行构建。

    mvn clean install

2 个答案:

答案 0 :(得分:1)

尝试使用git config --global --unset credential.helper禁用git凭据缓存。如果已在系统配置文件

中设置,则可能还需要执行git config --system --unset credential.helper

答案 1 :(得分:0)

如果您阅读the documentation,您会发现core.askpass不是布尔值,而是用于询问密码的外部程序。因此,将此变量设置为true不是正确的做法。