Skip to content

GitHub

Machines talk to GitHub through a single GitHub App per cluster. Orgs install the app on their GitHub accounts, projects choose which repositories to expose, and machines receive short-lived tokens scoped to one repository at a time—minted on demand by git or gh, expiring within an hour, and never written to disk.

Manage the app and installations in Settings → GitHub (or anastroctl apps github), and project repositories in Project settings → Repositories (or anastroctl project repo).

A cluster admin sets this up once. In Settings → GitHub, click Create GitHub App to open GitHub with the permissions prefilled (read/write contents and pull requests; read checks, statuses, and metadata). Name the app, optionally pick a GitHub org to own it, confirm, and GitHub redirects back with the app registered. Or via CLI:

Terminal window
anastroctl apps github setup create [--github-org acme] [--administration]
anastroctl apps github setup status

Prefer an existing GitHub App? Choose Use an existing app (or anastroctl apps github setup import) and supply its app ID, private key, and—for user account linking and webhooks—its client ID, client secret, and webhook secret, configuring the callback URL shown in the dialog.

To replace the app (even if you already deleted it on GitHub), click Remove in Settings → GitHub or run:

Terminal window
anastroctl apps github setup remove --yes

Removing clears the app, installations, project repo links, linked user accounts, and cached tokens inside Anastro without touching GitHub itself. Afterward, register or import the new app, install it for each org, re-add project repos, and re-link user accounts.

In Settings → GitHub, an org owner or admin clicks Install on GitHub and selects the GitHub account/org and repositories. Or from the CLI:

Terminal window
anastroctl apps github installation add
anastroctl apps github installation list
anastroctl apps github installation unlink <installation>

If GitHub can’t redirect back automatically (no public hooks hostname and the app was created from the CLI), a cluster admin links the pending installation in Settings → GitHub (Link to) or via anastroctl apps github installation link <installation>.

Project owners pick which repositories from the org’s installations a project can access, read-only or read-write. Open the project menu → Project settings → Repositories → Add repository (if a repo isn’t listed, add it to the installation on GitHub first), or run:

Terminal window
anastroctl project repo --project api available
anastroctl project repo --project api add acme/api --write
anastroctl project repo --project api add acme/docs
anastroctl project repo --project api
anastroctl project repo --project api remove acme/docs # immediately revokes minted tokens

Clone and push over HTTPS normally—Anastro’s credential helper mints tokens behind the scenes:

Terminal window
git clone https://github.com/acme/api
git push origin anastro/fix-auth-test
  • Every token is scoped to one repository, lasts at most an hour, and stays out of /workspace (so it never lands in a snapshot, rollback, or fork).
  • Write access requires both a read-write repo binding on the project and an editor (or higher) project role for the person the machine acts as; viewers get read-only tokens.
  • Every mint is recorded in the audit log with the machine, thread, and user. Removing the repo or the user revokes active tokens.

Provisioned machines also include a brokered gh CLI. Run gh inside a cloned repo, set GH_REPO, or pass --repo owner/name—it receives a short-lived installation token in its environment and never saves credentials into the workspace.

Optional, but recommended so commits and PR reviews happen as you. Click Link GitHub account in Settings → Account, or run:

Terminal window
anastroctl apps github account link
anastroctl apps github account status
anastroctl apps github account email
anastroctl apps github account email you@example.com
anastroctl apps github account email --noreply
anastroctl apps github account name "Your Name"
anastroctl apps github account name --profile
anastroctl apps github account unlink

When linked:

  • Local commits use your GitHub name (or custom override) and your no-reply or chosen verified GitHub email. Verified API commits (below) are authored by GitHub directly as your account.
  • Pull request actions in the UI run under your GitHub account with your permissions.
  • If your operator enabled per-user repo checks, machines acting for you can only reach repositories your own GitHub account can access.

Commit identity, signed commits, and branch prefixes

Section titled “Commit identity, signed commits, and branch prefixes”

Org owners and admins configure defaults under Settings → GitHub → Commit identity and branches, or via CLI:

Terminal window
anastroctl org git
anastroctl org git --author user --committer bot --branch-prefix anastro/
anastroctl org git --trailer 'Co-authored-by: {user.name} <{user.github_email}>'
Setting Default Options
--author user (linked GitHub identity, else the app bot) bot, fixed (--author-name, --author-email)
--committer bot author
--branch-prefix anastro/ Any prefix
--trailer None Templates; --no-trailers clears them

Machines expose these via GIT_AUTHOR_NAME, GIT_AUTHOR_EMAIL, GIT_COMMITTER_NAME, GIT_COMMITTER_EMAIL, ANASTRO_GIT_BRANCH_PREFIX, and ANASTRO_GIT_TRAILERS.

  • Branches: run git anastro-branch [slug] to create a prefixed branch (defaults to the thread or machine ID). Ordinary git commit appends the org’s trailers via a guest hook.
  • Signed API commits: stage files with git add, push the branch once, then run git anastro-commit 'Message' or click Commit in the Diff tab. By default, Anastro creates a verified commit via GitHub’s API as your linked account (or the app) and fast-forwards local HEAD while keeping unstaged changes. GitHub’s signed API only supports regular files—use normal unsigned git commit (which the org can also set as default) for executables, symlinks, submodules, or mode changes.
  • Branch-prefix enforcement: if your operator enables [git] enforce_branch_prefix = true, the host proxy blocks pushes outside the org prefix (up to 64 MiB per push). Guests receive read-only tokens while write credentials stay in the host broker.

Link pull requests to a thread in three ways:

  • Add one in the right panel’s Linked pull requests tab by URL, owner/name#12, or #12 (when the project has one repo).
  • Have the agent open one with pull_request_open (asks first in supervised mode).
  • Have the agent link an existing PR with pull_request_link.

Pushing a branch alone doesn’t link a PR. Each linked PR opens in a Pull request tab:

Section What’s inside
Summary Description, CI checks, and review form (Comment, Approve, Request changes)
Guide Agent-written reading guide for the diff (Write guide asks the agent to create one)
Timeline Commits, reviews, and comments, each with Add to chat and inline replies
Code Changed files with Viewed checkboxes (when linked) and gutter Post on GitHub line comments

The primary action adapts to the PR state (Merge, Ready for review, or Reopen; Close and other actions sit under ⋯). Every action displays which GitHub identity it will use (yours if linked, otherwise the app bot on read-write repos). Editors can act; viewers can read.

Live updates: with the Cloudflare Tunnel enabled, signed GitHub webhooks update open PR tabs immediately (without it, tabs poll every minute), and GitHub account linking redirects back over the hooks hostname from any browser. For existing GitHub Apps, subscribe to Pull request reviews, Pull request review comments, and Issue comments in your GitHub webhook settings so conversation updates arrive live.

PR stacks: link every PR in a stack (each targeting the branch below it), then click Set stack order in Linked pull requests from bottom to top. Merge blocks a PR until its parent merges, then automatically retargets it onto the parent’s base branch. Anastro won’t rebase or force-push stack branches for you. Agents can manage stacks and comments with pull_request_stack and pull_request_comment (posting a comment asks for approval in supervised mode).