NoDefaultBranchException error regarding the default branch - this branch does not exist
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Symptoms
The following appears in the atlassian-bitbucket.log
:
1
2
3
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.
Was this helpful?