> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agent.golf/llms.txt
> Use this file to discover all available pages before exploring further.

# Connect a GitHub Organization

> Install the Agent Golf GitHub App and connect your GitHub organization to Agent Golf.

Connect your GitHub organization so that Agent Golf can read your pull requests and link agent sessions to them. For what Agent Golf reads, stores, and writes, see [GitHub Integration](https://docs.agent.golf/github/overview.md).

## Before you begin

* In Agent Golf, the **Manage Organization Integrations** organization permission. An organization admin has it. You do not have to be a user of a workspace of the organization. A workspace cannot connect GitHub. See [Stop or remove the connection](#stop-or-remove-the-connection).
* The **View Pull Requests and Repositories** or the **Manage Integrations** permission, to see the repositories that the App covers on the workspace page.
* On GitHub, a current owner role in the GitHub organization. Installing the App does not give this role. Other members of the GitHub organization can only request an installation.
* A GitHub organization on github.com. Agent Golf connects to GitHub.com only.

To see which roles include these permissions, see [Default roles](https://docs.agent.golf/account/users.md#default-roles).

## Connect your organization

1. Open **Settings**, choose **Organization** at the top of the navigation, then select **Integrations > GitHub**.
2. Under **GitHub Organizations**, select **Connect GitHub Organization**. When a GitHub organization is already connected, select **Connect Another GitHub Organization**. The GitHub organization connects to the organization, and the organization keeps its data. Each workspace of the organization sees its pull requests.
3. Authorize Agent Golf on GitHub. GitHub returns you to Agent Golf.
4. Continue on the page that Agent Golf shows:
   * **Choose a GitHub Organization**: select the GitHub organization to connect. This page also shows when the list has only one GitHub organization. To connect one that is not in the list, select **Install on Another GitHub Organization**. Choose within 10 minutes, or the choice expires.
   * **No Installation Found**: select **Continue with GitHub**, then choose the GitHub organization. Choose **All repositories** or **Only select repositories**, and install the App. GitHub lists the permissions that the App requests. When GitHub returns you to Agent Golf, select the GitHub organization on **Choose a GitHub Organization**.
   * **Already Connected Elsewhere**: see [Connection errors](#connection-errors).

The GitHub page then shows the GitHub organization with a **Connected** badge.

**Choose a GitHub Organization** lists only the App installations that you can connect:

* A GitHub organization that no Agent Golf organization holds, or that your organization already holds. Connecting one that your organization holds again repairs the connection.
* A GitHub organization that another Agent Golf organization holds, when that organization has no active user, or when you have the **Manage Organization Integrations** permission in it. Connecting moves it to your organization.

Agent Golf can list only GitHub organizations that have the App. A GitHub organization without the App is never in the list.

> [!NOTE]
>
> If you choose a GitHub organization that already has the App on the GitHub install page, GitHub opens that
> installation's settings and does not return you to Agent Golf. Go back to Agent Golf and connect again.

When you connect a GitHub organization, Agent Golf also links your GitHub account to your Agent Golf user. See [Link Your GitHub Account](https://docs.agent.golf/github/personal-account.md).

You can also connect from the **Connect GitHub** step of the [onboarding flow](https://docs.agent.golf/getting-started/create-account.md#onboarding-flow). After GitHub, Agent Golf returns you to that step.

### Connect during signup

1. On **Set Up Your Organization**, select **Continue with GitHub** instead of **Create Organization**.
2. Authorize Agent Golf on GitHub.
3. On **Choose a GitHub Organization**, select the GitHub organization. When none of your GitHub organizations has the App, GitHub opens the App installation first. Install the App there.
4. On **Name Your New Organization**, enter the name of your company. It names your Agent Golf organization, and your invoices show it.
5. Select **Create Organization**.

Agent Golf creates the organization, makes you its admin, and connects the GitHub organization to the organization. Agent Golf creates nothing before step 5. To stop, select **Back to Setup**.

An App installation alone does not create an Agent Golf organization or add anyone to one. To join an Agent Golf organization that already exists, ask its admin for an invitation.

### Install the App from GitHub

You can also install the App on GitHub first. When GitHub returns you to Agent Golf:

* **You are signed out**: sign in. Agent Golf then continues.
* **You have a workspace**: **Attach the GitHub Organization?** opens. Select **Attach to** with the name of the organization of your workspace, then select the GitHub organization on **Choose a GitHub Organization**. Without **Manage Organization Integrations** in that organization, the page asks you to ask an organization admin. To use a new Agent Golf organization, select **Set Up as a New Organization** and continue as in [Connect during signup](#connect-during-signup).
* **You have no organization**: continue as in [Connect during signup](#connect-during-signup).

## Review repository coverage

You choose the repositories on GitHub. Agent Golf shows your choice, but you cannot change it in Agent Golf.

1. On the GitHub page, select **Show Repositories** next to the GitHub organization.
2. Review the list. It shows up to 100 repositories. For a larger installation, it shows "Showing the first 100. See GitHub for the full list."
3. To add or remove repositories, select **Manage Repositories on GitHub**.

Agent Golf updates the list when the App's repositories change on GitHub.

## Approve Actions access

A pull request's CI runs and their cost need the App's **Actions: Read** permission. An owner of the GitHub organization must approve it.

When the GitHub page shows "Approve Actions access on GitHub to see CI runs and costs.":

1. Select **Review Access on GitHub**.
2. On GitHub, review and accept the new permissions.

CI runs from before the approval do not appear.

## Connection states

| State on the GitHub page | Cause | Fix |
| - | - | - |
| **Connected** | Agent Golf receives the events of the covered repositories. | None. |
| **Suspended on GitHub** | The App is suspended on the GitHub organization. No new activity arrives. | Unsuspend the App on GitHub, then select **Reconnect**. |
| **App Uninstalled** | The App was removed from the GitHub organization. No new activity arrives. | Select **Reinstall on GitHub**. |

## Connection errors

| Page | Cause | Fix |
| - | - | - |
| **No Installation Found** | No GitHub organization of yours has the App. | Install the App. Then connect again. |
| **Already Connected Elsewhere** | Each GitHub organization with the App that Agent Golf found for you belongs to another Agent Golf organization. The page names them. | To connect a named one, ask an admin of the Agent Golf organization that holds it to disconnect it. To connect a different one, select **Install on Another GitHub Organization**. |
| **GitHub Organization Owner Required** | Your GitHub account is not a current owner of the GitHub organization. | Ask an owner of the GitHub organization to connect it. |
| **GitHub App Permissions Required** | The App cannot check your owner role. An owner has not accepted the App's updated permissions. | Ask an owner of the GitHub organization to accept the updated permissions on GitHub. Then connect again. |
| **Access Not Active** | Your access to this Agent Golf organization is not active. | Accept your invitation, or ask an admin to invite you again. |
| **Trial Already Used** | This GitHub organization already had a trial in another Agent Golf organization. | Select **Start a Plan**, then connect again. |
| **GitHub Account Already Linked** | Your GitHub account is linked to another Agent Golf user in this organization. | Disconnect GitHub from that user, or use a different GitHub account. Then select **Try Connecting Again**. |
| **Connection Failed** | The connection did not complete, or the choice on **Choose a GitHub Organization** expired after 10 minutes. | Select **Try Connecting Again**. When that button does not show, select **Back to the Dashboard** or **Back to Setup**, and connect again. |

## Stop or remove the connection

| Action | Where | Result |
| - | - | - |
| Suspend the App | GitHub | No new activity arrives. The GitHub page shows **Suspended on GitHub**. |
| Uninstall the App | GitHub | No new activity arrives. The GitHub page shows **App Uninstalled**. The GitHub organization stays connected to your Agent Golf organization. |
| **Disconnect** the organization | Agent Golf | Agent Golf stops attributing new events of the GitHub organization. Another Agent Golf organization can then connect it. The App stays installed until you uninstall it. |

To disconnect:

1. Open **Settings**, choose **Organization** at the top of the navigation, then select **Integrations > GitHub**.
2. Select **Disconnect** next to the GitHub organization.
3. Confirm in **Disconnect GitHub Organization**.

A workspace cannot connect, repair, or disconnect GitHub. In a workspace, **Settings > Integrations > GitHub** shows each GitHub organization of the organization, read only. Without a connection, it shows "Ask an organization admin to connect GitHub." Users with **Manage Organization Integrations** also see **Manage in Organization Settings**.

You can reconnect at any time. To stop GitHub events entirely, also uninstall the App on GitHub.

None of these actions deletes the data that Agent Golf already collected. The organization holds that data, and the retention windows of the organization apply to it. To delete it, use [Delete Organization Data](https://docs.agent.golf/account/data-retention.md#delete-organization-data).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.