Skip to content

Open pull requests

Your VM clones a private repository, an agent pushes a branch, and you open a pull request from the VM. The VM never holds the GitHub token: env shows only the placeholder GH_TOKEN=injected.

  • A GitHub account with access to the repository, and a fine-grained personal access token for it. The token needs Contents and Pull requests set to read and write.
  • A GH_PAT shell variable that holds the token.
  • The si CLI, installed as shown in From your terminal.

Store the token as a secret named github. The VM never reads it.

Terminal window
printf '%s' "$GH_PAT" | si org secret create github

The secret is write-only: after you save it, only its name is visible. The github preset adds the token to HTTPS requests to GitHub hosts only.

If your organization has a GitHub connection, skip the token: run si org connection add github once, then create the VM in step 2 with si create --name "$VM" --github instead of --inject github:github. The vault adds an installation token that it refreshes every hour, for the repositories you chose at the install.

Create a VM with the github preset, then clone over HTTPS. Git over SSH does not receive the credential.

Terminal window
VM=pr-example
si create --name "$VM" --inject github:github
si exec "$VM" -- git clone https://github.com/octo-org/private-app.git /home/user/private-app
Terminal window
si agent run "$VM" --agent claude --cwd /home/user/private-app -- 'Fix the failing parser test on a new branch named fix. Commit the change and push the branch to origin.'

The agent pushes with the same injected credential as your own commands, so it never sees the token either.

Terminal window
si exec "$VM" -- gh pr create --repo octo-org/private-app --head fix --fill

--head names the branch the agent pushed. Open the new pull request in GitHub.

Terminal window
si exec "$VM" -- env
Output
GH_TOKEN=injected
...

GH_TOKEN holds the word injected. The token itself is not in the VM, so no line of env contains it.

You should now see an open pull request on GitHub with the branch fix. Its env output has GH_TOKEN=injected and no other GitHub credential.

Answer Cause Fix
Repository not found on clone The token cannot reach the repository, or the URL uses SSH Check the repository access of the token, and use an https://github.com/ URL.
git push is refused The token has only read access to Contents Create a token with write access to Contents, then replace the value of the github secret.
gh pr create fails The token has no write access to Pull requests Create a token with write access to Pull requests, then replace the value of the github secret.
github_conflict on create --github and --inject github:github were both given Use one of them: the connection or the token.

Scroll horizontally to see all columns.

Terminal window
si rm "$VM"
Output
deleted <id>

The VM and its files are deleted. The branch stays on GitHub.

  • Connections: link a GitHub account so a VM clones a private repository without a token.
  • Secrets: rules, presets and the domains that receive a credential.
  • Claude Code: sign in an agent and ask it for a fix.
  • Private network: reach your other VMs by name.