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.

force?boolean

Force deletion of an unmerged branch using git branch -D. Defaults to false: deletion uses git branch -d, refusing an unmerged branch with 409 CONFLICT. Ignored when creating a branch.

name?string

Branch name to create or delete. A leading + is a literal part of the name, not a refspec force marker.

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

Delete one branch using git branch -d by default: an unmerged branch is refused with 409 CONFLICT. Set force=true to use git branch -D and permit deletion of an unmerged branch. A checked-out branch is refused even with force=true.

Request Body

application/json
  1. body

Create or delete one named branch.

force?boolean

Force deletion of an unmerged branch using git branch -D. Defaults to false: deletion uses git branch -d, refusing an unmerged branch with 409 CONFLICT. Ignored when creating a branch.

name?string

Branch name to create or delete. A leading + is a literal part of the name, not a refspec force marker.

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 are never returned. Optional depth (1–2147483647) performs a shallow clone; insecureSkipTls=true disables TLS verification for this request only. A non-empty destination is rejected with BAD_REQUEST.

Request Body

application/json
  1. body

Clone a repository into a target directory.

branch?|

Branch to clone when commit_id is omitted. A leading + is literal.

commit_id?|

Commit to detach to after cloning.

depth?|

Optional shallow-clone depth, from 1 through 2147483647. 1 clones only the tip commit. Values representable as u32 but outside this range return 400 BAD_REQUEST; invalid JSON types or values outside u32 return 422 UNPROCESSABLE_ENTITY.

Formatint32
Range1 <= value <= 2147483647
insecureSkipTls?|

Skip TLS certificate verification for this clone invocation only.

password?|

Password for authenticated remotes; write-only and never returned.

path?string

Destination path to clone into.

url?string

Repository URL or local source path to clone.

username?|

Username for authenticated remotes; write-only and never returned.

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 from the commit operation itself, not a later read of HEAD. Concurrent commits in linked worktrees or checkouts cannot substitute a different commit's SHA. Author identity is passed to git for this invocation only and is not written into repository config. Nothing to commit without allow_empty returns 400 BAD_REQUEST.

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 SHA of this operation's created commit, captured from git's commit output rather than a later read of HEAD.

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. A repository with no commits returns 400 BAD_REQUEST.

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

Initialize a Git repository and return its creation status.

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. A leading + is a literal part of the branch name, never a force flag.

password?|

Password for authenticated remotes; write-only and never returned.

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 and never returned.

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. A leading + is a literal part of the branch name, never a force flag.

password?|

Password for authenticated remotes; write-only and never returned.

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 and never returned.

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"    }  ]}