Get the Git Repository Name from the SonarQube

Hi Team,

We are using SonarQube Community Edition 9.2.3 version and I would like to get the git repository/source code url of gitlab/github project based on the any of the parameters of the project. Is there any way to get this source code url from SonarQube?

Could you help me on this?

Thanks,
Prasad.

Hi Prasad,

You have the ability to pass in sonar.links.scm as an analysis parameter. If that’s provided, you’ll be able to query it back out of the project using the Web APIs.

 
HTH,
Ann

Hi Ann,

Thanks for the response.

Is this the only way to get the scm information? We are not using that parameter while scanning.

Thanks,
Prasad.

Hi Prasad,

I’m not aware that it’s stored anywhere else in SonarQube.

 
:woman_shrugging:
Ann

I take that back. If your project was imported from a DevOps platform or has been configured for PR decoration, then the repo name is stored, and you can see it in Project Settings → DevOps Platform Integration Name → Repository name.

You can use your browser dev tools to eavesdrop to see which calls the UI made to accomplish the action.

You may find this guide helpful.

 
Ann