Skip to main content
Every runtime can drive git against a repository in its own filesystem. Each operation runs git directly in the sandbox — no shell — and returns the exit code together with the raw stdout and stderr, so you can read git’s output exactly as you would locally. The same eleven operations are available through the Python SDK, the CLI, and the REST API. Every method is also available on the async client as await client.runtime.git.<operation>(runtime_id, ...).

Network access

Guest egress is deny-by-default. Clone, fetch, pull, and push need a network policy attached to the runtime; the local operations do not.

Credentials

Clone, fetch, pull, and push each accept an auth_token for a private HTTPS remote. The token authenticates that single operation: it is sent as an HTTP Authorization header and is never written into the repository, so it does not appear in .git/config or remote.origin.url and cannot be read back by code running in the sandbox. That means credentials do not carry over between operations — a repository cloned with a token needs the token again to pull, fetch, or push. Supply it per call:
On push, auth_token takes precedence over username/password, which remain available for remotes that need a real account. The CLI reads the token from GRAVIXLAYER_GIT_TOKEN when --auth-token is not given, so a workflow can put it in the environment instead of on the command line.

Working on a checkout

Git runs as the same sandbox user that run_cmd runs commands as, so a checkout is writable by the build that follows it — install dependencies, run a test suite, and write generated files into the tree without any ownership fixup:
A destination directory that does not exist yet is created for you, including any missing parent directories, which is why /home/user/repo works on a fresh runtime.

End-to-end example

Interpreting the response

Every operation returns the same shape: success: false means git itself reported a failure — a merge conflict, a rejected push, a missing ref. The reason is in stderr, and the HTTP status is still 200 because the request was handled correctly. An HTTP error status means the request never reached git: a bad parameter, a runtime that is not running, or a runtime you do not have access to. Note that git writes progress and many ordinary messages to stderr, so a non-empty stderr on its own does not indicate failure — check success. The CLI exits with git’s own exit code, so && chains and workflow steps stop on a failed operation the same way they would running git locally:

Timeouts

Operations that contact a remote are allowed up to 10 minutes; operations confined to the local repository are allowed up to 30 seconds. Use depth on clone to keep large repositories well inside the limit.

Other git commands

For anything outside these eleven operations — git log, git diff, git rebase, submodules, tags — run git through the command API: