-
Notifications
You must be signed in to change notification settings - Fork 653
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LibGit2Sharp.NameConflictException: Failed to write reference 'refs/heads/feature/Morpheus_v12.2': a reference with that name already exists. #864
Comments
This occurs sporadically on build agents using build vNext. Logging into to the agent locally and running c:\tasks\GitVersion\3.5.3\GitVersion.exe /output buildserver /nofetch (the same command as reported in the log) has some strange behavior. It takes a very long time and then eventually succeeds. Could this have anything to do with the %tmp% file? |
From the looks of it its a case sensitivity issue.
That would be my first guess. Possibly https://github.com/GitTools/GitTools.Core/blob/master/src/GitTools.Core/GitTools.Core.Shared/Git/Helpers/GitRepositoryHelper.cs#L120 needs to be a case insensitive check. |
What is the resolution here? I am seeing same error on one of my branch |
So we just ran into this as well and it's because we had some history where we had someone use a capital Judging by the stack trace, it looks to me like this is a bug in Lib2GitSharp though, not GitVersion, right? |
I am receiving this error with TeamCity now. |
I got the same. I made a big Story/... instead of story/... The error occurred after an PullRequest in TFS. The build failed at git version. My error looks the same as above, without the git log, that's failing too, because the team don't have git in the path 😅 . I'll recheck on that with our dev-team. I requested a Build again, which successfully handled this case. @drub0y Maybe it is a problem from Lib2GitSharp. But maybe it is the use or a missing parameters of it. |
I'm having the problem too. Any solution yet? |
Ditto, we're also hitting the same issue - someone created a |
+1 As mentioned above the issue seems to be with the code at
|
As GitVersion stopped using |
Hi @asbjornu , it's still happening with the latest version 5.0.1. Should this issue be reopened or should I open another issue? In my case I have two branches that cause the conflict:
Error below: An unexpected error occurred: |
@zapr-16, are you able to reproduce this problem in a GitVersion/src/GitVersionCore.Tests/IntegrationTests/HotfixBranchScenarios.cs Lines 52 to 76 in c172e8f
|
It's still happening with 5.1.2 😞 |
@thoemmi, are you able to reproduce the problem in a |
Unfortunately, it does not occur locally but on the Azure DevOps build server. |
Actually, it happens in DevOps Pull Requests only. If I queue an build of the branch explicitly, it succeeds. I guess it's how Azure DevOps handles the implicit PR branches. |
This issue still occurs every now and then in our Pull Request builds on Azure DevOps. Unfortunately, I am not able to reproduce it locally. (BTW, GitVersionTask is 5.1.2) @asbjornu Since this issue is closed already, should I open a new issue, or can you re-open this one? |
I am having this on our master branch in one of our projects. We have 5 other Azure DevOps pipeline builds running fine with the "GitVersionTask" referenced in multiple projects. But this 6th build is giving an error: This branch obviously always has been called "master", so it is not a casing issue in our case. Our VS solution has 3 projects with "GitVersionTask" installed. When I remove the "GitVersionTask" from 1 project (an leave it in the other 2). The build succeeds. So the task works fine in the other 2 projects. If I then add the "GitVersionTask" back to the 3th project, the build still succeeds. But when I then make any other change/checkin, the build fails again with the same error message. Does this make any sense to anyone? |
I see here that some more information is being logged: Is there a way to turn this logging on, on the GitVersionTask? |
LibGit2Sharp was upgraded to version Regarding logging in the task, @eriksteinebach, I believe that is something you need to adjust with MSBuild on the command line when you build the solution/project. |
Still failing with version
|
Ok, so these are most likely the problematic lines: GitVersion/src/GitVersionCore/Extensions/RepositoryExtensions.cs Lines 57 to 62 in 438d450
So I suppose |
After hours of debugging and scratching my head, I managed to solve this problem for my case. I noticed that the exception was thrown on one build node, and others had no problems running GitVersion. Running it manually also worked fine. After excluding my problematic build node and having merged a change to master, I got a new error:
This made me realize I had a typo in the name of my feature branch (note the capitalized E). After some testing, it seems I am able to reproduce this bug with the following steps (it is important that everything is built on the same build node):
I managed to get out of this problem by removing all the feature branches remotely and deleting the git data cache (my case this was in |
Great discovery, @martinmine. Case sensitivity explains the problem quite well. We need to fix this in GitVersion so branches are always compared case insensitively. |
Interesting thing is that my problem went away by switching from using the GitVersionTask nuget package in the projects to using GitVersionTask (installed through the marketplace) as a step in my build and using the generated version number during the build of the project. Not sure why, maybe the problematic code is limited to the nuget package or maybe I started using a new build agent. But the task has worked very stable for me where I had multiple problems with the nuget package. And the task gives me better insight in the version being used, so I really like the Task approach better (for anyone else running into this issue). |
🎉 This issue has been resolved in version 5.3.3 🎉 Your GitReleaseManager bot 📦🚀 |
I can confirm that the 5.3.3 solved the problem for my case ❤️ |
Thanks for the confirmation, @martinmine! 🙏 |
I am sorry to report that I am seeing this same issue in
After upgrading to the latest as of right now:
I get the same failure, with more detailed stacktrace:
and you can see right there, the case difference of |
GitVersion can't help with filesystem case sensitivity, @mcascone. You need to ensure that you name your branches consistently, everywhere. Preferably in all-lowercase. |
FYI. Same problem here. No capital letters in branch name but I still see the error GitVersion.Tool 5.6.10 x64
|
Are you able to reproduce this in a public repository, @mujdatdinc? |
Sorry, I'm just starting to look at this but I have an exception that occurs only on 1 branch that we have. The rest are working.
This is in version 3.5.3 building on a TFS vNext agent.
`ERROR [05/18/16 11:44:42:43] An unexpected error occurred:
The text was updated successfully, but these errors were encountered: