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

# Set up a GitHub Enterprise connector

> C1 provides identity governance and just-in-time provisioning for GitHub Enterprise. Integrate your GitHub Enterprise instance with C1 to run user access reviews (UARs), enable just-in-time access requests, and automatically provision and deprovision access.

<Tip>
  **GitHub versus GitHub Enterprise: which integration should I use?** Follow the instructions on this page if your organization accesses GitHub at a custom domain.

  If you access GitHub at `github.com`, go to the [GitHub](/baton/github) integration.
</Tip>

## Capabilities

| Resource                          | Sync                                                          | Provision                                                     |
| :-------------------------------- | :------------------------------------------------------------ | :------------------------------------------------------------ |
| Accounts                          | <Icon icon="square-check" iconType="solid" color="#c937ae" /> | <Icon icon="square-check" iconType="solid" color="#c937ae" /> |
| Repositories                      | <Icon icon="square-check" iconType="solid" color="#c937ae" /> | <Icon icon="square-check" iconType="solid" color="#c937ae" /> |
| Teams                             | <Icon icon="square-check" iconType="solid" color="#c937ae" /> | <Icon icon="square-check" iconType="solid" color="#c937ae" /> |
| Orgs\*                            | <Icon icon="square-check" iconType="solid" color="#c937ae" /> | <Icon icon="square-check" iconType="solid" color="#c937ae" /> |
| Org roles/Enterprise licenses\*\* | <Icon icon="square-check" iconType="solid" color="#c937ae" /> | <Icon icon="square-check" iconType="solid" color="#c937ae" /> |
| Secrets - API keys                | <Icon icon="square-check" iconType="solid" color="#c937ae" /> |                                                               |

The GitHub Enterprise connector supports [automatic account provisioning and deprovisioning](/product/admin/account-provisioning). New accounts will send an invitation to the account owner; if an invitation is pending, the account status will be shown as **Unspecified**.

* Due to limitations on the GitHub API, syncing multiple orgs requires a personal access token (PAT). A separate connector and GitHub app is required when using the GitHub App integration.

\*\* Organization roles are also referred to as "enterprise licenses" in GitHub's documentation.

[This connector can sync secrets](/product/admin/inventory) and display them on the **Inventory** page.

## Gather GitHub Enterprise credentials

Configuring the connector requires you to pass in credentials generated in GitHub Enterprise. Gather these credentials before you move on. To set up the GitHub Enterprise connector, you can choose to create either a personal access token (classic) or a fine-grained access token.

### Option 1: Use a personal access token (classic)

Follow these instructions to integrate your GitHub Enterprise instance by using a [GitHub Enterprise personal access token (classic)](https://docs.github.com/en/enterprise-cloud@latest/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#types-of-personal-access-tokens).

<Warning>
  A user with **Enterprise Owner** access in GitHub Enterprise must perform this task.
</Warning>

<Tip>
  If you're using SAML single sign-on, avoid a `You must grant your Personal Access token access to this organization` error by following the [Authorizing a personal access token for use with SAML single sign-on](https://docs.github.com/en/enterprise-cloud@latest/authentication/authenticating-with-saml-single-sign-on/authorizing-a-personal-access-token-for-use-with-saml-single-sign-on) instructions in the GitHub documentation.
</Tip>

<Steps>
  <Step>
    In GitHub Enterprise, click your profile photo, then click **Settings**.
  </Step>

  <Step>
    In the left sidebar, select **Developer settings**.
  </Step>

  <Step>
    Click **Personal access tokens > Tokens (classic)**.
  </Step>

  <Step>
    Click **Generate new token > Generate new token (classic)**.
  </Step>

  <Step>
    Name your token (for example, **C1 Integration**). Optionally, add a token expiration date.
  </Step>

  <Step>
    Select the following **Scopes:**

    * **repo** - select all
    * **admin:org** - select all if using C1 for GitHub Enterprise provisioning (see the note below), or **read:org**
    * **user** - select all
    * **admin:enterprise** - select **read:enterprise**

    <Warning>
      The **write::org** scope is used by C1 when automatically provisioning and deprovisioning GitHub Enterprise access on your behalf. **If you do not want C1 to perform these tasks for you, do not give your token this scope.**
    </Warning>
  </Step>

  <Step>
    Click **Generate token**. Copy and save the new token.
  </Step>
</Steps>

<Warning>
  If you use SAML SSO, you must authorize the PAT using [these instructions](https://docs.github.com/en/enterprise-cloud@latest/authentication/authenticating-with-saml-single-sign-on/authorizing-a-personal-access-token-for-use-with-saml-single-sign-on).
</Warning>

**Done.** Next, move on to the connector configuration instructions.

### Option 2: Use a GitHub app

Follow these instructions to integrate your GitHub instance by using a [GitHub app](https://docs.github.com/en/apps/creating-github-apps/about-creating-github-apps/about-creating-github-apps).

This process creates a GitHub app that is only available to your GitHub organization, then generates an installation token for that app, which can be used to integrate the GitHub organization with C1. This creates the equivalent of a personal access token, but does not tie the token to a specific identity.

<Tip>
  **Integrating multiple GitHub organizations requires separate GitHub Apps and connectors.** GitHub Enterprise APIs do not support GitHub App tokens and require classic PATs with the [`admin:enterprise`](https://docs.github.com/en/rest/enterprise-teams/enterprise-teams?apiVersion=2022-11-28) scope.
</Tip>

<Warning>
  A user with the **Org Owner** permission in the GitHub organization to be integrated with C1 must perform this task.
</Warning>

<Steps>
  <Step>
    In GitHub, navigate to **Your organizations** > **Settings**.
  </Step>

  <Step>
    In the left sidebar, select **Developer settings**.
  </Step>

  <Step>
    Click **GitHub Apps**.
  </Step>

  <Step>
    Click **New GitHub App**.
  </Step>

  <Step>
    Give the app a globally unique name, such as "c1-integration-`<org name>`". There is a 34 character limit.
  </Step>

  <Step>
    In the **Homepage URL** field, enter a placeholder URL such as `http://example.com`. Because this app is not public, it does not have or need a website to direct other users to, so we can use a placeholder URL.
  </Step>

  <Step>
    In the **Callback URL** field, enter a placeholder URL such as `http://example.com`. This app will not use a callback, so we can use a placeholder URL.
  </Step>

  <Step>
    Check the **Expire user authorization tokens** and **Enable Device Flow** checkboxes to enable these settings.
  </Step>

  <Step>
    In the **Webhook** section of the page, uncheck the **Active** checkbox to disable this setting.
  </Step>

  <Step>
    In the **Permissions** section of the page, give the app the following permissions:

    * Repository permissions:

      * **Administration**: Read and write access
      * **Metadata**: Read-only access

    * Organization permissions:

      * **Administration**: Read-only access (required to detect SAML/SSO configuration)
      * **Custom organization roles**: Read and write access
      * **Members**: Read and write access

    * Enterprise permissions:

      * **Custom enterprise roles**: Read-only access
      * **Enterprise custom properties for organizations**: Read-only access

    For details, see the GitHub docs on [Permissions required for GitHub Apps](https://docs.github.com/en/enterprise-cloud@latest/rest/authentication/permissions-required-for-github-apps).
  </Step>

  <Step>
    In the **Where can this app be installed?** section of the page, choose **Only on this account**. This limits the app's scope to the GitHub Enterprise organization you've set it up on.
  </Step>

  <Step>
    Click **Create GitHub App**. The app is created.
  </Step>

  <Step>
    On the app's details page, carefully copy and save the **App ID**.
  </Step>

  <Step>
    Scroll down to the **Private keys** section of the app's page and click **Generate a private key**.
  </Step>

  <Step>
    Carefully save the private key file.
  </Step>

  <Step>
    Finally, install the new app on your GitHub organization. Navigate to **Developer Settings** > **GitHub Apps**.
  </Step>

  <Step>
    Find your app and click **Edit** > **Install App**.
  </Step>

  <Step>
    Click **Install** next to the GitHub organization where you want to install the app.
  </Step>

  <Step>
    Select the repositories the app can act on.
  </Step>

  <Step>
    Click **Install**.
  </Step>
</Steps>

**Done.** Next, move on to the connector configuration instructions.

## Configure the GitHub Enterprise connector

<Warning>
  To complete this task, you'll need:

  * The **Connector Administrator** or **Super Administrator** role in C1
  * Access to the set of GitHub Enterprise credentials generated by following the instructions above
</Warning>

<Tabs>
  <Tab title="Cloud-hosted">
    **Follow these instructions to use a built-in, no-code connector hosted by C1.**

    <Steps>
      <Step>
        In C1, navigate to **Integrations** > **Connectors** and click **Add connector**.
      </Step>

      <Step>
        Search for **GitHub Enterprise** and click **Add**.
      </Step>

      <Step>
        Choose how to set up the new GitHub Enterprise connector:

        * Add the connector to a currently unmanaged app (select from the list of apps that were discovered in your identity, SSO, or federation provider that aren't yet managed with C1)

        * Add the connector to a managed app (select from the list of existing managed apps)

        * Create a new managed app
      </Step>

      <Step>
        Set the owner for this connector. You can manage the connector yourself, or choose someone else from the list of C1 users. Setting multiple owners is allowed.

        If you choose someone else, C1 will notify the new connector owner by email that their help is needed to complete the setup process.
      </Step>

      <Step>
        Click **Next**.
      </Step>

      <Step>
        Find the **Settings** area of the page and click **Edit**.
      </Step>

      <Step>
        If you're using a personal access token to set up the connector:

        1. Click **Personal access token**.

        2. In the **Instance URL** field, enter the URL of your GitHub Enterprise instance.

        3. Paste the token you generated into the **Personal access token** field.

        4. **Optional.** If you want to sync only specific organizations, enter the organizations' names in the **Organizations** field. If you do not specify specific organizations, C1 will sync all organizations.

        5. **Optional.** If you want to sync roles for only some enterprises, add the names of the enterprises in the **Enterprises to sync enterprise roles for** field.

        6. **Optional.** If you do not want to include archived repos in syncs, click to enable **Omit archived repositories**.
      </Step>

      <Step>
        If you're using a GitHub app to set up the connector:

        1. Click **GitHub app**.

        2. In the **Instance URL** field, enter the URL of your GitHub Enterprise instance.

        3. Enter your app ID into the **GitHub app ID** field.

        4. Click **Choose file** and upload your private key file.

        5. In the **Organization** field, enter the name of the GitHub organization associated with the GitHub app. **You must enter a single organization name in this field or the connector configuration will fail.**

        6. **Optional.** If you want to sync roles for only some enterprises, add the names of the enterprises in the **Enterprises to sync enterprise roles for** field.

        7. **Optional.** If you do not want to include archived repos in syncs, click to enable **Omit archived repositories**.
      </Step>

      <Step>
        Click **Save**.
      </Step>

      <Step>
        The connector's label changes to **Syncing**, followed by **Connected**. You can view the logs to ensure that information is syncing.
      </Step>
    </Steps>

    **Done.** Your GitHub Enterprise connector is now pulling access data into C1.
  </Tab>

  <Tab title="Self-hosted">
    **Follow these instructions to use the GitHub Enterprise connector, hosted and run in your own environment.**

    <Warning>
      Self-hosted deployment requires **baton-github-enterprise v0.0.4 or later**. Earlier versions fail to register with C1 when deployed in minimal container environments (for example, Debian Bookworm slim on Kubernetes) due to missing OS info fallbacks.
    </Warning>

    <Warning>
      To complete this task, you'll need:

      * The **Connector Administrator** or **Super Administrator** role in C1
      * A **Client ID** and **Client Secret** from C1 (navigate to **Settings** > **API Credentials** to generate these)
      * Access to the GitHub Enterprise credentials generated by following the instructions above
    </Warning>

    ### Option 1: Use a personal access token (classic)

    <Steps>
      <Step>
        Download the latest `baton-github-enterprise` binary from the [releases page](https://github.com/conductorone/baton-github-enterprise/releases), or install via Homebrew:

        ```bash theme={"theme":{"light":"css-variables","dark":"css-variables"}}
        brew install conductorone/baton/baton conductorone/baton/baton-github-enterprise
        ```
      </Step>

      <Step>
        Run the connector with the following environment variables:

        ```bash theme={"theme":{"light":"css-variables","dark":"css-variables"}}
        BATON_CLIENT_ID=<your-c1-client-id> \
        BATON_CLIENT_SECRET=<your-c1-client-secret> \
        BATON_TOKEN=<your-github-pat> \
        BATON_INSTANCE_URL=<your-github-enterprise-url> \
        baton-github-enterprise
        ```

        **Optional environment variables:**

        | Variable                           | Description                                                                              |
        | :--------------------------------- | :--------------------------------------------------------------------------------------- |
        | `BATON_ORGS`                       | Comma-separated list of organizations to sync. If not set, all organizations are synced. |
        | `BATON_ENTERPRISES`                | Comma-separated list of enterprises to sync enterprise roles for.                        |
        | `BATON_OMIT_ARCHIVED_REPOSITORIES` | Set to `true` to exclude archived repositories from syncs.                               |
        | `BATON_PROVISIONING`               | Set to `true` to enable provisioning and deprovisioning.                                 |
        | `BATON_SYNC_SECRETS`               | Set to `true` to sync secrets (API keys).                                                |
      </Step>

      <Step>
        The connector connects to your C1 tenant and begins syncing. Verify it appears as **Connected** in **Integrations** > **Connectors**.
      </Step>
    </Steps>

    ### Option 2: Use a GitHub App

    <Steps>
      <Step>
        Download the latest `baton-github-enterprise` binary from the [releases page](https://github.com/conductorone/baton-github-enterprise/releases).
      </Step>

      <Step>
        Run the connector with the following environment variables:

        ```bash theme={"theme":{"light":"css-variables","dark":"css-variables"}}
        BATON_CLIENT_ID=<your-c1-client-id> \
        BATON_CLIENT_SECRET=<your-c1-client-secret> \
        BATON_INSTANCE_URL=<your-github-enterprise-url> \
        baton-github-enterprise \
          --app-id <your-github-app-id> \
          --app-privatekey-path /path/to/private-key.pem \
          --orgs <your-github-org>
        ```

        <Tip>
          **The `--orgs` flag is required when using a GitHub App.** GitHub Enterprise APIs do not support GitHub App tokens for multiple organizations; a single organization must be specified.
        </Tip>

        **Optional flags:**

        | Flag                           | Description                                                       |
        | :----------------------------- | :---------------------------------------------------------------- |
        | `--enterprises`                | Comma-separated list of enterprises to sync enterprise roles for. |
        | `--omit-archived-repositories` | Exclude archived repositories from syncs.                         |
        | `--provisioning`               | Enable provisioning and deprovisioning.                           |
      </Step>

      <Step>
        The connector connects to your C1 tenant and begins syncing. Verify it appears as **Connected** in **Integrations** > **Connectors**.
      </Step>
    </Steps>

    ### Docker / Kubernetes

    You can also run the connector as a container:

    ```bash theme={"theme":{"light":"css-variables","dark":"css-variables"}}
    docker run --rm \
      -e BATON_CLIENT_ID=<your-c1-client-id> \
      -e BATON_CLIENT_SECRET=<your-c1-client-secret> \
      -e BATON_TOKEN=<your-github-pat> \
      -e BATON_INSTANCE_URL=<your-github-enterprise-url> \
      ghcr.io/conductorone/baton-github-enterprise:latest
    ```

    <Tip>
      When deploying on Kubernetes with a minimal base image (for example, Debian slim), use image tag `v0.0.4` or later. Earlier versions fail to register in environments where `/etc/os-release` is absent or incomplete.
    </Tip>
  </Tab>
</Tabs>

## Troubleshooting

### "Resource not accessible by integration" error

If you see this error during sync, it most commonly means the GitHub App is missing the **Organization administration: Read-only** permission.

This permission is required because the connector queries GitHub's GraphQL API to check whether your organization has SAML/SSO configured. GitHub restricts this data to apps with organization admin read access. Without it, the sync will fail.

**To fix:** Go to your GitHub App settings, then navigate to **Permissions** > **Organization permissions** > **Administration** and set it to **Read-only**.
