Binding Existing Organisation to GitHub

github
pull-request

(Lewis O) #1

I am attempting to attach my organisation to the GitHub App which is enabled on my GitHub account. I am following the instructions here: https://sonarcloud.io/documentation/organizations/overview/

So far, I am unable to connect to GitHub with my normal user (Logged in through BitBucket) so I have also logged in through GitHub, and added that second user to the organisation. This way I can successfully install the GitHub App, however, once it redirects back to SonarCloud, I do not have the option to bind the organisation with GitHub, It only gives me the option to bind my personal organisation. Why is this?


(Julien Lancelot) #2

Hi,

Why are you not able to authenticate with your “normal” GitHub account ? What is the problem, the error, etc. ?
Then, in order to bind a GitHub organization to SonarCloud, the GitHub account you’re using must be an admin of the GitHub organization.

Regards,
Julien Lancelot


(Lewis O) #3

Hi Julian,

Sorry, I forgot to mention the issue with me not being able to authenticate with GitHub is, I believe, because I am logged in with a bitbucket account, so it only lets me connect with Bitbucket:

I made both my @bitbucket and @github accounts owners of my SonarCloud organisation. I am trying to connect a personal GitHub repository to my SonarCloud organisation. I do not have a GitHub organisation.

Lewis


(Aurélie Boiteux-Cabourdin) #4

Hi Lewis,

Could you explain the use case you’re trying to achieve ?

In any cases, you will only be able to import GitHub repository as SonarCloud project inside a SonarCloud organization that is bound to a GitHub organization.

To bind GitHub organization, you have to be logged in with your GitHub account on SonarCloud.

Aurélie.


(Lewis O) #5

The use case that I am trying to achieve is to get Pull Request decorations working.

Does that mean that I cannot bind a SonarCloud project to a GitHub personal repo?

Many thanks,

Lewis


(Aurélie Boiteux-Cabourdin) #6

If I understand correctly, you’d like to have Pull Request decoration on a gitHub repository that is hosted on your personal organization on GH, is that correct ?

You can bind a SonarCloud project to a GitHub personal repo.
The only way to do that now is to log in with your GH account, create an organization in SC, and choose your personal organization (if your repo is hosted on your personal org) to install the GH app on your personal organization.

Then you will have access to the repositories hosted on the GH org when you click on “Analyse a new project”, and creating projects from there will bind your project to your repository.

Hope that helps,

Aurélie.


(Lewis O) #7

Oh, so does this mean it is not possible to bind a SonarCloud organisation with a GitHub personal account? If so, then I cannot go ahead with what I had planned.

However, I have just read another thread (SonarCloud + GitHub + Pull Request Analysis = No Inline Comments) that may indicate that what I was expecting to happen isn’t happening by design.

I will dispute this design choice in the other thread as my original issue in this thread may not actually be a problem, but a design choice.


(Aurélie Boiteux-Cabourdin) #8

Hi Lewis,

I think there was a misunderstanding :slight_smile:
Yes you can bind a SonarCloud organisation with a GitHub personal Account -> Create an organization from SonarCloud, and “choose an organization on GitHub” and then select your personal GitHub organization to install the GitHub App.


(Fabrice Bellingard) #9

Hi Lewis,

on top of what @aurelie suggested, you can also bind an existing organization if you go to its “Administration > Organization settings” page where you will see:

This is probably a more friendly path.


(Lewis O) #10

Thanks @aurelie , and @Fabrice_Bellingard. Unfortunately both of those options are not available to me for some reason. Please see my previous screenshot which is what I get with @aurelie’s suggestion. In “Administration > Organization Settings”, here is what I see:


(Aurélie Boiteux-Cabourdin) #11

Hi Lewis,

You are probably connected with your BitBucket account on SonarCloud, and that’s why SonarCoud suggest to bind to a Bitbucket team.

Try to connect with your GitHub account to SonarCloud and you should be able to bind your organization to your GitHub organization.