> AI agents: this is one page from PostHog's docs. Full index of Markdown docs for LLMs: https://posthog.com/llms.txt

# Linking Gitea as a source - Docs

Copy page

# Linking Gitea as a source - Docs

![](https://res.cloudinary.com/dmukukwp6/image/upload/texture_tan_9608fcca70)

![](https://res.cloudinary.com/dmukukwp6/image/upload/texture_tan_dark_a92b0e022d)

Let AI connect your sources for you

Skip the manual setup — run this in your project and the wizard auto-detects your databases and APIs and connects them to PostHog.

`npx @posthog/wizard warehouse`

[Learn more](/wizard.md)

![PostHog Wizard hedgehog](https://res.cloudinary.com/dmukukwp6/image/upload/wizard_3f8bb7a240.png)

![](https://res.cloudinary.com/dmukukwp6/image/upload/wizard_3f8bb7a240.png)Let AI connect your sources for you

**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](https://app.posthog.com/data-management/sources) of the data pipeline section.
2.  Click **\+ New source** and click **Link** next to this source.
3.  Enter your credentials (see [Configuration](#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](/docs/cdp/sources.md#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

| 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](/docs/data-warehouse/troubleshooting.md). If that doesn't help, [contact support](https://us.posthog.com/#panel=support%3Asupport%3Adata_warehouse%3A%3Atrue) – we're happy to help.

### Was this page useful?

HelpfulCould be better