GitVersion: [Bug] ref '.....' doesn't match the destination

Describe the bug Hi, I’m using GitVersion 6.0.0-beta2 with Jenkins with Multibranch pipeline. I’m using the standard configuration (I haven’t GitVersion.yaml) When I tag a commit and build it, GitVersion throw an error like this:

INFO [04/07/23 13:04:13:94] Applicable build agent found: 'Jenkins'.
INFO [04/07/23 13:04:14:09] Working directory: /var/lib/jenkins/workspace/4Retail_Dinamo.Extensions_v1.7.1
INFO [04/07/23 13:04:14:09] Project root is: /var/lib/jenkins/workspace/4Retail_Dinamo.Extensions_v1.7.1/
INFO [04/07/23 13:04:14:09] DotGit directory is: /var/lib/jenkins/workspace/4Retail_Dinamo.Extensions_v1.7.1/.git
INFO [04/07/23 13:04:14:10] Branch from build environment: v1.7.1
INFO [04/07/23 13:04:14:11] Begin: Normalizing git directory for branch 'v1.7.1'
  INFO [04/07/23 13:04:14:16] One remote found (origin -> 'http://gitea.dinamoretail.lan/Var4Retail/Dinamo.Extensions.git').
  INFO [04/07/23 13:04:14:16] Skipping fetching, if GitVersion does not calculate your version as expected you might need to allow fetching or use dynamic repositories
  INFO [04/07/23 13:04:14:17] Updating local branch v1.7.1 to match ref v1.7.1
  INFO [04/07/23 13:04:14:22] Skipping update of 'refs/remotes/origin/HashRefactorECrypting' as it already matches the remote ref.
  INFO [04/07/23 13:04:14:22] Skipping update of 'refs/remotes/origin/main' as it already matches the remote ref.
  INFO [04/07/23 13:04:14:22] Creating local branch from remote tracking 'refs/remotes/origin/staging'.
  INFO [04/07/23 13:04:14:24] End: Normalizing git directory for branch 'v1.7.1' (Took: 130.16ms)
  ERROR [04/07/23 13:04:14:26] An unexpected error occurred:
**LibGit2Sharp.LibGit2SharpException: ref 'refs/remotes/origin/staging' doesn't match the destination**

If I rerun the build the error change based of the name of all branch I have in the repository. Like this: LibGit2Sharp.LibGit2SharpException: ref ‘refs/remotes/origin/main’ doesn’t match the destination LibGit2Sharp.LibGit2SharpException: ref ‘refs/remotes/origin/staging’ doesn’t match the destination LibGit2Sharp.LibGit2SharpException: ref ‘refs/remotes/origin/features-1’ doesn’t match the destination

After last branch the build works as expected:

+ dotnet-gitversion /updateprojectfiles buildserver
{
  "AssemblySemFileVer": "1.7.1.0",
  "AssemblySemVer": "1.7.1.0",
  "BranchName": "v1.7.1",
  "BuildMetaData": null,
  "CommitDate": "2023-04-07",
  "CommitsSinceVersionSource": 0,
  "EscapedBranchName": "v1-7-1",
  "FullBuildMetaData": "Branch.v1.7.1.Sha.434206b3d7989e7106c234e1a5b06a611c078296",
  "FullSemVer": "1.7.1",
  "InformationalVersion": "1.7.1+Branch.v1.7.1.Sha.434206b3d7989e7106c234e1a5b06a611c078296",
  "Major": 1,
  "MajorMinorPatch": "1.7.1",
  "Minor": 7,
  "Patch": 1,
  "PreReleaseLabel": "",
  "PreReleaseLabelWithDash": "",
  "PreReleaseNumber": null,
  "PreReleaseTag": "",
  "PreReleaseTagWithDash": "",
  "SemVer": "1.7.1",
  "Sha": "434206b3d7989e7106c234e1a5b06a611c078296",
  "ShortSha": "434206b",
  "UncommittedChanges": 0,
  "VersionSourceSha": "434206b3d7989e7106c234e1a5b06a611c078296",
  "WeightedPreReleaseNumber": 60000
}

Attach the configuration of Jenkins image

Why the software have this behaviour? There are some configurations that is wrong?

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Comments: 22 (7 by maintainers)

Most upvoted comments

Ok, don’t worry. I’m going to shutdown the test enviroment due the costs of infrastructure. When you able to check this issue, if you need the enviroment let me know, so I can restart it again. Thanks

Hi HHobek, I started with the version 5.12 and then I upgraded to 6.0.0-beta2 to try to resolve… With the version 5.12 there was the same issue. I have jenkins installed in a linux machine, I could try to install the same enviroment on a shared machine. Daniele