When your team works with a fork-based development model instead of using a centralized Git workflow, analyzing your branches with SonarQube™ results in the same Sonar™ projects for your fork and your origin repository, because by default, the project key is the same in both repositories.
To differentiate the origin and its forks, we recommend that you only analyze pull request branches.
Bitbucket creates these branches for every pull request, e.g.
refs/pull-requests/1/from for the pull request with ID 1.
These branches can be used to analyze your pull requests from forks to upstream only by passing the pull request branch name to
Include Code Quality for Bamboo can do this automatically. For other CI systems, the pull request branch name has to be passed manually.
Include Code Quality for Bitbucket supports pull request branches by enabling the option "Forking workflow: Use special pull request branches" in the "Advanced" tab of the app's repository settings: