Configure Git Access
Pass agit config to Box.create to configure Git access. All fields are optional.
token— GitHub token. Required for private repositories, pushing, and creating pull requests.userName— Git user name written to the container’s global git config on creation. Defaults to"Upstash Box".userEmail— Git user email written to the container’s global git config on creation. Defaults to"box@upstash.com".
For a fine-grained token, the following permissions are sufficient for basic usage:
- Contents — Read and write
- Pull requests — Read and write
.env
Quickstart
Clone a repository
Inspect what changed
Usestatus() for a compact summary and diff() to diff the repo’s uncommitted changes against the initial state.
Commit and push
After your code changes are ready, create a commit and push the branch.Open a pull request
Create a PR once your branch is pushed.API
Clone
Clones a repository into the current working directory in the box.Status
Returns the Git status output for the repository in the current working directory.- See what files changed
- See if there are there untracked files
Diff
Returns the current Git diff as a string.- Useful to display a patch in your UI
- Review what an agent changed
Commit
Creates a commit and returns commit information including the SHA and message.authorName and authorEmail to override the git identity for this commit only. If omitted, the identity configured on the box (via Box.create or updateConfig) is used.
Update Git Config
Updates the git identity (userName and/or userEmail) applied to the container. Partial updates are supported — you can update either field independently. At least one field is required.
Returns the effective identity values after the update. If the box is running or idle, the new config is applied immediately inside the container.