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

# Github

Teleskope scans your GitHub organizations, repositories, and files for secrets and other sensitive data. The connector supports both **GitHub Enterprise Cloud** (github.com) and **GitHub Enterprise Server** (a self-hosted instance at your own base URL), and you can add more than one connection.

{% hint style="info" %}
Teleskope is single-tenant: each customer has a dedicated instance with its own callback and setup URLs, which Teleskope provides.
{% endhint %}

There are two ways to connect. **Automatic** lets Teleskope create and configure the GitHub App for you and is recommended for most customers. **Manual** lets you create the App yourself and hand Teleskope its credentials.

{% tabs %}
{% tab title="Automatic (recommended)" %}
Teleskope creates a least-privilege GitHub App for you from a pre-filled manifest — no app IDs to copy and no private key to handle.

{% stepper %}
{% step %}

#### Start a connection in Teleskope

1. In Observatory, go to **Settings → Clouds → Github** and add a connection.
2. Give the connection a name (no spaces).
3. Choose where it points:
   1. **Enterprise Cloud** — leave the base URL as `https://github.com`.
   2. **Enterprise Server** — enter your GHES base URL (for example, `https://github.your-company.com`).
4. Start the automatic app creation. Teleskope opens GitHub in a new tab with the app already filled in.
   {% endstep %}

{% step %}

#### Create and install the app on GitHub

1. On the GitHub tab, review the pre-filled app and create it. It requests only the least-privilege scanning permissions: **Contents (read)** and **Metadata (read)**, unless you select **Allow remediation**.
2. Install the app on the organization(s) you want Teleskope to scan.

{% hint style="info" %}
You must be an organization **admin** to create and install the app on an organization.
{% endhint %}
{% endstep %}

{% step %}

#### Confirm the connection in Teleskope

1. Return to the Observatory tab and choose **Discover organizations** on the connection.
2. Scanning activates automatically once the connection is verified — there is no separate enroll step.
   {% endstep %}
   {% endstepper %}
   {% endtab %}

{% tab title="Manual (bring your own app)" %}
Create the GitHub App yourself and provide its credentials to Teleskope.

{% stepper %}
{% step %}

#### Create a GitHub App

**Requirements**

* **Admin user:** you must be an organization **admin** to create the app and install it on the org.
* **Setup URL:** Teleskope provides your dedicated setup URL.

**Create a new app in GitHub**

1. Go to your Developer settings: `https://<your-github-host>/settings/apps` (use your GHES host for Enterprise Server).
2. Select **GitHub Apps**, then **New GitHub App**.
3. Give your app a unique name and add an optional description.
   1. Avoid using spaces in the app name.
4. Use <https://teleskope.ai> as the homepage URL.
5. Enter your dedicated Teleskope Setup URL:
   1. <https://observatory.{baseURL}/settings/clouds/github?instance\\_name={connectionName}>
6. (Optional) Create a Webhook Secret.
7. Create a private key for the application and download the `.pem` file.

**Grant permissions in GitHub**

**Add the following repository permissions:**

* Contents (read, mandatory)
* Metadata (read-only, mandatory)
  {% endstep %}

{% step %}

#### Enroll the connection in Teleskope

1. On <https://observatory.{baseURL}/settings/clouds/github>, add a connection.
2. Enter your app's:
   1. Connection Name (must match the `instance_name` in the Setup URL above)
   2. Base URL — `https://github.com` for Enterprise Cloud, or your GHES base URL for Enterprise Server
   3. App name
   4. App ID
   5. Github App Private Key — upload the `.pem` file directly (the field is masked; use show/hide to check it)
3. Submit the connection, then follow the prompt to install the app on GitHub and return to Observatory.
4. Choose **Discover organizations** on the connection. Scanning activates automatically once the connection is verified.
5. Delete your local Private Key .pem file.
   {% endstep %}
   {% endstepper %}
   {% endtab %}
   {% endtabs %}

{% hint style="warning" %}
**GitHub Enterprise Server reachability:** Teleskope connects to your GHES instance over the public internet. The server must resolve to a publicly routable address — for example, behind a reverse proxy that Teleskope can reach. A server on a private or CGNAT address fails with: `github: refusing to connect to non-public address`.
{% endhint %}

***

## Restrict Link Access — Make Repository Private

The **Restrict link access** action in Policy Maker makes a public or internal GitHub repository private. In the policy editor, its settings panel is titled **Update shared link access**. When you run it manually on a finding, it appears as **Restrict shared link**. When a policy using this action matches a finding, the repository is made private — every file in that repository is affected, not just the file that triggered the finding. Review which repositories a policy matches before you enable it. The action runs automatically when a policy matches. There is no separate approval step.

Making the repository public again in GitHub does not restore its stars and watchers.

{% hint style="warning" %}
When a repository is made private, GitHub erases its stars and watchers (which affects its public ranking), detaches existing forks so they stay public independently, and unpublishes any GitHub Pages site. See [Setting repository visibility](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/managing-repository-settings/setting-repository-visibility) for details.
{% endhint %}

Repositories that are already private are skipped without error. For archived repositories and forks, the action reports an error and doesn't change the repository.

For GitHub, the only sharing level is Restricted, so the policy editor doesn't show a sharing-level choice. When you run the action manually on a finding, Restricted is the only option.

### Permission required

This action requires the **Administration (write)** repository permission on your GitHub App ([GitHub App permissions reference](https://docs.github.com/en/rest/authentication/permissions-required-for-github-apps)). This permission is broader than scanning needs — it also allows deleting repositories, managing branch protection rules, deploy keys, collaborators, and environment secrets. Grant it only if you intend to use this action.

Scanning alone needs only Contents (read) and Metadata (read).

Creating a policy that uses this action requires the **Create and edit policies** permission.

### Granting the permission

**New connections (Automatic flow):** Select **Allow remediation (make public or internal repositories private)** before you continue to GitHub.

**Existing connections:** If your app was created without Administration (write), add it manually:

1. In GitHub, navigate to your app's settings. The path depends on who owns the app:
   * **Organization-owned app:** Click your profile picture → **Your organizations** → **Settings** next to the organization → **Developer settings** → **GitHub Apps** → **Edit** next to your app.
   * **User-owned app:** Click your profile picture → **Settings** → **Developer settings** → **GitHub Apps** → **Edit** next to your app.
2. In the app settings sidebar, click **Permissions & events**.
3. Under **Repository permissions**, set **Administration** to **Read and write** and save.
4. GitHub notifies each organization where the app is installed. An organization **admin** must approve the updated permissions before the new permission takes effect on that organization's repositories.

**New connections (Manual flow):** Add **Administration (read and write)** to the repository permissions when you create the app. See the [Create a GitHub App](#create-a-github-app) step.

### Ad-hoc use

To run **Restrict shared link** manually on a finding, a user's role must include the **Update shared link access** permission.

### Troubleshooting

| Symptom                                                                                                                                                                                         | Cause                                                                                                   | Action                                                                                                                   |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ |
| Action fails with "GitHub refused to make \[repo] private: the GitHub App (or PAT) needs the Administration (write) repository permission, or an organization policy blocks visibility changes" | The GitHub App is missing Administration (write), or an organization policy prevents visibility changes | Grant Administration (write) as described above, and confirm no organization policy blocks repository visibility changes |
| Action reports that the repository was not found or is not visible to the GitHub App                                                                                                            | The GitHub App is not installed on the repository's organization                                        | Install the GitHub App on the organization that contains the repository                                                  |
