Skip to main content
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 authenticate with GitHub. Sourcebot supports the following mechanisms of authenticating a GitHub connection:
only available in a paid plan. Please activate a license key to use this feature.
1

Register a new GitHub App

Register a new GitHub App and provide it with the following permissions:
  • “Contents” repository permissions (read)
  • “Metadata” repository permissions (read)
  • “Members” organization permissions (read)
  • “Email addresses” account permissions (read)
This can be the same GitHub App you’ve registered and configured as an external identity provider
2

Install the GitHub App

Install the GitHub App into the GitHub orgs that you want Sourcebot to be aware of. Sourcebot will only be able to index repos from orgs with the GitHub App installed.
3

Create a private key for the GitHub App

Create a private key for the GitHub App.
4

Define the GitHub App config in Sourcebot

Create a new apps object in the Sourcebot config file. The private key you created in the previous step must be passed in as a token.
5

You're done!

That’s it! Sourcebot will now use this GitHub App to authenticate when pulling repos for this connection.
1

Create PAT

Create a new fine-grained PAT here. Select the resource owner and the repositories that you want Sourcebot to have access to.Next, under “Repository permissions”, select permissions Contents and Metadata with access Read-only. The permissions should look like the following:GitHub PAT ScopeGitHub docs
2

Pass PAT into Sourcebot

Next, provide the PAT via a token which is referenced in the token field in the connection config object.The most common mechanism of doing this is defining an environment variable that holds the PAT:
3

You're done!

That’s it! Sourcebot will now use this PAT to authenticate when pulling repos for this connection.
1

Create PAT

Create a new PAT here and make sure you select the repo scope:GitHub PAT ScopeGitHub docs
2

Pass PAT into Sourcebot

Next, provide the PAT via a token which is referenced in the token field in the connection config object.The most common mechanism of doing this is defining an environment variable that holds the PAT:
3

You're done!

That’s it! Sourcebot will now use this PAT to authenticate when pulling repos for this connection.

Connecting to a custom GitHub host

To connect to a GitHub host other than github.com, provide the url property to your config:

Schema reference

schemas/v3/github.json

See also