Linking Gitea as a 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:repositoryandread:issuescopes.
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
- In PostHog, go to the Sources tab of the data pipeline section.
- Click + New source and click Link next to this source.
- Enter your credentials (see Configuration below) and click Next.
- 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:
- Instance URL: your Gitea host, e.g.
https://gitea.example.com. - Access token: the token created above.
- 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_attimestamp). 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:
- Go to your repository's Settings > Webhooks on your Gitea instance
- Click Add webhook and choose Gitea
- Paste the webhook URL shown during setup into the Target URL field
- Set HTTP method to POST and POST content type to application/json
- Enter a Secret and add the same value to the Signing secret field in PostHog
- Under Trigger on, choose Custom events and tick Issues and Pull request
- Click Add webhook
Configuration
| Option | Type | Required |
|---|---|---|
Instance URL | text | Yes |
Access token | password | Yes |
Repository | text | Yes |
Supported tables
| Table | Description | Sync method | Incremental field | Primary key |
|---|---|---|---|---|
issues | Issues opened in the repository, excluding pull requests. | Webhook, Incremental, Full refresh | updated_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 refresh | created | — |
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.