"master" branch has not been analyzed yet when there is only 1 branch called main

I am woking on a private repository in bitbucket and trying to automate SonarCloud project setup, but I get this error

The issue is that there should only be one branch called “main” in this repo, which is what bitbucket is showing, that passed like expected, but SonarCloud has set “master” as the main branch (will send screenshots for examples)

Hey there.

You should delete the main branch from your SonarCloud project, and rename the master branch to main.


I noticed that these seems to be no option of deleting and renaming branches in the UI, so I used API requests. Problem is that deleting the main branch just didn’t seem to work. Here is the command I used for listing the branches in that repository, which worked as expected.

And here is the command to delete the branch, which didn’t work as expected.

Hey there.

You can take these actions in the UI.