Skip to main content
Clone a remote repository into a directory in the runtime.

Network access

Egress is deny-by-default, so a runtime cannot reach the remote until you attach a network policy that allows it. Clone, fetch, pull, and push all fail with a connection error otherwise. The example above already attaches an allowlist for github.com:443. allow_all is the broader alternative:

Use an allowed URL

url must use http://, https://, ssh://, git://, or SCP-style SSH (for example git@github.com:org/repo.git). The file:// scheme is rejected.

Clone a private repository

Pass auth_token to authenticate an HTTPS clone. It is sent as an HTTP Authorization header for that one git invocation, the same mechanism CI checkout steps use. The token is not written into the repository. Nothing is stored in .git/config, and remote.origin.url stays clean, so code running in the sandbox afterwards cannot read the credential back out of the checkout. Because nothing is persisted, every later operation that contacts the remote takes its own auth_token:
A token still travels through the API to the runtime, so use the narrowest, shortest-lived one that the operation needs.

Parameters

Response

A clone of a large repository can take several minutes. Remote git operations default to a 300-second deadline; pass timeout_seconds (up to 900) for known large repositories, or depth to keep clones fast.

Endpoint

POST /v1/agents/runtime/{runtime_id}/git/clone