> For the complete documentation index, see [llms.txt](https://docs.sonarsource.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sonarsource.com/sonarqube-server/2026.4/instance-administration/devops-platforms/github/setting-up-github-app.md).

# Setting up a GitHub App

You need to use a GitHub App to connect SonarQube Server with a GitHub instance in order to use the following features:

* [Importing your GitHub repositories](/sonarqube-server/2026.4/project-administration/creating-project/github/import-repos.md) into SonarQube Server.
* [Delegating the SonarQube Server user authentication](/sonarqube-server/2026.4/instance-administration/authentication/github.md) to GitHub.
* [Reporting the quality gate status and analysis summary](/sonarqube-server/2026.4/project-administration/creating-project/github/configure-binding.md#pull-request-integration) in your GitHub pull requests.
* [Blocking pull request merges](/sonarqube-server/2026.4/project-administration/creating-project/github/configure-binding.md#preventing-pull-request-merges) with GitHub branch protection rules when the quality gate fails.

You need the global Administer System permission in SonarQube Server to perform this setup.

## Setup overview <a href="#overview" id="overview"></a>

The setup consists of three stages:

1. Create or register a GitHub App — two methods are available:
   * **Create configuration**: You register and configure the app on GitHub yourself, then enter the credentials in SonarQube Server. Use this path if your network configuration prevents the automatic flow, if your integration requires code scanning alert permissions, or if you already have a GitHub App you want to reuse.
   * **Create app for me** (recommended): SonarQube generates a preconfigured app and redirects you to GitHub to authorize its creation. SonarQube saves the resulting credentials automatically. Organization Owners complete the installation directly. Organization Members can initiate the flow, but an Owner must approve the installation to complete it.
2. [Install the app](#install-github-app-on-organization) on the GitHub organizations that SonarQube Server needs to access.
3. [Add the app to SonarQube Server's global setup](#add-github-app-to-sonarqube-setup).

## Create a GitHub App automatically <a href="#create-github-app-automatically" id="create-github-app-automatically"></a>

When you choose **Create app for me**, SonarQube creates the GitHub App with the required settings and permissions, and saves the credentials in SonarQube Server automatically.

### Prerequisite

You need a GitHub account with an organization Owner or Member role. If you are an organization Owner, you can create and install the app in one step. If you are an organization Member, GitHub sends an installation approval request to your organization Owners. The app is active in SonarQube Server once an Owner approves it.

To create a GitHub App automatically:

1. In the SonarQube UI, go to **Administration** > **Configuration** > **General Settings** > **DevOps Platform Integrations**.
2. Open the **GitHub** tab and select **Create app for me**. Your window will open in GitHub to continue.
3. In GitHub, enter your **GitHub organization** and a unique **Configuration name**.
   * Optionally, select **Also set up GitHub authentication** to enable users to sign in using their GitHub login credentials.
4. Select **Continue to GitHub** to confirm access, after which the **Create GitHub App** page will open.
5. Add your GitHub App name and select **Create GitHub App for&#x20;*****Your GitHub Organization*** to continue. You can always change the app name later.
6. A new page will open where you must select the GitHub organization where you want to install the app.
7. Select either **All repositories** or **Only select repositories** to bind to SonarQube Server.
8. To complete the installation, select **Install & Authorize** to finish. GitHub will redirect you back to SonarQube Server. The App ID, Client ID, Client Secret, and Private Key are saved automatically in a new GitHub Configuration record.

SonarQube pre-configures the app with the following permissions, which are shown on GitHub for review:

* Read access to administration, code, members, metadata, organization administration, and organization projects.
* Read and write access to checks and pull requests.
* Read access to email addresses (user permission).

If your integration requires code scanning alert permissions (to report security alerts to GitHub), use the manual setup instead. See [Create a GitHub App manually](#create-github-app-manually).

After the app is created, [install it on your GitHub organizations](#install-github-app-on-organization).

### If the automatic flow fails

If the automatic flow fails (for example, because of network or firewall restrictions between SonarQube Server and GitHub), use the manual setup instead. See [Create a GitHub App manually](#create-github-app-manually).

## Create a GitHub App manually <a href="#create-github-app-manually" id="create-github-app-manually"></a>

Use manual setup if:

* Your SonarQube Server cannot complete the automatic flow (for example, because of network or firewall restrictions).
* Your integration requires code scanning alert permissions to report security alerts to GitHub.
* You already have a GitHub App for SonarQube Server and want to reuse it.

If you already have a GitHub App, skip the registration steps below and go directly to [Add the GitHub App to SonarQube Server's global setup](#add-github-app-to-sonarqube-setup).

After registering a new app, continue with [Install the GitHub App in your organizations](#install-github-app-on-organization).

See GitHub's documentation on [registering a GitHub App](https://docs.github.com/en/apps/creating-github-apps/registering-a-github-app/registering-a-github-app) for general information on GitHub Apps.

We recommend registering a public App. You can register a private App if you have only one GitHub organization. In that case, you must register the App under that organization.

Specify the following settings in your app:

* **GitHub App Name**: Your app's name. Example: sonarqubeserver.
* **Homepage URL**: Your SonarQube Server instance's base URL (for information purposes only).
* **Callback URL**: Your SonarQube Server instance's base URL (the URL used to redirect to the SonarQube Server).
* **Webhook URL**: To improve security, webhooks, by default, are not allowed to point to the SonarQube Server. Therefore, we recommend that you disable the feature unless you want to enable alerts for security issues in GitHub. See [Setting up the report of security alerts](/sonarqube-server/2026.4/instance-administration/devops-platforms/github/report-security-alerts.md) for more information. To disable the feature, clear the Webhook Active checkbox to silence a forthcoming deprecation warning, and clear the Webhook URL and Webhook secret fields.
* Under **Permissions** and **Subscribe to events**, set up the permissions and events as explained below in the list of settings. Some permissions or events are only necessary depending on the purpose of the integration.

<details>

<summary>Permissions and Subscribe to events settings</summary>

**Repository permissions**

<table><thead><tr><th width="216">Permission</th><th width="166">Access</th><th>Note</th></tr></thead><tbody><tr><td>Administration</td><td>Read-only</td><td>Required only for user provisioning.</td></tr><tr><td>Checks</td><td>Read &#x26; Write</td><td><br></td></tr><tr><td>Code scanning alerts</td><td>Read &#x26; Write</td><td>Required only if you want to report security alerts raised in SonarQube Server to GitHub. When you update this permission, GitHub sends an email to the GitHub organization's administrator, asking them to validate the changes on the installation of the GitHub App.</td></tr><tr><td>Contents</td><td>Read-only</td><td><br></td></tr><tr><td><p><em>In GitHub Enterprise Server</em>: Repository metadata</p><p><em>In GitHub.com</em>: Metadata</p></td><td>Read-only</td><td><br></td></tr><tr><td>Pull Requests</td><td>Read &#x26; Write</td><td><br></td></tr></tbody></table>

**Organization permissions**

<table><thead><tr><th width="212">Permission</th><th width="171">Access</th><th>Note</th></tr></thead><tbody><tr><td>Administration</td><td>Read-only</td><td>Required only for user provisioning.</td></tr><tr><td>GitHub Copilot Business</td><td>Read-only</td><td>Required only to use SonarQube Server's Autodetect AI-Generated Code feature. (<a data-mention href="/pages/0iKhzTCGqFjBBPNKp7s1">/pages/0iKhzTCGqFjBBPNKp7s1</a> is deprecated)</td></tr><tr><td>Members</td><td>Read-only</td><td><br></td></tr><tr><td>Projects</td><td>Read-only</td><td><br></td></tr></tbody></table>

**Account permissions**

| Permission      | Access    | Note                                                    |
| --------------- | --------- | ------------------------------------------------------- |
| Email addresses | Read-only | Required only for user authentication and provisioning. |

**Subscribe to events**

Only if you want to report security alerts raised in SonarQube Server to GitHub:

Select **Code scanning alert**.

</details>

* Under **Where can this GitHub App be installed?** select **Any account** to make the App public in order to allow you to install the App on any organization.

After registering the app, [install it on your GitHub organizations](#install-github-app-on-organization).

## Install the GitHub App in your organizations <a href="#install-github-app-on-organization" id="install-github-app-on-organization"></a>

Install the GitHub App on each GitHub organization that SonarQube Server needs to access. See GitHub's documentation on [installing GitHub Apps](https://docs.github.com/en/free-pro-team@latest/developers/apps/installing-github-apps) for more information.

## Add the GitHub App to SonarQube Server's global setup <a href="#add-github-app-to-sonarqube-setup" id="add-github-app-to-sonarqube-setup"></a>

If you chose **Create app for me**, SonarQube has already created a GitHub Configuration record for repository import. You only need to complete this step if you used the manual setup, or if you want to set up user authentication delegation.

<details>

<summary>If you want to support the GitHub repository import</summary>

To add the GitHub App to SonarQube Server’s global setup for repository import:

1. In the SonarQube UI, go to **Administration** > **Configuration** > **General Settings** > **DevOps Platform Integrations**.
2. Select the **GitHub** tab and select **Create configuration**. The **Create a configuration** dialog opens.
3. Specify the settings in the [Configuration settings](#configuration-settings) section below.

</details>

<details>

<summary>If you want to delegate the user authentication to GitHub</summary>

To add the GitHub App to SonarQube Server’s global setup for user delegation, go to **Administration** > **Configuration** > **General Settings** > **Authentication** > **GitHub**. See Connecting your GitHub App to SonarQube Server in [GitHub](/sonarqube-server/2026.4/instance-administration/authentication/github.md) authentication.

</details>

<details>

<summary>Configuration settings</summary>

<table><thead><tr><th width="164">Field</th><th>Description</th><th>Note</th></tr></thead><tbody><tr><td>Configuration name</td><td><p>The name used to identify your GitHub Configuration. Use something succinct and easily recognizable.</p><p><br></p></td><td>Only available in editions authorizing the integration with multiple GitHub instances: Enterprise Edition and Data Center Edition.</td></tr><tr><td>GitHub API URL</td><td><p>The API URL of the GitHub instance. For example, https://github.company.com/api/v3 for GitHub Enterprise or https://api.github.com/ for GitHub.com.</p><p><br></p></td><td><br></td></tr><tr><td>GitHub App ID</td><td>The App ID of your GitHub App (on GitHub, go to <strong>Settings</strong> > <strong>Developer Settings</strong> > <strong>GitHub Apps</strong> to view your App).</td><td><br></td></tr><tr><td>Client ID</td><td>The Client ID of your GitHub App’s page.</td><td><br></td></tr><tr><td>Client Secret</td><td>The Client secret of your GitHub App’s page. Administrators can encrypt this secret. See <a data-mention href="/pages/GUKAY8PjRn9TzhQLoOAB">/pages/GUKAY8PjRn9TzhQLoOAB</a>.</td><td><br></td></tr><tr><td>Private Key</td><td>Your GitHub App’s private key in PEM format. You can generate a .pem file from your GitHub App’s page under Private keys. Copy and paste the whole contents of the file here.</td><td>Administrators can encrypt this key. See <a data-mention href="/pages/GUKAY8PjRn9TzhQLoOAB">/pages/GUKAY8PjRn9TzhQLoOAB</a>.</td></tr><tr><td>Webhook Secret</td><td>Webhook secret defined in your GitHub App to enable the report of code scanning alerts..</td><td>Required only if you want to enable code scanning alerts for security issues in GitHub.</td></tr></tbody></table>

</details>

> **Note:** Standard GitHub procedures require confirmation when access levels are changed. Typically, this is done by confirming via an email sent to administrators.

## Related online learning

* <i class="fa-desktop">:desktop:</i> [Configure a GitHub App for SonarQube Server](https://www.sonarsource.com/learn/course/sonarqube-server/58844141-6a47-4fba-b219-d88d7054a045/configure-a-github-app-for-sonarqube-server)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.sonarsource.com/sonarqube-server/2026.4/instance-administration/devops-platforms/github/setting-up-github-app.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
