Incorrect branch in SonarQube projects

Hi guys,
My SonarQube is version 10.0, running in a K8s environment, all my pipelines are sent to SonarQube for analysis by Jenkins.
Our problem is that when a pipeline is sent for scanning in SonarQube, SQ is not showing the correct branch for the project, here is attached a case as an example, as we can see in the GitHub screenshot, there is no branch called " master" for this project, however, the SonarQube project shows a “master” branch (screenshot from SonarQube)
Could you please help me with this?


Hey there.

A project administrator can rename the branch under Project Settings > Branches to match the main branch name in GitHub.

Hi Colin,
First of all thanks for your help, but I’m logged into SonarQube as admin and I can’t find the “Branches in Project Settings” option (as per the attached screenshot).
But is this condition of not showing the correct branch name a mistake by SonarQube or is it something we are doing wrong?

It didn’t occur to me that you’re using Community Edition! Unfortunately, for an existing project, you’d need to use the POST api/project_branches/rename

It depends on a few factors – if the project was created via the onboarding wizard (not from the first analysis of the project, see the documentation on GitHub Integration), it should have the correct main branch.

You can also set another main branch name as the default (global Adminsitration > General > Project Creation), or when creating the project in the UI.

Hi Colin, thanks a lot,
I’m trying to understand the " POST api/project_branches/rename " to solve this problem.
Thanks a lot for the help.