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

See original GitHub issue

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?

Issue Analytics

  • State:open
  • Created 5 months ago
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
DanieleSkycommented, May 2, 2023

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

1reaction
DanieleSkycommented, Apr 11, 2023

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Jenkins] ref 'refs/remotes/origin/*' doesn't match the ...
After that the destination doesn't match with develop anymore. I suspect that, when creating the local branch it also gets checked out.
Read more >
Jenkins - Git Publisher - Error The destination refspec ...
I solved the problem: In the first build, I added a "build step" -> "execute shell": git checkout master. The following builds, I...
Read more >
Match Destination Formatting Error
Recently I have been getting the below error about half the time I try to "match destination formatting". "Microsoft Excel cannot calculate ...
Read more >
Pushing a branch to Bitbucket fails with the error, "refspec ...
When an attempt is made to push the "dev" branch to the remote, the error " refspec matches more than one " will...
Read more >
Destination Loading Error Reference | Stitch Documentation
Resolve errors related to loading data into your Stitch destination. ... The type of the Primary Key of incoming data doesn't match the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found