【问题标题】:Build failing with error : cannot lock ref 'refs/remotes/origin/users/bill.roper/develop': is at b10165 but expected 5f构建失败并出现错误:无法锁定 ref 'refs/remotes/origin/users/bill.roper/develop':位于 b10165 但预期为 5f
【发布时间】:2019-09-30 00:33:30
【问题描述】:

Jenkins 构建失败,错误低于错误。请帮助修复它。

git config --get remote.origin.url # timeout=10 使用 GIT_ASKPASS 设置凭据 设置http代理:www-proxy.us.oracle.com:80 git fetch --tags --force --progress origin +refs/heads/:refs/remotes/origin/ # timeout=10 hudson.plugins.git.GitException:命令“git fetch --tags --force --progress origin +refs/heads/:refs/remotes/origin/”返回状态码 1: 标准输出: 标准错误:来自https://alm.oraclecorp.com/epm/s/epm_pbcs_15318/scm/strategicmodeling * [新分支] users/aaron.weber/mydevelop -> origin/users/aaron.weber/mydevelop * [新分支] users/abhilash.mund/mydevelop -> origin/users/abhilash.mund/mydevelop 错误:无法锁定 ref 'refs/remotes/origin/users/bill.roper/develop':位于 cf9f03f3568e8e7b60918a8fc6e39a3d8d265c42 但预期为 5baac24b91a27586748ad1afb6e8142ed7bf568f ! 5baac24b9..02c773ae0 users/bill.roper/develop -> origin/users/bill.roper/develop(无法更新本地参考) * [新分支] users/dave.farr/develop -> origin/users/dave.farr/develop

我们开始删除分支并使用不同的名称重新创建它们,并且只使用小字符。这是可行的,但是当分支机构的所有者无法执行此操作时,我们会遇到问题。不同的用户远程重命名分支是否会导致任何问题,例如丢失分支所有者的未提交更改。或者如果有其他解决方案请告诉我

我们希望 jenkins 构建成功

【问题讨论】:

    标签: git jenkins github gitlab


    【解决方案1】:

    this answer 中所述,请先尝试您的 Jenkins 工作:

    git gc --prune=now
    git remote prune origin
    

    第二个命令将删除命名空间源中对远程(已删除)分支的引用。

    类似:

    stage('Checkout') {
        // Update our shared reference repo for all branches/PRs
        dir('..') {
            if (fileExists('yourRepo.git')) {
                dir('yourRepo.git') {
                sh 'git --prune=now'
                sh 'git remote prune origin' // update the clone
                sh 'git prune' // prune to avoid "warning: There are too many unreachable loose objects"
                }
            } else {
                sh 'git clone --mirror /url/to/yourRepo.git' // create a mirror
                    }
            }
        }
    

    【讨论】:

    • 更有针对性的方法:git update-ref -d refs/remotes/origin/users/bill.roper/develop/
    • 我收到错误,因为 $ git update-ref -d refs/remotes/origin/users/bill.roper/develop/ 错误:拒绝使用错误名称更新 ref 'refs/remotes/origin/用户/bill.roper/develop/'
    • @jon 还有其他命令吗?它们是否足以让您的问题消失?
    • 您能否告诉我在此 jenkins 管道脚本中添加其他命令的位置:-- env.EPBCSMODULES_BRANCH_NAME="develop" def downloadLocationForEPBCS="epmpbcs-release-local/Platform/EPBCSModules/${ EPBCSMODULES_BRANCH_NAME}/latest" if ("${BRANCH_NAME}"=="develop") { properties( [ pipelineTriggers([cron('H 4 * * 2,4')]), ] ) } else { properties( [ pipelineTriggers ([cron('')]), ] ) } stage('Checkout') { scmVars = checkout scm }
    • @jon Sure:我已经编辑了答案以添加一个示例,仿照github.com/appcelerator/titanium_mobile/blob/…
    【解决方案2】:

    在终端中

    “cd /.git/refs/remotes/origin”

    执行“ls”,你会看到一些分支和HEAD

    删除你认为有问题的分支

    “rm 分支名称”

    如果不起作用,删除所有分支/HEAD

    你可能想拉

    【讨论】:

      猜你喜欢
      • 2021-02-05
      • 2021-03-29
      • 2022-12-01
      • 2018-01-30
      • 1970-01-01
      • 2017-12-07
      • 2013-09-02
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多