NoDefaultBranchException error regarding the default branch - this branch does not exist

Still need help?

The Atlassian Community is here for you.

Ask the community

Symptoms

The following appears in the atlassian-bitbucket.log:

2013-01-16 09:36:06,547 ERROR [http-bio-8443-exec-13] XUE2 576x1711x1 hdxjye 10.16.214.10 "GET /projects/INFENG/repos/inspircd/browse HTTP/1.1" c.a.p.web.DefaultWebInterfaceManager Could not evaluate condition 'com.atlassian.plugin.web.conditions.AndCompositeCondition@3c9147c1' for descriptor: com.pirateninjaunicorn.bitbucket.readme-parser:readmeParserTab (Tab in repository view)
com.atlassian.bitbucket.exception.NoDefaultBranchException: refs/heads/master is set as the default branch, but this branch does not exist
...

Cause

Some projects do not use "master" as their development branch, preferring to use "trunk" or "development" instead. Such repositories may not even have a "master" branch. However, git's default behavior is for HEAD to point to refs/heads/master, which results in a pretty unpleasant user experience when browsing a repository in Bitbucket Server. When navigating to the "Files" or "Commits" tabs, Bitbucket Server displays a warning indicating the default branch does not exist, and the user then has to go select a different branch. Setting the default branch allows Bitbucket Server to display a useful initial branch, rather than a warning.

Setting the default branch in Bitbucket Server has only limited control over what you will receive when you clone the repository, due to how git's wire protocol works. The real purpose of the feature is to allow users to control which branch is selected by default in the branch selector.

 

Resolution

  • Navigate to the affected Repository.
  • Click on "Settings".
  • Under "General Settings" modify the "Default Branch" accordingly.

 

Last modified on Mar 30, 2016

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.