question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Improvement] Confusing Exception message: "Could not find a 'develop' or 'main' branch, neither locally nor remotely."

See original GitHub issue

When I read this error message, I thought my ‘master’ branch was not recognized by GitVersion whereas the problem was completely unrelated.

Detailed Description

I was trying to have GitVersion work on a private GitLab instance of ours (I’m still a beginner concerning GitLab) and was presented with this exception. I wrongly assumed there was a problem with GitVersion not finding my ‘master’ branch… Even tried to declare it in GitVersion.yml but that was for naught. It appears the problem was on the GitLab side due to how we had configured the way it retrieves a git clone (a detached head only listing a unique (non-master) remote branch, no wonder GitVersion didn’t work).

I understand, by reading GitVersion code, that ‘develop’ and ‘main’ are not real branch names, but rather monikers to whatever the development and the main/principal branch are, but the quotation and the fact they can be real branch names as well is, I suppose, the source of my confusion.

I think that the message either:

  • should list ‘master’ along ‘main’ as one of the branches that could not be found:

Could not find a ‘develop’ or ‘main’ or ‘master’ branch, neither locally nor remotely.

  • or avoid the use of the quotes and try to have the reader understand we are talking about branch roles rather than branch names. Something along this line:

Could not find any development or main branch, neither locally nor remotely.

Context

I think this (obvioulsy simple and dispendable) change may help diagnose issues like the one I had.

Possible Implementation

If one or the other of my propositions is accepted, I’ll gladly modify the relevant string in a PR

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:10 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
DarwinJScommented, Jun 28, 2021

Opps I had done it back to my own fork - fixed now!

1reaction
DarwinJScommented, Jun 24, 2021

I am having this exact problem here when using the default config and I agree that the error seems almost intentionally misleading.

I think the error should be more explicit than the original @odalet suggests:

'Gitversion could not determine which branch to treat as the development branch (default = develop) nor release branch (default = main or master), neither locally nor remotely. Consider diagnosing with git status ; git log -n 1"

Read more comments on GitHub >

github_iconTop Results From Across the Web

Could not find a 'develop' or 'master' branch, neither locally ...
InvalidOperationException : Could not find a 'develop' or 'master' branch, neither locally nor remotely. So, I just created a develop branch and ...
Read more >
What to Do if GitVersion Does Not Recognise Your Main Branch
System.InvalidOperationException: Could not find a 'develop' or 'master' branch, neither locally nor remotely. GitVersion did not recognise the ...
Read more >
Gitversion could not determine which branch to treat as the ...
I have an Azure Devops Pipeline running GitVersion, pipeline has worked in the past; however whenever merging a PR into the master branch...
Read more >
Using GitVersion when your default branch is not called ' ...
Hence, throws an exception if this branch cannot be found. ... With this override file the default branch can be either master or...
Read more >
tlmgr: package aeb-pro not found neither locally nor remote ...
I've added the tlcontrib repo and looking at the URL I can see the list of packages. I want to install aeb-pro. But...
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