DDiVita
DDiVita

Reputation: 4265

GIT: [Rejected] (would clobber existing tag) Error

back story: We are using GitVersion during our build process to rename build with version numbers. We are also following the GitFlow process. We had a hotfix/2.9.1 branch that may have had another branch merged into it, thus causing GitVersion to go from 2.9.1 to 2.9.2. To fix this, we tagged the hotfix/2.9.1 branch with the tag 2.9.1. During this time work was being done on the hotfix branch. During the release we deleted the tag, merged hotfix/2.9.1 into master, then tagged master with 2.9.1. We then back-merged master into develop and our release branches.

We are now seeing issues in our builds:

enter image description here

I found this regarding tags and I am not sure if this would apply. I've tried deleting the tag locally as suggested here, I tried doing a git fetch --tags and pushing. This seems to only be happening on our build server (Azure).

Forgot to mention: If I delete the tag in Azure and re-queue a failed build everything works as expected.

Upvotes: 5

Views: 7760

Answers (2)

zhuziyi
zhuziyi

Reputation: 865

Reason may be that you delete the original one tag, and created a same name again.

The solution:

git fetch --tags -f

Forced to refresh the local tag

From here

Upvotes: 1

jessehouwing
jessehouwing

Reputation: 114857

Queue the build once with the Clean setting turned to Sources Directory, that will clear the local repository on the agent and perform a clean clone.

enter image description here

If you have multiple agents, you may have to do this until all agents have cleared out their workspace folder this way. See:

Upvotes: 0

Related Questions