SandboxesGit

Restore git files

Restore files in the work tree (default), the index (staged), or both.

  • source defaults to the index, or to HEAD with staged.
  • Restored work tree changes are lost.
  • Local git writes on one work tree run one at a time. A write through the files endpoints does not wait for them. After a timeout, the outcome is unknown: the command can have run.
  • Runs in the sandbox as the image user. Needs write access to the sandbox, because git runs the repository's own config and filters.
  • Served at the access endpoint of the sandbox (access_endpoint of GET /v1/sandboxes/{sandboxId}), not at the API host.
  • A paused sandbox returns 409, unless resume=true. A sandbox that started before its files server existed returns 409 sandbox_update_required until it restarts.
  • A refused operation returns its code as the problem type.
  • A path that starts with ~ or ~/ names the home directory of the user that the operation runs as. ~name returns 422.
PUT
/v1/sandboxes/{sandboxId}/git/restore
AuthorizationBearer <token>

API key starting with tektona_. Create one at app-dev.tektona.ai under API Keys.

In: header

Path Parameters

sandboxId*string

Sandbox ID (ULID)

Query Parameters

resume?boolean

Wake a paused sandbox to serve this request

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

files*array<string>|

Paths relative to the work tree root, read literally (no globs)

Items1 <= items
path?string

A directory inside the work tree: absolute, or relative to the sandbox working directory

Default"."
source?string

Revision to restore from; defaults to the index, or HEAD with staged

Match^[^-\x00\n\r][^\x00\n\r]*$
staged?boolean

Restore the index

worktree?boolean

Restore the work tree; the default when staged is not set

Response Body

application/problem+json

curl -X PUT "https://example.com/v1/sandboxes/string/git/restore" \  -H "Content-Type: application/json" \  -d '{    "files": [      "string"    ]  }'

No body.

Reset git HEAD PUT

Move the current branch to `ref` (default `HEAD`). - `mode` `soft` keeps the index and the work tree. `mixed` (default) resets the index. `hard` resets both and loses local changes. - With `files`, reset only those index entries (`mode` `mixed`). - Local git writes on one work tree run one at a time. A write through the files endpoints does not wait for them. After a timeout, the outcome is unknown: the command can have run. - Runs in the sandbox as the image user. Needs write access to the sandbox, because git runs the repository's own config and filters. - Served at the access endpoint of the sandbox (`access_endpoint` of `GET /v1/sandboxes/{sandboxId}`), not at the API host. - A paused sandbox returns 409, unless `resume=true`. A sandbox that started before its files server existed returns 409 `sandbox_update_required` until it restarts. - A refused operation returns its code as the problem type. - A path that starts with `~` or `~/` names the home directory of the user that the operation runs as. `~name` returns 422.

Set a git config value PUT

Write `key` to the repository config only, never the global config. - Allowed keys: `user.name`, `user.email`, `core.autocrlf`, `pull.rebase`, `init.defaultBranch`. - Local git writes on one work tree run one at a time. A write through the files endpoints does not wait for them. After a timeout, the outcome is unknown: the command can have run. - Runs in the sandbox as the image user. Needs write access to the sandbox, because git runs the repository's own config and filters. - Served at the access endpoint of the sandbox (`access_endpoint` of `GET /v1/sandboxes/{sandboxId}`), not at the API host. - A paused sandbox returns 409, unless `resume=true`. A sandbox that started before its files server existed returns 409 `sandbox_update_required` until it restarts. - A refused operation returns its code as the problem type. - A path that starts with `~` or `~/` names the home directory of the user that the operation runs as. `~name` returns 422.