Linking Gitea as a source

Alpha source

The Gitea source is currently in alpha. If you run into issues, please let us know.

The Gitea connector syncs repository data from your self-hosted Gitea (or Forgejo) instance – issues, pull requests, commits, releases, labels, and milestones – into PostHog, so you can analyze engineering activity alongside your product data.

Prerequisites

You need:

  • A Gitea instance reachable over HTTPS from the internet. Plain http:// instance URLs are not supported.
  • An access token with read access to the repository you want to sync. Create one on your instance under Settings > Applications > Manage access tokens with the read:repository and read:issue scopes.

To let PostHog create the real-time webhook automatically, the token also needs admin access to the repository. This is optional – you can set the webhook up manually, or skip webhooks entirely and rely on scheduled syncs.

Adding a data source

  1. In PostHog, go to the Sources tab of the data pipeline section.
  2. Click + New source and click Link next to this source.
  3. Enter your credentials (see Configuration below) and click Next.
  4. Select the tables you want to sync, choose a sync method and frequency, then click Import.

Once the syncs are complete, you can start querying this data in PostHog.

When linking Gitea, provide:

  1. Instance URL: your Gitea host, e.g. https://gitea.example.com.
  2. Access token: the token created above.
  3. Repository: the repository to sync, in the format owner/repo.

Sync modes

Each table can be synced in one of several modes, depending on what the source supports:

  • Webhook (when available) – the source pushes changes to PostHog in real time. Fastest freshness, lowest ongoing cost, and the only mode that reliably captures updates and deletes.
  • Incremental – only new or updated rows are synced on each run, using a cursor field (such as an updated_at timestamp). Cheaper than a full refresh, but deletes aren't captured.
  • Append only – new rows are appended using a cursor field; existing rows are never updated. Ideal for immutable, append-only tables like event logs.
  • Full refresh – the whole table is reloaded on every sync. Use it when a table has no reliable cursor or when you need deletions reflected.

See sync methods for a full explanation of how each mode works and how to choose between them.

Issues and commits support incremental syncing: Gitea filters both server-side, so incremental syncs only fetch what changed since the last sync. Pull requests, releases, labels, and milestones don't expose a server-side filter in Gitea's API, so those tables use full refresh.

Webhooks

The issues and pull requests tables can be kept up to date in real time using a Gitea webhook instead of re-polling. PostHog attempts to create the webhook automatically; if your token lacks admin access to the repository, you can set it up manually:

  1. Go to your repository's Settings > Webhooks on your Gitea instance
  2. Click Add webhook and choose Gitea
  3. Paste the webhook URL shown during setup into the Target URL field
  4. Set HTTP method to POST and POST content type to application/json
  5. Enter a Secret and add the same value to the Signing secret field in PostHog
  6. Under Trigger on, choose Custom events and tick Issues and Pull request
  7. Click Add webhook

Configuration

OptionTypeRequired
Instance URLtextYes
Access tokenpasswordYes
RepositorytextYes

Supported tables

TableDescriptionSync methodIncremental fieldPrimary key
issues

Issues opened in the repository, excluding pull requests.

Webhook, Incremental, Full refreshupdated_at
pull_requests

Pull requests opened against the repository, in any state.

Webhook, Full refresh
commits

Commits on the repository's default branch.

Incremental, Full refreshcreated
releases

Releases published in the repository, including drafts and pre-releases.

Full refresh
labels

Issue and pull request labels defined in the repository.

Full refresh
milestones

Milestones defined in the repository, in any state.

Full refresh

Troubleshooting

If your sync is failing or data looks wrong, see the Data warehouse troubleshooting guide. If that doesn't help, contact support – we're happy to help.

Community questions

Was this page useful?