docs/user/source-control.md

Source control

T3 Code integrates with GitHub, GitLab, Bitbucket, and Azure DevOps to clone and publish repositories, create pull requests, and review changes.

Connect an account

Install Git and configure authentication on the machine running your T3 Code server. For a remote environment, do this on the remote machine. After signing in, open Settings → Source Control and choose Rescan.

GitHub

Install GitHub CLI 2.81.0 or newer, then sign in:

bash
1gh auth login

GitLab

Install GitLab CLI, then sign in:

bash
1glab auth login

Bitbucket

Set an access token in the server's environment:

bash
1export T3CODE_BITBUCKET_ACCESS_TOKEN="your-access-token"

Or use an Atlassian account email and API token with read/write access to repositories and pull requests, plus user read access (read:user:bitbucket):

bash
1export T3CODE_BITBUCKET_EMAIL="you@example.com"
2export T3CODE_BITBUCKET_API_TOKEN="your-token"

The access token takes precedence if both are configured. Restart the server after changing these variables.

Azure DevOps

Install Azure CLI, add the DevOps extension, and sign in:

bash
1az extension add --name azure-devops
2az login

Clone or publish a project

Use Add Project in the command palette (Cmd/Ctrl+K) to clone a repository. Choose a hosting provider or paste a Git URL, then choose where to save it.

For a local Git repository without a remote, Publish Repository creates a hosted repository, adds it as origin, and pushes your commits. If there are no commits yet, it creates the remote; make your first commit before pushing.

Create a pull request

Use a thread's Git actions to commit, push, and create a pull request. T3 Code can generate commit messages, review titles, and descriptions from your changes.

Choose the writing style and model in Settings → Source Control. Repository conventions uses the project's instructions and recent commit subjects.

Let an agent change its checkout

Agents running through T3 Code can inspect the checkout recorded on their thread and compare it with Git's actual branch. They can also list the project root and existing worktrees, including dirty state and other threads using each checkout.

An agent can move its current thread to an existing branch, return to the project root, reuse an unclaimed worktree, or create a new worktree. T3 Code performs the Git operation before it updates the thread's saved branch and worktree path. It refuses to switch a dirty checkout and will not silently stash or discard files. It also refuses to take over a worktree owned by another thread or switch a shared root while another thread is bound there.

Moving between workspace paths restarts the agent session in the selected checkout. The agent can queue a continuation before that restart, so longer work resumes without needing the browser to stay open. These controls apply only to the calling thread and its current project. They do not remove, prune, or revive existing worktrees. If creating a new worktree fails before its durable thread binding commits, T3 Code attempts to remove only that newly created checkout as rollback.

Review and merge

Open Pull requests to review changes and comments, request reviewers, check out a branch, or merge. You can edit review titles and descriptions and your own comments where the host allows it. GitLab calls these merge requests.

GitHub, GitLab, and Azure DevOps support auto-merge while checks are outstanding. GitHub also supports approving waiting fork workflows and opening a revert pull request for a merged change.

For Azure DevOps, use the host website to view diffs or change comments. Bitbucket does not support reopening a declined pull request.

Troubleshooting

  • Not authenticated: run the provider's login command on the server, then rescan. For Bitbucket, confirm the running server received the environment variables.
  • GitHub sign-in cannot be verified: update GitHub CLI to at least 2.81.0.
  • Push fails despite a connected account: check the Git remote's credentials. SSH and HTTPS remotes can require separate setup from the hosting provider's API access.
  • A review cannot load: open it on the host website while resolving connectivity, permissions, or rate limits.