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.
Before you start
Section titled “Before you start”- 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_PATshell variable that holds the token. - The
siCLI, installed as shown in From your terminal.
1. Connect GitHub
Section titled “1. Connect GitHub”Store the token as a secret named github. The VM never reads it.
printf '%s' "$GH_PAT" | si org secret create githubThe 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.
2. Clone the repository
Section titled “2. Clone the repository”Create a VM with the github preset, then clone over HTTPS. Git over SSH does not receive the credential.
VM=pr-examplesi create --name "$VM" --inject github:githubsi exec "$VM" -- git clone https://github.com/octo-org/private-app.git /home/user/private-app3. Let the agent push a branch
Section titled “3. Let the agent push a branch”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.
4. Open the pull request
Section titled “4. Open the pull request”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.
5. Check env
Section titled “5. Check env”si exec "$VM" -- envGH_TOKEN=injected...GH_TOKEN holds the word injected. The token itself is not in the VM, so no line of env contains it.
Check it works
Section titled “Check it works”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.
If it doesn’t work
Section titled “If it doesn’t work”| 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.
Clean up
Section titled “Clean up”si rm "$VM"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.