Can I update the Main branch from “master” to “main”?

My specs :

  • SonarQube Community Edition v10.6 (92116)
  • Deployment : SonarQube zip behind systemctl on Ubuntu

I’m trying to change the master branch on my project. The master branch is currently “master”, and this branch does not exits in my project. The master branch is “main”.

I’ve read on Can I update the Main branch from "master" to "main" without deleting the main branch? that some features were on the way to switch master branches.

How could I switch branches on SonarQube Community Edition v10.6 ?

Hey there.

You can rename the branch, but you’ll have to use the Web API.

1 Like

Thank you, I used the API as you said, but with the api/project_branches/set_main endpoint.

For future references :

#/bin/bash

ADMIN_TOKEN="squ_xxx"
SONAR_URL="sonar.example.com"
PROJECT_ID="project-id"

curl -u $ADMIN_TOKEN: -X POST "$SONAR_URL/api/project_branches/set_main?branch=main&project=$PROJECT_ID"
1 Like

Thanks for the update. It wasn’t clear to me we added this API to Community Edition. I learned something!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.