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

# GitHub

> Connect GitHub to Deductive AI to enable reasoning over your github data.

# GitHub

Deductive supports GitHub in two ways:

1. `GitHub` for GitHub App-based access on `github.com`
2. `GitHub PAT` for Personal Access Token-based access on `github.com` or GitHub Enterprise Server

## If you use GitHub.com

If your code is hosted on `github.com`, the recommended setup is to install the Deductive GitHub App on your organization or repository.

You do not need to create and paste a Personal Access Token for this setup.

### How it works

* Install the Deductive GitHub App
* Approve access to the organization or repositories you want Deductive to read
* Deductive uses the app installation to access your code, pull requests, and commit history

### When to use this

Use this option if your repositories live on standard GitHub Cloud at `github.com`.

## If you want to connect with a Personal Access Token

Use `GitHub PAT` when:

* Your repositories are hosted on a self-managed GitHub Enterprise Server instance
* You want to use a GitHub Personal Access Token instead of a GitHub App
* You want to connect private repositories using token-based credentials

This option supports both:

* `github.com`
* Self-hosted GitHub Enterprise Server hostnames

### What you need

Provide:

* Your GitHub hostname, such as `github.com` or `github.yourcompany.com`
* A Personal Access Token with `repo` scope

Do not include `https://` or a trailing slash in the hostname field.

### How to set it up

1. Open `GitHub PAT` from integrations page
2. Enter your GitHub hostname
3. Create a Personal Access Token in GitHub
4. Grant the token `repo` scope so Deductive can access private repositories
5. Paste the token into the `Personal Access Token` field
6. Save the integration

### Test connection behavior

The PAT integration includes a test connection flow.

When you test the connection, Deductive:

* Validates the stored hostname and token
* Connects to the configured GitHub instance
* Lists repositories accessible to that token
* Shows whether the connection succeeded and which repositories were found

If the token is valid but cannot access any repositories, the integration can still authenticate successfully, but no accessible repositories will be listed.

## Which one should I choose?

* Use `GitHub` if you want the standard GitHub App setup on `github.com`
* Use `GitHub PAT` if you want PAT-based access
* Use `GitHub PAT` for self-hosted GitHub Enterprise Server

## Summary

There are only two real cases:

1. `github.com` with GitHub App: use `GitHub`
2. `github.com` or self-hosted GitHub with a PAT: use `GitHub PAT`

## How to create a Personal Access Token

1. Log in to your GitHub instance
2. Go to Settings > Developer settings > Personal access tokens
3. Click `Generate new token`
4. Grant the token `repo` scope
5. Copy the generated token
6. Paste it into Deductive

**Related Documentation**: [GitHub: Managing your personal access tokens](https://docs.github.com/en/enterprise-server/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens)

## Field Reference

The following fields are used when configuring this integration:

* **GitHub Hostname** (`hostname`)
* **Personal Access Token** (`pat`)
