【问题标题】:GitLab CI build fails with error some local refs could not be updatedGitLab CI 构建失败并出现错误,一些本地引用无法更新
【发布时间】:2016-11-16 00:29:41
【问题描述】:

我使用以下命令重命名了多个远程分支:

git push <remote> <remote>/<old_name>:refs/heads/<new_name> :<old_name>

现在 GitLab CI 构建失败并显示以下错误消息:

gitlab-ci-multi-runner 1.0.4 (014aa8c)
Using Docker executor with image node:4.4.5 ...
Pulling docker image node:4.4.5 ...

Running on runner-705e3a48-project-15-concurrent-0 via d929b1291ac5...
Fetching changes...
HEAD is now at d4a38a6 DEV-3609 merging from as-37
error: cannot lock ref 'refs/remotes/origin/DEV-3425/feature(my-feature)tma': 'refs/remotes/origin/DEV-3425' exists; cannot create 'refs/remotes/origin/DEV-3425/feature(my-feature)tma'
From https://gitlab.myhost.com/my-company/my-project
 ! [new branch]      DEV-3425/feature(my-feature)tma -> origin/DEV-3425/feature(my-feature)tma  (unable to update local ref)
   5be484d..91bab37  v1.0(my-release-branch) -> origin/v1.0(my-release-branch)
error: some local refs could not be updated; try running
 'git remote prune origin' to remove any old, conflicting branches

ERROR: Build failed with: exit code 1

我已经运行了命令git remote prune origin,但没有帮助。

我可以做些什么来解决这个问题?

【问题讨论】:

  • 在 GitLab 的项目设置中,尝试设置“git clone”而不是“git fetch”。
  • @cascaval 好主意,它奏效了。奇怪的是,通过 .gitlab_ci.yml 将 git strategy 设置为 clone 不起作用。你知道为什么吗?无论如何,如果您发表评论作为答案,我会接受。
  • 为什么git策略不起作用?我不知道。它被列为一种实验。你在使用 GitLab 8.9 吗? (我知道,愚蠢的问题,但我碰巧在我的 GitLab 安装落后时尝试使用最近引入的东西)
  • 至于想出一个答案——那句话不值得作为答案。 :-) 顺便说一句,您可能还可以清理运行程序获取代码的构建文件夹。
  • @cascaval 我们使用的是 GitLab 社区版 8.6.4,也许这个版本真的落后于文档。我仍然认为这句话属于答案,因为它帮助了我,也可能帮助其他人。另外,您将获得一些互联网积分:]

标签: git gitlab gitlab-ci


【解决方案1】:

在 GitLab 的项目设置中,尝试设置“git clone”而不是“git fetch”。

我相信this comment 应该是公认的答案!

【讨论】:

    猜你喜欢
    • 2021-07-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-07-24
    • 2019-04-07
    • 1970-01-01
    • 2018-10-02
    • 1970-01-01
    相关资源
    最近更新 更多