git - Jenkins 管道在远程源提取期间失败(无法更新本地引用)

如何让 jenkins git scm 集成在获取 master 之前运行修剪?

问题

在节点上运行的作业的主节点上,Jenkins 管道作业在工作区提取期间无法启动。如果我们运行 git remote prune origin 问题就解决了。 Master 需要维护一个工作区,以便它加载 jenkins 文件、确定要使用的节点以及来回序列化命令。

工作区在某种程度上因引用冲突而损坏,我想让 jenkins 自动修剪以避免这个潜在的问题。

ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to
fetch from git@github.com

    error: cannot lock ref 'refs/remotes/origin/user/fix/master/TICKET': 
 'refs/remotes/origin/user/fix/master' exists; 
 cannot create 'refs/remotes/origin/user/fix/master/TICKET'

 ! [new branch]          user/fix/master/TICKET -> origin/user/fix/master/TICKET  
 (unable to update local ref)

如何让 jenkins 在获取之前(或许之后)在主工作区中自动修剪?

最佳答案

要避免在共享库或任何 git 克隆上出现此问题,您可以添加一些修剪选项。鉴于我们的共享库可以在大约 2 秒内从无到有克隆,我们选择添加 Wipe out repository & force clone 选项。

https://stackoverflow.com/questions/54536226/

相关文章:

c# - try-catch 在 IL 中如何工作?

sql - 状态 : Failure -Test failed: IO Error: An exis

python - API 网关 - 自定义授权方无法正常工作

c# - .Net 核心 2.2 未将 302 的状态代码更新为 401。OnRedirectToL

python - GAE : Why does GAE perform worse than nor

python-3.x - 使用Qtbot在菜单栏和工具栏中模拟鼠标点击

apache-kafka - kafka有内置的流量控制机制吗

model-view-controller - ErroCS1929 'IHtmlHelper

graphql - Shopify graphql 客户创建

unix - 还有其他像 VIM Tutor 这样的教程吗?