Sign Up

Git

Stage files

POST
/git/add

Run git add -- <files...> in the target repository.

Request Body

application/json
  1. body

Stage one or more files.

files?array<string>

File paths to stage, relative to the repository root.

path?string

Repository path to run git add in.

Response Body

Files staged

curl -X POST 'http://sandbox:2280/git/add' \  -H 'Content-Type: application/json' \  -d '{}'
Empty

List branches

GET
/git/branches

Return local branch names from the target repository.

Query Parameters

path?string

Repository path to inspect.

Response Body

application/json
  1. response

Branch list response.

branches*array<string>

Short branch names present in the repository.

curl -X GET 'http://sandbox:2280/git/branches'
{  "branches": [    "string"  ]}

Create a branch

POST
/git/branches

Create one branch in the target repository.

Request Body

application/json
  1. body

Create or delete one named branch.

name?string

Branch name to create or delete.

path?string

Repository path to operate in.

Response Body

Branch created

curl -X POST 'http://sandbox:2280/git/branches' \  -H 'Content-Type: application/json' \  -d '{}'
Empty

Delete a branch

DELETE
/git/branches

Force-delete one branch in the target repository.

Request Body

application/json
  1. body

Create or delete one named branch.

name?string

Branch name to create or delete.

path?string

Repository path to operate in.

Response Body

Branch deleted

curl -X DELETE 'http://sandbox:2280/git/branches' \  -H 'Content-Type: application/json' \  -d '{}'
Empty

Switch branches

POST
/git/checkout

Switch the target repository to another branch using git switch.

Request Body

application/json
  1. body

Switch the worktree to another branch.

branch?string

Branch name to switch to.

path?string

Repository path to operate in.

Response Body

Branch checked out

curl -X POST 'http://sandbox:2280/git/checkout' \  -H 'Content-Type: application/json' \  -d '{}'
Empty

Clone a repository

POST
/git/clone

Clone a repository URL or local path into a destination directory. Credentials, when provided, are delivered to git via askpass and are never echoed back. Optional depth performs a shallow clone, and insecureSkipTls=true disables TLS verification for this clone invocation only.

Request Body

application/json
  1. body

Clone a repository into a target directory.

branch?|

Branch to clone when commit_id is omitted.

commit_id?|

Commit to detach to after cloning.

depth?|

Optional shallow-clone depth. 1 clones only the tip commit.

Formatint32
Range1 <= value
insecureSkipTls?|

Skip TLS certificate verification for this clone invocation only.

password?|

Password for authenticated remotes; write-only, never echoed, delivered to git via askpass.

path?string

Destination path to clone into.

url?string

Repository URL or local source path to clone.

username?|

Username for authenticated remotes; write-only, never echoed, delivered to git via askpass.

Response Body

Repository cloned

curl -X POST 'http://sandbox:2280/git/clone' \  -H 'Content-Type: application/json' \  -d '{}'
Empty

Create a commit

POST
/git/commit

Create one commit and return its full SHA. Author identity is passed to git for this invocation only and is not written into repository config.

Request Body

application/json
  1. body

Create a commit.

allow_empty?boolean

Whether an empty commit is allowed.

author?string

Commit author name passed to git for this invocation only.

email?string

Commit author email passed to git for this invocation only.

message?string

Commit message.

path?string

Repository path to commit in.

Response Body

application/json
  1. response

Commit creation result.

hash*string

Full commit SHA of the created commit.

curl -X POST 'http://sandbox:2280/git/commit' \  -H 'Content-Type: application/json' \  -d '{}'
{  "hash": "string"}

Read one git config key

GET
/git/config

Read one git config value from global scope by default, or local scope when scope=local and path is provided.

Query Parameters

key?string

Config key to read.

path?string

Repository path required for scope=local.

scope?string

Config scope; omitted means global.

Response Body

application/json
  1. response

Value of one git config key.

value?|

Config value, or null when the key is unset.

curl -X GET 'http://sandbox:2280/git/config'
{  "value": "string"}

Set one git config key

POST
/git/config

Write one git config value to global scope by default, or local scope when scope=local and path is provided.

Request Body

application/json
  1. body

Set one git config key.

key?string

Config key to set.

path?|

Repository path required for scope=local.

scope?|

Config scope; omitted means global.

value?string

Config value to write.

Response Body

Config value set

curl -X POST 'http://sandbox:2280/git/config' \  -H 'Content-Type: application/json' \  -d '{}'
Empty

Read commit history

GET
/git/history

Return commit metadata from git log in newest-first order.

Query Parameters

path?string

Repository path to inspect.

Response Body

application/json
  1. response
[index: integer]?

One commit from git log.

curl -X GET 'http://sandbox:2280/git/history'
[  {    "author": "string",    "email": "string",    "hash": "string",    "message": "string",    "timestamp": "string"  }]

Initialize a repository

POST
/git/init

Run git init and return the created status the historical wire contract uses.

Request Body

application/json
  1. body

Initialize a repository.

bare?boolean

Whether to create a bare repository.

initial_branch?|

Initial branch name for a new non-bare repository.

path?string

Destination path for the new repository.

Response Body

Repository initialized

curl -X POST 'http://sandbox:2280/git/init' \  -H 'Content-Type: application/json' \  -d '{}'
Empty

Pull from a remote

POST
/git/pull

Pull from the repository's configured upstream by default, or from an explicit remote and optional branch, with --ff-only so divergent history becomes a conflict instead of a merge.

Request Body

application/json
  1. body

Operate on a repository, optionally with credentials for a remote.

branch?|

Remote branch to push or pull. Omitted keeps the current HEAD push behaviour and git's default pull target.

password?|

Password for authenticated remotes; write-only, never echoed, delivered to git via askpass.

path?string

Repository path to operate in.

remote?|

Remote name. Omitted defaults to origin for push and for pull when branch is set; a pull without branch uses git's configured upstream.

setUpstream?|

Pass -u / --set-upstream on push.

username?|

Username for authenticated remotes; write-only, never echoed, delivered to git via askpass.

Response Body

Pull completed

curl -X POST 'http://sandbox:2280/git/pull' \  -H 'Content-Type: application/json' \  -d '{}'
Empty

Push a branch

POST
/git/push

Push the current HEAD ref by default, or an explicit branch to remote (default origin) using an explicit <ref>:<ref> refspec. setUpstream=true passes -u to git.

Request Body

application/json
  1. body

Operate on a repository, optionally with credentials for a remote.

branch?|

Remote branch to push or pull. Omitted keeps the current HEAD push behaviour and git's default pull target.

password?|

Password for authenticated remotes; write-only, never echoed, delivered to git via askpass.

path?string

Repository path to operate in.

remote?|

Remote name. Omitted defaults to origin for push and for pull when branch is set; a pull without branch uses git's configured upstream.

setUpstream?|

Pass -u / --set-upstream on push.

username?|

Username for authenticated remotes; write-only, never echoed, delivered to git via askpass.

Response Body

Push completed

curl -X POST 'http://sandbox:2280/git/push' \  -H 'Content-Type: application/json' \  -d '{}'
Empty

List remotes

GET
/git/remotes

Return configured remotes. Any userinfo in remote URLs is redacted before it is returned.

Query Parameters

path?string

Repository path to inspect.

Response Body

application/json
  1. response

Remote list response.

remotes*array<>

Configured remotes.

curl -X GET 'http://sandbox:2280/git/remotes'
{  "remotes": [    {      "name": "string",      "url": "string"    }  ]}

Add a remote

POST
/git/remotes

Run git remote add in the target repository.

Request Body

application/json
  1. body

Add one named remote.

name?string

Remote name to create.

path?string

Repository path to operate in.

url?string

Remote URL to store.

Response Body

Remote added

curl -X POST 'http://sandbox:2280/git/remotes' \  -H 'Content-Type: application/json' \  -d '{}'
Empty

Reset repository state

POST
/git/reset

Run git reset with the requested mode, target, and optional pathspecs.

Request Body

application/json
  1. body

Reset repository state.

files?array<string>

Optional pathspecs to reset in mixed mode.

mode?|

Reset mode (mixed, soft, hard, merge, keep); omitted means git's default mixed reset.

path?string

Repository path to operate in.

target?|

Commit-ish to reset to.

Response Body

Reset completed

curl -X POST 'http://sandbox:2280/git/reset' \  -H 'Content-Type: application/json' \  -d '{}'
Empty

Restore files

POST
/git/restore

Run git restore for one or more files from the index, worktree, or an optional source tree-ish.

Request Body

application/json
  1. body

Restore paths from the index or another source.

files?array<string>

File paths to restore.

path?string

Repository path to operate in.

source?|

Optional source tree-ish for the restore.

staged?|

Whether to restore the index entry.

worktree?|

Whether to restore the worktree entry.

Response Body

Restore completed

curl -X POST 'http://sandbox:2280/git/restore' \  -H 'Content-Type: application/json' \  -d '{}'
Empty

Read repository status

GET
/git/status

Return the current branch, ahead/behind counts, and file status entries from git status --porcelain=v2 --branch -z.

Query Parameters

path?string

Repository path to inspect.

Response Body

application/json
  1. response

Repository status.

ahead*integer

Commits the local branch is ahead of its upstream.

Formatint64
behind*integer

Commits the local branch is behind its upstream.

Formatint64
branchPublished*boolean

Whether the current branch has an upstream.

currentBranch*string

Current branch name, or HEAD for a detached checkout.

fileStatus*array<>

File-level status entries.

curl -X GET 'http://sandbox:2280/git/status'
{  "ahead": 0,  "behind": 0,  "branchPublished": true,  "currentBranch": "string",  "fileStatus": [    {      "extra": "string",      "name": "string",      "staging": "string",      "worktree": "string"    }  ]}