> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.pensar.dev/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.pensar.dev/_mcp/server.

# GitHub Enterprise Server

> Connect your self-hosted GitHub Enterprise Server to Pensar Console

# GitHub Enterprise Server Integration

Pensar Console supports integration with self-hosted GitHub Enterprise Server instances, allowing you to scan and secure repositories hosted on your own infrastructure.

## Prerequisites

Before configuring the GitHub Enterprise Server integration, you'll need:

1. **Administrator access** to your GitHub Enterprise Server instance
2. **A GitHub App** created on your Enterprise Server
3. The following credentials from your GitHub App:
   * App ID
   * Client ID
   * Client Secret
   * Private Key (PEM format)

## Creating a GitHub App

To create a GitHub App on your GitHub Enterprise Server:

1. Navigate to your GitHub Enterprise Server's settings

2. Go to **Developer Settings** → **GitHub Apps** → **New GitHub App**

3. Fill in the **Basic information**:
   * **GitHub App name**: `Pensar` (or your preferred name)
   * **Homepage URL**: `https://console.pensar.dev`

4. Configure **Post installation** settings:
   * **Setup URL**: `https://console.pensar.dev/integrations/github/enterprise/redirect`
   * ✅ Check **Redirect on update** - This ensures users are redirected when the installation is modified

> **Note**
>
> The Setup URL uses the dedicated Enterprise redirect endpoint to ensure the installation is correctly saved to your Enterprise Server configuration.

5. Configure **Webhook** (optional):
   * Uncheck **Active** if you don't need webhooks, or
   * Set **Webhook URL** to your preferred endpoint if you want to receive events

6. Set the following **Repository permissions**:
   * **Contents**: Read & Write
   * **Pull requests**: Read & Write
   * **Checks**: Read & Write
   * **Actions**: Read & Write

7. Under **Where can this GitHub App be installed?**, select the appropriate option for your organization

8. Click **Create GitHub App**

9. After creation, note down these values from the app settings page:
   * **App ID** - displayed at the top of the page
   * **Client ID** - displayed below the App ID
   * Click **Generate a new client secret** and save it securely
   * Scroll to **Private keys** and click **Generate a private key** - download the PEM file

## Configuring in Pensar Console

1. Navigate to **Settings** → **Integrations** → **Source control** in your Pensar Console workspace

2. Find the **GitHub** row

3. Expand the **GitHub Enterprise Server** collapsible

4. Enter your configuration:
   * **Server Hostname**: Your GitHub Enterprise Server hostname (e.g., `github.yourcompany.com`)
   * **App ID**: The App ID from your GitHub App
   * **Client ID**: The Client ID from your GitHub App
   * **Client Secret**: The Client Secret you generated
   * **Private Key**: Paste the contents of the PEM file

5. Click **Save Configuration**

> **Note**
>
> The Client Secret and Private Key are encrypted before being stored and are never exposed in plain text.

## Installing the App

After saving the configuration, the GitHub Enterprise Server card shows that the app is configured but **not yet installed**. You now need to install the GitHub App on your organization or repositories:

1. In the **GitHub Enterprise Server** section (Settings → Integrations → Source control → GitHub row → GitHub Enterprise Server collapsible), click the **Install GitHub App** link
2. This opens the Pensar app installation flow at `/integrations/github/enterprise`, which redirects you to your Enterprise Server's installation page
3. Select the organization or user account where you want to install the app
4. Choose to install on all repositories or select specific ones
5. Click **Install**
6. You'll be automatically redirected back to Pensar Console and the installation will be saved

> **Note**
>
> The installation process uses the same flow as GitHub Cloud. Make sure your GitHub App's **Setup URL** is set to `https://console.pensar.dev/integrations/github/enterprise/redirect` and **Redirect on update** is enabled.

## Adding Repositories

After the app is installed, attach repositories directly to your workspace:

1. Go to **Attack Surface** → **Repositories** in Pensar Console
2. Click **Add repository**
3. Your GitHub Enterprise Server repositories appear in the picker — select one or more
4. Click **Attach & continue**

Each repository you attach is connected to the workspace and **recon / attack-surface analysis launches automatically** — there is no separate project to create.

## Troubleshooting

### Connection Issues

If you're experiencing connection issues:

1. Verify your GitHub Enterprise Server is accessible from the internet (or configure appropriate network access)
2. Ensure the hostname is correct and doesn't include `https://`
3. Check that your GitHub App credentials are correct

### Permission Errors

If you see permission errors when scanning:

1. Verify the GitHub App has the required permissions listed above
2. Ensure the app is installed on the repository you're trying to scan
3. Check that the installation hasn't been suspended

### Certificate Issues

If you're using a self-signed certificate:

Contact Pensar support to discuss options for connecting to GitHub Enterprise Servers with custom certificates.

## Security Considerations

* All sensitive credentials (Private Key, Client Secret) are encrypted before storage and are never exposed in plain text
* Communication with your GitHub Enterprise Server uses HTTPS
* Access tokens are short-lived and refreshed automatically

## Need Help?

If you encounter issues setting up your GitHub Enterprise Server integration, please contact our support team at [team@pensar.dev](mailto:team@pensar.dev).