# Git integration: GitHub, GitLab and Gitea

How to connect Truetask to GitHub, GitLab or Gitea, link repositories to boards, map git accounts to people, and set how task branches are named.

URL: https://docs.truetask.io/git/

Truetask connects to GitHub, GitLab and Gitea and mirrors a repository's pull requests, issues, commits, reviews and CI results next to the tasks they belong to.
A workspace owner or admin connects the provider once and links repositories to boards, and each person can then sign in with their own account, so the reviews, comments and pull requests they make from Truetask post as them.

## What you get

Once a repository is linked to a board:

- The board gets a [Code view](https://docs.truetask.io/git/code-view) listing the repository's pull requests and issues, grouped by the task they belong to.
- Every task on the board gets a **Code** sheet for its [branch, issues and pull requests](https://docs.truetask.io/git/tasks), and a branch name to copy.
- Merging a linked pull request or closing a linked issue completes the task, and completing a task can close its issues.
- Pull requests can be [reviewed inside Truetask](https://docs.truetask.io/git/code-review), and the **Reviews** page collects the ones waiting on you across every board.
- Comments on linked issues and pull requests show in the task's Team conversation and notify its members.
- Any task or pull request opens in your [coding tool](https://docs.truetask.io/git/coding-tools) with the repository, branch and task loaded.
- Git events can start [automations](https://docs.truetask.io/automations/triggers), and a starter set is offered when you link.
- [AI agents work alongside people](https://docs.truetask.io/agents/) on the same pull requests and issues through the git tools in [MCP](https://docs.truetask.io/agents/mcp), so an agent's branch, pull request and review land on its task like anyone else's.

## Providers

| Provider | What the connect steps reach |
| --- | --- |
| GitHub | github.com |
| GitLab | gitlab.com |
| Gitea | Your own Gitea server, at the **Server URL** you enter |

## Who does what, and where

| Who | Where | What |
| --- | --- | --- |
| Workspace owner or admin | The provider's card in the Integrations dialog | Connects the provider, links repositories to boards, maps people, checks the connection, swaps the token, requires personal accounts |
| Workspace owner or admin | **Settings > Integrations > Git** | Sets the rule for merged task branches and the branch name format |
| Anyone on the board | The board's Code view and each task's **Code** sheet | Works with pull requests, issues and branches |
| Everyone | **{Provider} account** in the avatar menu | Signs in with their own account on the provider |

See [Roles and permissions](https://docs.truetask.io/reference/roles).

## Connect a provider

Open the **App menu** (the grid button before your avatar) and choose **Integrations** under **Extend**.
The **GitHub**, **GitLab** and **Gitea** cards sit under **Code**.

Two other doors lead to the same cards: **Connect a provider** in **Settings > Integrations > Git**, and **Connect a provider** on a board's Code view before anything is linked.
Both open Integrations with the filter set to `git`, so only the three git cards show.

![Truetask Integrations dialog filtered to git, with the GitHub, GitLab and Gitea cards under Code](https://docs.truetask.io/screenshots/integrations-git-cards.webp)

Only a workspace owner or admin opens these cards.
Everyone else sees whether a provider is connected, and a line under the grid says to ask an admin.

A card walks you through its steps, with a strip at the top naming them: **Method**, **OAuth app** and **Authorize** for OAuth, or **Method** and **Token** for a token.
Connecting a provider also turns it on for the workspace.

### Choose a method

**How do you want to connect?** offers two ways.

| Method | What it is |
| --- | --- |
| **OAuth** (**Recommended**) | Sign in through your provider with an OAuth app you register on your own account. The credentials and tokens stay yours, and the same app lets every member sign in as themselves later. |
| **Token** | Paste a personal access token instead. |

On the Gitea card, enter your **Server URL** first, for example `https://git.example.com`.
Then choose **Continue**.

![Truetask GitHub card on its Method step, asking How do you want to connect? with OAuth recommended and Token](https://docs.truetask.io/screenshots/git-connect-method.webp)

### OAuth: register your own app

The **OAuth app** step asks for the app's credentials: **Client ID** and **Client secret**, or **Application ID** and **Secret** on GitLab.

Under **Register an OAuth app**, **Register on {Provider}** opens the provider's form for a new app.
The step lists every value that form asks for, each with an info glyph saying why, and a copy button on the callback address.
Every provider names the fields differently, and the step uses each provider's own words.

![Truetask GitLab card on its OAuth app step, with Application ID and Secret and the Register an OAuth app values](https://docs.truetask.io/screenshots/git-oauth-app.webp)

| On the provider's form | GitHub | GitLab | Gitea |
| --- | --- | --- | --- |
| The callback | **Authorization callback URL** | **Redirect URI** | **Redirect URI** |
| **Homepage URL** | Your workspace's address | Not asked | Not asked |
| Scopes | Not on the form | **Recommended scopes**: tick `api` and `read_user` | Not on the form |
| **Confidential** or **Confidential Client** | Not asked | On | On |
| **Enable Device Flow** or **Device authorization grant** | Off | Off | Not asked |

The callback is `<your workspace address>/v1/git/oauth/<provider>/callback`, for example `https://tasks.example.com/v1/git/oauth/github/callback`, and it has to match exactly.
GitHub and Gitea ask for their scopes when you sign in instead: `repo read:org read:user` on GitHub and `read:user write:repository write:issue` on Gitea.

Paste the app's credentials and choose **Save & continue**.
The **Authorize** step then reads **OAuth app configured**; choose **Connect with {Provider}** and approve Truetask on the provider.
The provider sends you back to Truetask, on the provider's page in Integrations.

The app is kept apart from the connection, so it survives a disconnect.
**Reconfigure** edits it, and **Remove** deletes it for a clean slate.

### Or paste a token

The **Token** step takes an **Access token**.
Truetask checks it against the provider before it saves anything, stores it encrypted, and never shows it to other users.

| Provider | **Required token permissions** |
| --- | --- |
| GitHub | A classic token with `repo` and `admin:repo_hook`, or a fine-grained token with read and write on Contents, Pull requests, Issues and Webhooks. |
| GitLab | A personal access token with the `api` scope. The account needs the Maintainer role to register the project webhook. |
| Gitea | A token with read and write on Repository and Issue, which covers code, pull requests and webhooks. |

Choose **Connect**, and the card opens on the provider's page.

## The provider's page

Once connected, the card reads **Connected** and opens on the provider's page, which holds everything about that connection.

| Part | What it shows |
| --- | --- |
| **Status** | **Connected**, **Error** or **Token revoked**. A failing connection also shows the provider's last error above. |
| **Account** | The provider account the workspace connected as. |
| **Server** | The server address, for a Gitea connection. |
| **Your account** | **Linked as {login}** once you signed in with your own account, or **Not linked yet**. |
| **Next steps** | What is still to do, with a link to do it: sign in with your own account, and link a repository to a board. |
| **Linked repositories** | Each repository linked through this connection, with its board and folder path, whether its webhook is active, and **Unlink**. **Link a repository** adds another. |
| **Team mapping** | Which member each git account is. It appears once a repository is linked. See [Map people to git accounts](https://docs.truetask.io/git/#map-people-to-git-accounts). |
| **Require personal accounts** | The workspace policy for git write-backs. See [Your own git account](https://docs.truetask.io/git/#your-own-git-account). |

When the workspace has more than one connection to the same provider, a row at the top of the page picks which one you are looking at.

### Keep a connection healthy

The page's footer carries three actions.

| Action | What it does |
| --- | --- |
| **Check connection** | Checks the stored credential with the provider now and updates the connection's status. |
| **Change token** | Swaps the access token in place: linked repositories, team mapping and automations stay as they are. On Gitea you can also move the **Server** address in the same step. When the provider refused the token, this is the page's main action. |
| **Disconnect** | Asks first, then removes the connection. Its linked repositories unlink, their automations stop, and members' own sign-ins on it go too. |

Truetask also checks every connection every 30 minutes.
A connection that stopped working puts **Needs attention** on its card in Integrations and **Error** or **Token revoked** on its row in **Settings > Integrations > Git**.

If the git host's address changes, Truetask checks the stored token against the new address and carries on by itself.
When that check fails, a toast says the connection is blocked and offers **Renew token**, which opens **Change token** on the right connection.
A board's Code view shows **Renew token** in its header too, while its connection is down.

## Link a repository to a board

Linking happens in the **Connect a repository** dialog, on its **Link** step.
You reach it from:

| Where | How |
| --- | --- |
| The provider's page | **Link a repository** in **Linked repositories**, or the link in **Next steps** |
| A board's Code view | **Link a repository**, before any repository is linked |
| The board's page menu | The dots next to the board title, then **Board setup > Link a repository**, once a provider is connected |

Opened from a board, the dialog is locked to that board.

1. When the workspace has several connections, pick the **Connection** to link from.
2. Pick the **Repository**: search by name, and each row shows its default branch, language, last update, and whether it is **Private**, **Archived** or a **Fork**.
3. Pick the **Board**: search by name or folder, and a green dot marks a board that already has a repository.
**Create board** makes a new board on the spot and picks it.
4. Review the **Recommended automations** below.
All five are on; switch off the ones you do not want.
5. Choose **Link**.

A workspace owner or admin can link any board, including one they are not a member of: linking only wires the repository to it.
One repository belongs to one board, and Truetask says so if you pick one that is linked elsewhere: unlink it there first.
A board can hold several repositories, and its Code view switches between them.

Linking then does three things at once:

- It registers the webhook on the provider, so events arrive as they happen.
- It pulls the repository's open pull requests and issues, and the toast says how many.
- It installs the automations you left on.

The dialog ends on **Repository linked**, with **Open board**, which opens the board's Code view, and **Link another**.
If the webhook could not be registered, the toast says so; the repository still works, and the next section covers the fallback.

### Recommended automations

| Automation | What it does |
| --- | --- |
| **PR opened** | Moves linked tasks to In progress when a pull request opens. |
| **Changes requested** | Keeps linked tasks in progress when a review requests changes. |
| **CI failed** | Comments on linked tasks when a commit or pull request status fails. |
| **Issue opened** | Creates a task when a git issue opens. |
| **Issue reopened** | Moves linked tasks back to Open when a git issue reopens. |

Once you pick a board, each line names the board's own list instead, such as "Move linked tasks to "Doing" when a pull request opens."
They are ordinary automations afterwards; turn them on or off, install or delete them under **Recommended automations** in the [repository settings](https://docs.truetask.io/git/code-view#repository-settings).
See [Automations](https://docs.truetask.io/automations/).

> **Truetask Cloud only**
>
> The recommended automations count toward your plan's active automations.
> See [Plans and billing](https://docs.truetask.io/cloud/plans).

### Unlink a repository

**Unlink** on the provider's page stops the repository's sync and removes its webhook from the provider.
The board keeps its tasks.

## Webhooks and sync

Truetask registers its webhook on the provider when you link a repository.
Pull request, issue, review, comment, push and CI events then arrive as they happen.

Each repository in **Linked repositories** shows **Webhook active** or **Webhook not registered**.
The webhook's status, the last event received, the callback address, **Test delivery** and **Re-register** live in the [repository settings](https://docs.truetask.io/git/code-view#webhook) in the Code view.

A repository without a working webhook is not stranded: Truetask polls those repositories every 15 minutes, backing off one that keeps failing.
**Sync** in the Code view pulls everything on demand.

> **Self-hosted only**
>
> The provider has to reach your server for webhooks, and the OAuth callback has to come back to it.
> Both are built from `PUBLIC_URL`, the address you set when you configured the stack, or else from the application URL in PocketBase's settings.
> With neither set, registration fails with "No public URL is set for this instance" and OAuth cannot start.
> See [Install](https://docs.truetask.io/self-hosted/install).
>
> A Gitea server on your own network works: the address you type is the one Truetask may reach, private or not.
> See [Network](https://docs.truetask.io/self-hosted/network).

> **Truetask Cloud only**
>
> Your workspace's own address is its OAuth callback and its webhook address, so there is nothing to set up before you connect.

## Map people to git accounts

**Team mapping**, on the provider's page, says which member each git account is.
It appears once the connection has a linked repository, because the accounts to map come from the activity Truetask has seen.

1. Pick a git account under **Pick a git user**: the list holds the accounts seen on this connection's pull requests, issues, commits and reviews that are not mapped yet.
2. Truetask fills in the member it matches by username or email, so the common case is one pick and **Map**.
Otherwise choose the member under **Pick a user**.
3. **Refresh users from Git** reloads the list after new activity, and the trash on a row is **Remove mapping**.

A member who signs in with their own account is mapped to it automatically.

Mapping is what makes git work read as people:

- Authors, reviewers, commenters and assignees show as the mapped member with their avatar, everywhere git work appears.
- The **Reviews** page finds the pull requests you wrote and the ones waiting on your review.
- A new issue from a task suggests the task's members as assignees.
- A comment from a mapped member does not notify that member.

**Auto-assign from PR author**, at the top of **Team mapping**, is per connection: when a pull request links to a task, its author's mapped member is added to the task.

## Your own git account

The workspace connection is shared, so until you sign in with your own account, the git actions you take in Truetask run as the workspace account.
Sign in once per provider so the reviews, comments, issues, branches and pull requests you make from Truetask post as you.

Open the avatar menu: it has one **{Provider} account** row for each provider your workspace connected, with a green check once you are signed in.
The dialog offers:

| Action | What it does |
| --- | --- |
| **Sign in with {Provider}** | Signs you in through the provider. Only offered when an admin connected the provider with an OAuth app. |
| **Use a token** | Paste a personal access token of your own instead. It is stored encrypted and only used for actions you take. |
| **Disconnect** | Asks first. Your future git actions run as the workspace account again. |

Once signed in, the row reads **Signed in as @{login}**.
This sign-in is yours alone and separate from the repositories an admin links to boards.

### Act as yourself?

The first time you make a git write-back without your own account, Truetask asks **Act as yourself?**

| Choice | What happens |
| --- | --- |
| **Connect with {Provider}** | Opens your account dialog. Sign in, then run the action again. |
| **Continue as workspace** | Runs it on the shared connection. Truetask remembers this for that connection on all your devices and does not ask again. |
| **Cancel** | Nothing runs. |

Disconnecting your own account makes the question come back once.

### Require personal accounts

An admin can make personal accounts mandatory under **Require personal accounts** on the provider's page: **Require members to act as their own git account**.
Every git write-back from a member then has to run on that member's own account, the question loses **Continue as workspace**, and the shared connection is never used as a fallback.
It is off unless an admin turns it on, and it applies to every provider.
Automations still write with the shared connection.

## Settings > Git

**Settings > Integrations > Git** holds the git rules that need no provider, because plenty of teams work in a local git checkout only.
Only workspace owners and admins see it.

![Truetask Git settings pane with Task branches, Branch name format and Providers](https://docs.truetask.io/screenshots/settings-git.webp)

### Task branches

**Delete a task's branch once it merges** decides what happens to a task's branch after its change merges, and it is on by default.

Three places follow it:

- Each agent's task contract, which tells it whether to delete the branch after merging.
- A pull request merged through Truetask, from the API, an automation or an agent, which deletes its head branch unless this is off.
A branch from a fork is never deleted.
- Truetask Helper, when it cleans up a task's worktree.

### Branch name format

**Branch name format** is the template behind a task's branch name.
It rests as a **Preview** of a sample task; **Edit** opens the template, **Enter** saves it and **Escape** cancels.
Click a placeholder to insert it at the cursor.

| Placeholder | Becomes |
| --- | --- |
| `{user}` | Your username, slugified |
| `{key}` | The task key, lowercased |
| `{number}` | The task number |
| `{prefix}` | The board's key prefix, lowercased |
| `{title}` | The task title, slugified |

The default is `{user}/{key}-{title}`, which gives something like `alex/dev-123-fix-the-login-bug`.

The template names the branch for **Copy git branch name** on a task, for **Create branch** and **Open PR** on its **Code** sheet, and for the branch name an agent asks for over MCP.
Keep `{key}` in it: a pull request from a branch that carries the task key links itself to the task.

### Providers

**Providers** lists each connected provider account, with its host and its health when something is wrong.
A row opens that provider's page in Integrations, and the button under the list reads **Open Integrations**, or **Connect a provider** while none is connected.

## Turn the code surfaces off

**Code & reviews** in the **Features** dialog hides the **Reviews** page in the sidebar and the **Code** sheet on tasks, just for you.
Board Code views stay.

## Frequently asked questions

### Which git providers does Truetask work with?

Truetask works with GitHub on github.com, GitLab on gitlab.com, and Gitea on your own server at the address you enter.
A workspace can hold more than one connection to the same provider.

### Do my git actions in Truetask post as me or as the workspace?

Your git actions in Truetask post as you once you sign in to the provider with your own account from the avatar menu.
Until then they run on the workspace's shared connection, and an admin can turn on **Require personal accounts** so they never do.

### Can AI agents open and merge pull requests in Truetask?

Yes, within the agent's rights: AI agents work with the same pull requests and issues through Truetask's git tools over [MCP](https://docs.truetask.io/agents/mcp).
The branch name an agent asks for follows the workspace's branch name format, which carries the task key by default, so its pull request links itself to the task and your team reviews it in the [review drawer](https://docs.truetask.io/git/code-review) like any other.

### Does Truetask need a webhook to stay in sync with my repository?

No, Truetask stays in sync without a webhook, but it is faster with one: events arrive as they happen while the webhook works.
Without it, Truetask polls the repository every 15 minutes, and **Sync** in the Code view pulls everything on demand.

## Where to go next

- [Code view](https://docs.truetask.io/git/code-view): a board's pull requests and issues, and the repository settings.
- [Branches, issues and pull requests](https://docs.truetask.io/git/tasks): the task side, and how linking works.
- [Code review](https://docs.truetask.io/git/code-review): the review drawer and the Reviews page.
- [Coding tools](https://docs.truetask.io/git/coding-tools): open a task in Claude Code, Codex, Cursor, VS Code or Zed.
- [Editors and AI tools](https://docs.truetask.io/git/editors): MCP, the agent protocol and the API.
- [Automations](https://docs.truetask.io/automations/triggers): git triggers and actions.
