Connect a GitHub repository to index *.md, *.mdx, *.rst and *.txt files plus READMEs — ideal for docs-as-code, architecture decision records, and changelogs.
This is the repository’s files. For the conversation on it — issues, pull requests, discussions — see GitHub Issues, Pull Requests & Discussions.

Data ingested

When you connect a repository, BeforeQuery indexes every .md, .mdx, .rst and .txt file on the branch:
  • File URL — the GitHub blob link for that path on that branch, which is what citations open
  • Title, from the file’s first markdown heading and falling back to its filename
  • File content as markdown
  • Path within the repository, so docs/auth.md and sdk/auth.md stay two documents
Only these file types are read — source code, images and config files are not indexed.

Set up a repository source

1

Create an access token (private repos only)

Public repositories need no credentials. For a private repo, create a read-only token: a classic PAT with the repo scope, or a fine-grained token with Contents: Read on the repository.
2

Add the source

In the dashboard, open Knowledge Base → Sources → Add source and choose GitHub. Fill in:
3

Save the webhook secret

When the source is created, BeforeQuery shows a webhook URL and webhook secret — copy them now (the secret is used for push-triggered sync below). The first sync starts automatically.

Sync on every push

Add a webhook in your repo settings so pushes trigger incremental reindexing — only changed files are re-processed. In the repo, go to Settings → Webhooks → Add webhook:
  • Payload URL: the webhook URL shown at source creation (…/webhooks/sources/github/<sourceId>)
  • Content type: application/json
  • Secret: the source’s webhook secret
  • Events: push
BeforeQuery verifies the X-Hub-Signature-256 HMAC on every delivery. No webhook? The repository is re-fetched every hour anyway. There is no schedule to configure; the webhook is what makes a push land sooner than the next hourly run, and Sync on the source’s page runs one on demand. See Sources Overview.

Versioned docs from branches

To serve version-scoped answers (e.g. v1 vs v2 docs), add one source per branch and set a version label on each. Combined with source groups, a widget or API caller can be scoped to exactly one version.

Troubleshooting

  • Files missing from the index? Only markdown-family files are indexed — and check your include paths aren’t excluding them.
  • Webhook deliveries failing? The secret in your repo settings must match the source’s webhook secret exactly; re-check for whitespace.
  • Private repo sync failing? The token expired or lost read scope — rotate it and update the source.