# git-api ## Pages - [Git API](https://docs.ezghcloud.com/git-api/index.md) — Hosted Git repositories in a project: cloned and pushed over HTTPS on the project's Git host, with pull requests, branch rules, checks and Git LFS. Every path is under an organization; lists are paged with limit, cursor and nextCursor. - [Cancel an operation](https://docs.ezghcloud.com/git-api/CancelOperation/index.md) — 409 operation_finished or operation_not_cancellable when it can't be cancelled. - [Compare two refs](https://docs.ezghcloud.com/git-api/CompareCommits/index.md) — range is base...head. The commits on head since base (at most 250) and the diff from their merge base to head (at most 300 files, 1 MiB of patch per file; truncated: true beyond). - [Create a branch at a commit](https://docs.ezghcloud.com/git-api/CreateBranch/index.md) — Needs git.repositories.push on the branch (gtr_…/). 409 branch_exists when it does. Branch rules apply. - [Create a commit](https://docs.ezghcloud.com/git-api/CreateCommit/index.md) — One call, one commit on a branch: writes, deletes and moves. expectedHeadSha is required while the branch exists; a branch that moved is 409 conflict. A new branch starts from startFrom (default the default branch). Needs git.repositories.get on the repository and git.repositories.push on the branch (gtr_…/); branch rules apply as for a push. Body at most 32 MiB; a change set that changes nothing is 400 empty_commit. - [Open a pull request](https://docs.ezghcloud.com/git-api/CreatePullRequest/index.md) — From headBranch into baseBranch (default the default branch), same repository. 409 pull_exists while one between them is open. - [Create a repository](https://docs.ezghcloud.com/git-api/CreateRepository/index.md) — Asynchronous: answers 202 with the operation that creates it. The repository is empty; push to its cloneUrl. 409 name_taken when the project has a repository with the name; 403 not_enabled when Git isn't enabled for the project yet. - [Review a pull request](https://docs.ezghcloud.com/git-api/CreateReview/index.md) — approve, request_changes or comment, on the head as it is now, with optional line comments. An approval counts toward a branch's required approvals only from someone other than the author and the head branch's pushers, holding git.pulls.approve on the base branch. - [Reply in a comment's thread](https://docs.ezghcloud.com/git-api/CreateReviewReply/index.md) - [Create a tag at a commit](https://docs.ezghcloud.com/git-api/CreateTag/index.md) — A lightweight tag; needs git.repositories.push on the repository. 409 tag_exists when it does. - [Delete a branch](https://docs.ezghcloud.com/git-api/DeleteBranch/index.md) — Needs git.repositories.push on the branch (gtr_…/). Branch rules apply (blockDeletion). - [Delete a repository](https://docs.ezghcloud.com/git-api/DeleteRepository/index.md) — Asynchronous: answers 202 with the operation that deletes it, with its branches, tags, pull requests and LFS objects. - [Delete a tag](https://docs.ezghcloud.com/git-api/DeleteTag/index.md) - [Download a commit as a tar archive](https://docs.ezghcloud.com/git-api/GetArchive/index.md) — Every file of the commit, streamed through the API as an uncompressed tar, with Git LFS pointers replaced by their objects. sha is a full commit SHA that a branch or tag reaches; any other is 404. There is no path filter. - [Read a blob's raw bytes](https://docs.ezghcloud.com/git-api/GetBlob/index.md) — An LFS pointer is returned as the pointer; with lfs=resolve, the LFS object it names, streamed through the API. With download=1, the bytes come as an attachment (Content-Disposition, RFC 6266) named filename, or the blob's SHA without it. Only refusals are recorded in Trails. - [Get a branch](https://docs.ezghcloud.com/git-api/GetBranch/index.md) — name is one segment, with / percent-encoded (release%2Fv1). - [Get a repository's branch rules](https://docs.ezghcloud.com/git-api/GetBranchRules/index.md) — The whole document, with its ETag. A branch's rule is the most specific pattern that matches it: fewest wildcards, then the longest literal. - [Get a commit and its changes](https://docs.ezghcloud.com/git-api/GetCommit/index.md) — Changes from its first parent; at most 300 files and 1 MiB of patch per file (truncated: true beyond). - [Read a file or list a directory at a ref](https://docs.ezghcloud.com/git-api/GetContents/index.md) — path is one segment, with / percent-encoded (src%2Fmain.go). A file comes base64, with content null past 1 MiB (read it from blobs); an LFS pointer also names its object. Only refusals are recorded in Trails. - [Get an operation (poll it until it finishes)](https://docs.ezghcloud.com/git-api/GetOperation/index.md) — While it's queued or running, Retry-After suggests when to poll again. Not recorded in Trails. - [Get a pull request](https://docs.ezghcloud.com/git-api/GetPullRequest/index.md) — With the checks reported on its head. - [Get a repository](https://docs.ezghcloud.com/git-api/GetRepository/index.md) - [List a commit's tree](https://docs.ezghcloud.com/git-api/GetTree/index.md) — The root directory, or with recursive=true every entry under it (truncated past 100000 entries). Only refusals are recorded in Trails. - [List branches](https://docs.ezghcloud.com/git-api/ListBranches/index.md) - [List the checks reported on a commit](https://docs.ezghcloud.com/git-api/ListChecks/index.md) — Every reporter's latest report of each check, newest first. 404 for a commit the repository doesn't have. - [List a ref's history](https://docs.ezghcloud.com/git-api/ListCommits/index.md) — Newest first, from ref (the default branch when absent), only commits touching path when it's given. - [List the organization's operations, newest first](https://docs.ezghcloud.com/git-api/ListOperations/index.md) - [List a pull request's changed files](https://docs.ezghcloud.com/git-api/ListPullRequestFiles/index.md) — The diff from the merge base to the head: at most 300 files and 1 MiB of patch per file (truncated: true beyond). - [List pull requests](https://docs.ezghcloud.com/git-api/ListPullRequests/index.md) — Newest first; state open (the default), closed, merged or all. - [List a project's repositories, newest first](https://docs.ezghcloud.com/git-api/ListRepositories/index.md) - [List a pull request's line comments](https://docs.ezghcloud.com/git-api/ListReviewComments/index.md) — Oldest first; outdated when the comment's commit isn't the head and its file changed since. - [List a pull request's reviews](https://docs.ezghcloud.com/git-api/ListReviews/index.md) - [List tags](https://docs.ezghcloud.com/git-api/ListTags/index.md) - [Merge a pull request](https://docs.ezghcloud.com/git-api/MergePullRequest/index.md) — Synchronous; needs git.pulls.merge on the base branch (gtr_…/). method must be allowed by the repository and the base branch's rule; 409 head_moved when the head isn't expectedHeadSha, conflicting, pull_draft, pull_closed or blocked_by_rule (the rule's message). Rebase replays the head's commits onto the base. - [Report a check on a commit](https://docs.ezghcloud.com/git-api/ReportCheck/index.md) — Stored with the caller as its reporter; a later report of the same name by the same reporter replaces it. Branch rules may require a check, and pin it to one reporter. - [Resolve or unresolve a comment's thread](https://docs.ezghcloud.com/git-api/ResolveReviewThread/index.md) - [Replace a repository's branch rules](https://docs.ezghcloud.com/git-api/UpdateBranchRules/index.md) — Replaces the whole document. If-Match (optional) must name the current ETag, else 412 precondition_failed. Approvals or required checks imply requirePullRequest. More rules than the repository's quota allows is 409 quota_exceeded. - [Edit, close or reopen a pull request](https://docs.ezghcloud.com/git-api/UpdatePullRequest/index.md) — Every field optional. A merged pull request keeps its state; reopening needs both branches. - [Rename a repository, change its settings or remove links](https://docs.ezghcloud.com/git-api/UpdateRepository/index.md) — Synchronous: every field is optional, and only the ones given change. Renaming changes cloneUrl. defaultBranch must be one of the repository's branches (400 unknown_branch), unless the repository is empty. allowedMergeMethods is a non-empty subset of merge, squash and rebase. links can only remove links (a subset of the current ones). - [BranchList](https://docs.ezghcloud.com/git-api/schemas/BranchList/index.md) - [BranchRule](https://docs.ezghcloud.com/git-api/schemas/BranchRule/index.md) - [BranchRules](https://docs.ezghcloud.com/git-api/schemas/BranchRules/index.md) - [Check](https://docs.ezghcloud.com/git-api/schemas/Check/index.md) - [CheckList](https://docs.ezghcloud.com/git-api/schemas/CheckList/index.md) - [CheckReport](https://docs.ezghcloud.com/git-api/schemas/CheckReport/index.md) - [CheckStatus](https://docs.ezghcloud.com/git-api/schemas/CheckStatus/index.md) - [Commit](https://docs.ezghcloud.com/git-api/schemas/Commit/index.md) - [CommitChange](https://docs.ezghcloud.com/git-api/schemas/CommitChange/index.md) - [CommitCreate](https://docs.ezghcloud.com/git-api/schemas/CommitCreate/index.md) - [CommitCreated](https://docs.ezghcloud.com/git-api/schemas/CommitCreated/index.md) - [CommitDetail](https://docs.ezghcloud.com/git-api/schemas/CommitDetail/index.md) - [CommitList](https://docs.ezghcloud.com/git-api/schemas/CommitList/index.md) - [Comparison](https://docs.ezghcloud.com/git-api/schemas/Comparison/index.md) - [DirContents](https://docs.ezghcloud.com/git-api/schemas/DirContents/index.md) - [Error](https://docs.ezghcloud.com/git-api/schemas/Error/index.md) — Every non-2xx answer. Clients branch on code, never on message. - [FileContents](https://docs.ezghcloud.com/git-api/schemas/FileContents/index.md) - [FileDiff](https://docs.ezghcloud.com/git-api/schemas/FileDiff/index.md) - [GitPerson](https://docs.ezghcloud.com/git-api/schemas/GitPerson/index.md) - [GitRef](https://docs.ezghcloud.com/git-api/schemas/GitRef/index.md) - [LfsPointer](https://docs.ezghcloud.com/git-api/schemas/LfsPointer/index.md) - [LineCommentCreate](https://docs.ezghcloud.com/git-api/schemas/LineCommentCreate/index.md) - [Link](https://docs.ezghcloud.com/git-api/schemas/Link/index.md) - [MergeMethod](https://docs.ezghcloud.com/git-api/schemas/MergeMethod/index.md) - [MergeRequest](https://docs.ezghcloud.com/git-api/schemas/MergeRequest/index.md) - [Operation](https://docs.ezghcloud.com/git-api/schemas/Operation/index.md) - [OperationList](https://docs.ezghcloud.com/git-api/schemas/OperationList/index.md) - [OperationStatus](https://docs.ezghcloud.com/git-api/schemas/OperationStatus/index.md) - [Principal](https://docs.ezghcloud.com/git-api/schemas/Principal/index.md) - [PullRequest](https://docs.ezghcloud.com/git-api/schemas/PullRequest/index.md) - [PullRequestCreate](https://docs.ezghcloud.com/git-api/schemas/PullRequestCreate/index.md) - [PullRequestDetail](https://docs.ezghcloud.com/git-api/schemas/PullRequestDetail/index.md) - [PullRequestFiles](https://docs.ezghcloud.com/git-api/schemas/PullRequestFiles/index.md) - [PullRequestList](https://docs.ezghcloud.com/git-api/schemas/PullRequestList/index.md) - [PullRequestUpdate](https://docs.ezghcloud.com/git-api/schemas/PullRequestUpdate/index.md) - [QuotaExceeded](https://docs.ezghcloud.com/git-api/schemas/QuotaExceeded/index.md) — quota_exceeded: the quota that refused the request. Never with Retry-After. - [RefCreate](https://docs.ezghcloud.com/git-api/schemas/RefCreate/index.md) - [ReplyCreate](https://docs.ezghcloud.com/git-api/schemas/ReplyCreate/index.md) - [Repository](https://docs.ezghcloud.com/git-api/schemas/Repository/index.md) - [RepositoryCreate](https://docs.ezghcloud.com/git-api/schemas/RepositoryCreate/index.md) - [RepositoryList](https://docs.ezghcloud.com/git-api/schemas/RepositoryList/index.md) - [RepositoryUpdate](https://docs.ezghcloud.com/git-api/schemas/RepositoryUpdate/index.md) - [RequiredCheck](https://docs.ezghcloud.com/git-api/schemas/RequiredCheck/index.md) - [Review](https://docs.ezghcloud.com/git-api/schemas/Review/index.md) - [ReviewComment](https://docs.ezghcloud.com/git-api/schemas/ReviewComment/index.md) - [ReviewCommentList](https://docs.ezghcloud.com/git-api/schemas/ReviewCommentList/index.md) - [ReviewCreate](https://docs.ezghcloud.com/git-api/schemas/ReviewCreate/index.md) - [ReviewList](https://docs.ezghcloud.com/git-api/schemas/ReviewList/index.md) - [TagList](https://docs.ezghcloud.com/git-api/schemas/TagList/index.md) - [Tags](https://docs.ezghcloud.com/git-api/schemas/Tags/index.md) — At most 50; keys 1-128 characters, values at most 256, keys starting with ezgh: are reserved. - [Tree](https://docs.ezghcloud.com/git-api/schemas/Tree/index.md) - [TreeEntry](https://docs.ezghcloud.com/git-api/schemas/TreeEntry/index.md)