borisdiakur
borisdiakur

Reputation: 12122

GitLab CI build fails with error some local refs could not be updated

I have renamed multiple remote branches using the following command:

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

Now the GitLab CI builds fail with the following error message:

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

I have already run the command git remote prune origin but it didn’t help.

What can I do to fix the issue?

Upvotes: 5

Views: 3324

Answers (1)

GabrielOshiro
GabrielOshiro

Reputation: 8322

In the GitLab's project settings, try to set "git clone" instead of "git fetch".

I believe that this comment should be the accepted answer!

Upvotes: 3

Related Questions