Set default branch as main instead of master in sonarqube community edition

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension) * Community Edition
  • v10.6 (92116)ACTIVE
  • how is SonarQube deployed: ubuntu 22.04
  • what are you trying to achieve set default branch as main instead of master as we have adopted the default branch naming to main instead of master.and run sonarqube from azure pipelines or by itself when new code is pushed to the main branch as we don’t have master branch
  • what have you tried so far to achieve this: only way to make sonarqube was to create a local branch master and merge changes from main on each merge to main manually.

Do not share screenshots of logs – share the text itself (bonus points for being well-formatted)!

Hi,

Welcome to the community!

This should help:

 
Ann

I upgraded it to use developer edition, trial.
I ran this command, and it did not change the default branch.

curl -u ADMIN_TOKEN:usertokenobtainedfrommyadminaccount -X POST “http://localhost:9000/api/project_branches/rename?name=develop/default&project=projectid

Hi,

I’ve just realized I misunderstood your initial question. I thought you simply wanted to change the name of the existing main branch. I see now that you want to swap in a different branch as the main one. That’s api/project_branches/set_main.

 
HTH,
Ann

BTW, this solution worked to change from master to main using the api route.

that did not work either.

Hi,

What response did you get?

 
Ann

no error reported, but no change either

could this be related?

does the developer edition is not effective without a trial key?

Hi,

You won’t be able to run new analyses without a license key. The APIs should still work.

I’ve just realized why I misunderstood your initial question. You’re in Community Edition. Which doesn’t have branches. So there should be no need to swap a different branch into the main spot.

I can’t help you further.

 
Ann