It's not possible to push branch / PR analysis to SonarCloud without default branch

Hello team,

I hope you’re doing well. We’re performing a migration from SonarQube to SonarCloud - and we have noticed that’s not possible to push branch / PR analysis to SonarCloud without pushing first the default branch.

In case we try to do it, we’re getting the following error:

Could not find a default branch to fall back on.

That’s not the case for SonarQube, as you can push a branch / PR analysis even if the default branch hasn’t been pushed.

  • Is there any plan to correct this?
  • What would be the appropriate way to create / initialize a project in SonarCloud in which we would like to enable PR analysis?


Javier G.

Hello @jgutierrezglez ,

I just tested it with a project on GitHub and did not receive an error, without having analyzed a default branch. Could you provide more details on your setup (which DevOps platform, CI/CD system, bound/manually created project)?
My initial suspicion is that the project is not bound to a GitHub repository and thus behaves differently here.

To get the most out of SonarCloud, we generally recommend to use bound projects (created through the SonarCloud interface and connected to a repository on your DevOps platform) and analyze at least the default/main branch as well as the pull requests.

Hello Martin,

  • Our SonarCloud org is linked to our GitHub org
  • We’re using Jenkins as CICD system
  • We’re not creating the project by bounding or manually adding it to SonarCloud atm

I also tried to bound the project and try to analyze a PR before the main branch was analyzed and that actually worked. So, I guess that should be enough for us now.

Is there a way to rename a bound project after it has been created ?


Javier G.

Yes, you can rename the project by using the sonar.projectName parameter in the file: Analysis Parameters | SonarCloud Docs . For certain build systems you have to change the name directly in your build configuration (e.g. the name parameter for Maven).