> For the complete documentation index, see [llms.txt](https://docs.kosmoslabs.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.kosmoslabs.ai/product-documentation/connecting-github.md).

# Connecting GitHub

Step-by-step guide to connecting GitHub

***

This guide walks you through connecting GitHub to Kosmos.

Kosmos connects to GitHub through the **Kosmos GitHub App**. You install the app on your organization and choose exactly which repositories it can see. The app requests read-only permissions and cannot write to your repositories.

### Prerequisites

* Permission to install a GitHub App on your organization. In most organizations this is an owner or an admin. If you are not an admin, you can still start the install and GitHub will send it to an owner for approval.
* Admin access to Kosmos to configure the integration

***

### Step 1: Start the Connection

1. In Kosmos, navigate to **Settings → Integrations**
2. Find the **GitHub** card and click **Connect**
3. You are redirected to GitHub to install the Kosmos app

If you already have a GitHub connection from before Kosmos moved to the GitHub App, the card shows it as needing reconnection instead. See [Reconnecting a legacy GitHub connection](#reconnecting-a-legacy-github-connection) below.

#### Choosing a GitHub installation

**Connect** and **Reconnect** open a **Connect GitHub** dialog first when this workspace has a GitHub installation to choose from. Select the installation this workspace uses and click **Continue**:

| Option                                         | What it does                                                                                                                                                                                  |
| ---------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Reconnect** *account*                        | Uses the GitHub account or organization this workspace is connected to now. This one is preselected.                                                                                          |
| **Use** *account*                              | Uses an installation that another workspace in your organization already has connected. Nothing is preselected for these; you must choose one. You select this workspace's repositories next. |
| **Install on another account or organization** | Opens GitHub to install the Kosmos app where you choose.                                                                                                                                      |

If you pick an existing installation, you go straight to GitHub to authorize Kosmos for it, then return to Kosmos to select repositories. Kosmos checks each listed installation on GitHub first, so one that was uninstalled or suspended does not appear. If there is nothing to choose from, **Connect** opens GitHub's install page as before. The same dialog appears when you connect GitHub during onboarding.

**One GitHub installation, several workspaces:** By default, a GitHub installation connects to one Kosmos workspace only. If your organization has more than one Kosmos workspace on the same GitHub organization, such as a production and a sandbox workspace, contact <support@kosmoslabs.ai>. Kosmos confirms the workspaces are yours and enables sharing between them.

***

### Step 2: Choose Your Repositories

On the GitHub installation screen, select the account or organization you want to connect, then choose the repository scope:

* **All repositories** gives Kosmos read access to every current and future repository in the organization
* **Only select repositories** limits Kosmos to the repositories you pick

Most teams choose **Only select repositories** and add the repositories that produce the deployments they care about correlating.

Review the requested permissions, then click **Install**. All permissions are read-only. For the full list and what each one is used for, see [Integration Permissions](https://docs.kosmoslabs.ai/product-documentation/integration-permissions.md#github).

You can change the repository selection at any time in GitHub, under your organization's **Settings → GitHub Apps → Kosmos → Configure**. You do not need to reconnect in Kosmos after changing it.

**If your installation needs approval:** when a non-admin starts the install, GitHub holds it pending an owner's approval. Kosmos shows the connection as pending until an owner approves it, then completes automatically.

***

### Step 3: Select Repositories to Sync

Once the installation completes, you are returned to Kosmos and the repository picker appears.

The picker lists only the repositories included in your installation, so what you see in Kosmos matches what the app can actually access. Select the repositories you want Kosmos to sync and click **Save**.

If a repository you previously selected for sync is later removed from the installation in GitHub, Kosmos flags it in your sync configuration rather than failing quietly on the next sync.

***

### Step 4: Confirm Production Branches

After repository selection, Kosmos asks you to confirm which branches represent production for each repository.

* The detected default branch (usually `main`) is prefilled
* Adjust it if your team ships from a differently named branch, such as `develop`
* You can add more than one branch per repository

This mapping tells Kosmos which deployments reached production, which in turn determines whether a correlation is eligible to become a Risk Event. See [How a correlation becomes a Risk Event](https://docs.kosmoslabs.ai/product-documentation/understanding-results.md#how-a-correlation-becomes-a-risk-event) for why this matters.

Kosmos uses the strongest signal available for each deployment event: an explicit environment from the GitHub Deployments API when present, and otherwise your branch mapping.

You can revisit the mapping later from **Settings → Integrations → GitHub**.

***

### Step 5: Verify the Connection

Once saved, Kosmos begins syncing commits, pull requests, issues, and deployment events from your selected repositories.

Navigate to the **Signals** tab to confirm events are flowing in from your connected repositories.

***

### Reconnecting a legacy GitHub connection

Kosmos's GitHub integration now authenticates exclusively through the Kosmos GitHub App. The older OAuth-based connection method has been fully retired.

If your organization is still on that older connection, the GitHub card in Kosmos shows it as needing reconnection rather than offering an upgrade path.

To reconnect:

1. Go to **Settings → Integrations** and click **Reconnect** on the **GitHub** card
2. Complete the installation steps above, choosing exactly which repositories the app can see

***

### Revoking Access

**From Kosmos:** Settings → Integrations → GitHub → Disconnect

**From GitHub:** Your organization's **Settings → GitHub Apps → Kosmos → Uninstall**. Uninstalling the app immediately ends Kosmos's access to every repository in that installation.

Because Kosmos authenticates as an installed app rather than holding a long-lived token, removing the installation is sufficient. There is no separate token left active afterward.

***

### Troubleshooting

**Connection shows as pending**

* An owner still needs to approve the installation. Check your organization's pending GitHub App requests.

**A repository is missing from the picker**

* The repository is not part of your installation. Add it in GitHub under **Settings → GitHub Apps → Kosmos → Configure**, then return to the Kosmos repository picker.

**Integration shows "needs re-authentication"**

* The installation was uninstalled or suspended in GitHub. Reinstall the app from the GitHub card in Kosmos.

**Deployments are correlating but not treated as production**

* Check your production branch mapping in **Settings → Integrations → GitHub**. If a deployment's merge target is not listed as a production branch and GitHub sends no explicit environment, Kosmos treats it as non-production.

***

### Data Access

For details on what Kosmos reads from GitHub, see [Integration Permissions](https://docs.kosmoslabs.ai/product-documentation/integration-permissions.md#github).

All access is **read-only**. Kosmos never creates, updates, or deletes anything in your repositories.

***

**Questions?** Contact <support@kosmoslabs.ai> | [app.kosmoslabs.ai](https://app.kosmoslabs.ai/)

© 2026 Kosmos AI Labs, Inc.


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.kosmoslabs.ai/product-documentation/connecting-github.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
