Jenkins - 获取远程仓库 'origin' 时出错

标签 jenkins github executable pull-request

我正在尝试在 Jenkins 节点从站上设置 Jenkins Github Pull-Request Builder,但是当我将 refspec 设置为 +refs/pull/*:refs/remotes/origin/pr/*.

构建失败,说我无法获取 repo,当 refspec 删除时,将其他所有内容保持在原位(Github pull request builder 勾选并配置,分支说明符设置为 ${sha1} 默认为 master 使用字符串参数,构建没问题。

这是错误轨迹:

git -c core.askpass=true fetch --tags --progress git@github.blah.company.com:organization/repository.git
+refs/pull/*:refs/remotes/origin/pr/*
ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from git@github.blah.company.com:organization/repository.git
    at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:763)
    at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1012)
    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1043)
    at hudson.scm.SCM.checkout(SCM.java:485)
    at hudson.model.AbstractProject.checkout(AbstractProject.java:1277)
    at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:610)
    at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:532)
    at hudson.model.Run.execute(Run.java:1741)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:98)
    at hudson.model.Executor.run(Executor.java:408)
Caused by: hudson.plugins.git.GitException: Command "git -c core.askpass=true fetch --tags --progress git@github.blah.company.com:organization/repository.git +refs/pull/*:refs/remotes/origin/pr/*" returned status code 1:

如有任何帮助,我们将不胜感激。

最佳答案

在我的例子中,这是因为我从 SVN 切换到了 git。所以我在 svn 上有一份现有的 Jenkins 工作。在这项工作中,我只是将源 source-code-management 更改为 git。由于这种变化,我有一个现有的工作区,默认情况下,在这种情况下,git 客户端只调用 fetch 而不是按要求调用 git clone

要修复它,您必须将 source-code-management 下的 Additional Behaviours 设置为 Wipe out repository & force clone

另见 jenkins migration from svn to git

关于Jenkins - 获取远程仓库 'origin' 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35445619/

相关文章:

android - 在 linux centos 平台上使用 Jenkins 和 Gradle 构建 Android 应用程序时出错

node.js - 使用 Jenkins、selenium-grid 和 Protractor 进行 e2e 测试

git - 在 Julia 中提交包时出错

git - git-lfs 中的多个文件版本

.net - 当 Windows 能够找到它时,如何找到 Mercurial 可执行文件的完整路径?

用于 i386 和 x86_64 的 Linux 单一二进制文件

jenkins - 为什么我的Gradle Jenkins插件尝试在任务执行前通过命令行开关

git - 目录在 github 上显示为灰色文件夹,但未跟踪其内容。为什么?

java - Java 程序停止时停止外部程序

jenkins - 如果经过验证和批准,则自动提交评论