Skip to content

Latest commit

 

History

History
111 lines (76 loc) · 4.11 KB

File metadata and controls

111 lines (76 loc) · 4.11 KB

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:

gh auth login

GitLab

Install GitLab CLI, then sign in:

glab auth login

Bitbucket

Set an access token in the server's environment:

export 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):

export T3CODE_BITBUCKET_EMAIL="you@example.com"
export 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:

az extension add --name azure-devops
az 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.

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.

Worktree lifecycle scripts

Project scripts can run around git worktrees and pull requests. Configure them in the project scripts menu, or check them into the project's t3.json.

  • Run on worktree creation starts after a new worktree thread is created.
  • Run before worktree removal runs before the worktree is removed. T3 Code waits for the script to exit; a non-zero exit blocks removal.
  • Run when the pull request merges runs in that workspace when the branch's review moves from open to merged. Failures are logged and do not block other work.

Scripts receive T3CODE_PROJECT_ROOT, T3CODE_WORKTREE_PATH, and T3CODE_LIFECYCLE (worktree-remove or pr-merged). When a linked pull request is known, they also receive T3CODE_PR, T3CODE_PR_NUMBER, T3CODE_PR_URL, T3CODE_PR_TITLE, T3CODE_PR_BASE_REF, T3CODE_PR_HEAD_REF, and T3CODE_PR_STATE.

Use these to stop dev servers or drop temporary databases before a worktree goes away.

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.