Sourcebot can sync code from GitHub.com, GitHub Enterprise Server, and GitHub Enterprise Cloud. If you’re not familiar with Sourcebot connections, please read that overview first.

Examples

Authenticating with GitHub

In order to index private repositories, you’ll need to generate a access token and provide it to Sourcebot. GitHub provides two types of access tokens:

Fine-grained personal access tokens

Next, provide the access token via the token property, either as an environment variable or a secret:
Environment variables are only supported in a declarative config and cannot be used in the web UI.
  1. Add the token property to your connection config:
{
    "type": "github",
    "token": {
        // note: this env var can be named anything. It
        // doesn't need to be `GITHUB_TOKEN`.
        "env": "GITHUB_TOKEN"
    }
    // .. rest of config ..
}
  1. Pass this environment variable each time you run Sourcebot:
docker run \
    -e GITHUB_TOKEN=<PAT> \
    /* additional args */ \
    ghcr.io/sourcebot-dev/sourcebot:latest

Connecting to a custom GitHub host

To connect to a GitHub host other than github.com, provide the url property to your config:
{
    "type": "github",
    "url": "https://github.example.com"
    // .. rest of config ..
}

Schema reference