← All tags

Git API Reference

Raw Git functionality.

13 endpoints tagged git, each listing its parameters and possible responses. Search or scroll the index below to jump to a specific endpoint.

No endpoints match your search.

Create a blob

POST /repos/{owner}/{repo}/git/blobs

Parameters

NameInRequiredDescription
ownerpathyesThe account owner of the repository. The name is not case sensitive.
repopathyesThe name of the repository without the .git extension. The name is not case sensitive.

Responses

StatusDescriptionHas JSON body
201Responseyes
404Resource not foundyes
409Conflictyes
403Forbiddenyes
422Validation failedyes

Get a blob

GET /repos/{owner}/{repo}/git/blobs/{file_sha}

The content in the response will always be Base64 encoded.

Parameters

NameInRequiredDescription
ownerpathyesThe account owner of the repository. The name is not case sensitive.
repopathyesThe name of the repository without the .git extension. The name is not case sensitive.
file_shapathyes

Responses

StatusDescriptionHas JSON body
200Responseyes
404Resource not foundyes
422Validation failed, or the endpoint has been spammed.yes
403Forbiddenyes
409Conflictyes

Create a commit

POST /repos/{owner}/{repo}/git/commits

Creates a new Git commit object.

Parameters

NameInRequiredDescription
ownerpathyesThe account owner of the repository. The name is not case sensitive.
repopathyesThe name of the repository without the .git extension. The name is not case sensitive.

Responses

StatusDescriptionHas JSON body
201Responseyes
422Validation failed, or the endpoint has been spammed.yes
404Resource not foundyes
409Conflictyes

Get a commit object

GET /repos/{owner}/{repo}/git/commits/{commit_sha}

Gets a Git commit object.

Parameters

NameInRequiredDescription
ownerpathyesThe account owner of the repository. The name is not case sensitive.
repopathyesThe name of the repository without the .git extension. The name is not case sensitive.
commit_shapathyesThe SHA of the commit.

Responses

StatusDescriptionHas JSON body
200Responseyes
404Resource not foundyes
409Conflictyes

List matching references

GET /repos/{owner}/{repo}/git/matching-refs/{ref}

Returns an array of references from your Git database that match the supplied name. The :ref in the URL must be formatted as heads/<branch name> for branches and tags/<tag name> for tags. If the :ref doesn't exist in the repository, but existing refs start with :ref, they will be returned as an array.

Parameters

NameInRequiredDescription
ownerpathyesThe account owner of the repository. The name is not case sensitive.
repopathyesThe name of the repository without the .git extension. The name is not case sensitive.
refpathyesThe Git reference. For more information, see "Git References" in the Git documentation.

Responses

StatusDescriptionHas JSON body
200Responseyes
409Conflictyes

Get a reference

GET /repos/{owner}/{repo}/git/ref/{ref}

Returns a single reference from your Git database. The :ref in the URL must be formatted as heads/<branch name> for branches and tags/<tag name> for tags. If the :ref doesn't match an existing ref, a 404 is returned.

Parameters

NameInRequiredDescription
ownerpathyesThe account owner of the repository. The name is not case sensitive.
repopathyesThe name of the repository without the .git extension. The name is not case sensitive.
refpathyesThe Git reference. For more information, see "Git References" in the Git documentation.

Responses

StatusDescriptionHas JSON body
200Responseyes
404Resource not foundyes
409Conflictyes

Create a reference

POST /repos/{owner}/{repo}/git/refs

Creates a reference for your repository. You are unable to create new references for empty repositories, even if the commit SHA-1 hash used exists. Empty repositories are repositories without branches.

Parameters

NameInRequiredDescription
ownerpathyesThe account owner of the repository. The name is not case sensitive.
repopathyesThe name of the repository without the .git extension. The name is not case sensitive.

Responses

StatusDescriptionHas JSON body
201Responseyes
422Validation failed, or the endpoint has been spammed.yes
409Conflictyes

Update a reference

PATCH /repos/{owner}/{repo}/git/refs/{ref}

Updates the provided reference to point to a new SHA. For more information, see "Git References" in the Git documentation.

Parameters

NameInRequiredDescription
ownerpathyesThe account owner of the repository. The name is not case sensitive.
repopathyesThe name of the repository without the .git extension. The name is not case sensitive.
refpathyesThe Git reference. For more information, see "Git References" in the Git documentation.

Responses

StatusDescriptionHas JSON body
200Responseyes
422Validation failed, or the endpoint has been spammed.yes
409Conflictyes

Delete a reference

DELETE /repos/{owner}/{repo}/git/refs/{ref}

Deletes the provided reference.

Parameters

NameInRequiredDescription
ownerpathyesThe account owner of the repository. The name is not case sensitive.
repopathyesThe name of the repository without the .git extension. The name is not case sensitive.
refpathyesThe Git reference. For more information, see "Git References" in the Git documentation.

Responses

StatusDescriptionHas JSON body
204Responseno
422Validation failed, an attempt was made to delete the default branch, or the endpoint has been spammed.no
409Conflictyes

Create a tag object

POST /repos/{owner}/{repo}/git/tags

Note that creating a tag object does not create the reference that makes a tag in Git. If you want to create an annotated tag in Git, you have to do this call to create the tag object, and then create the refs/tags/[tag] reference. If you want to create a lightweight tag, you only have to create the tag reference - this call would be unnecessary.

Parameters

NameInRequiredDescription
ownerpathyesThe account owner of the repository. The name is not case sensitive.
repopathyesThe name of the repository without the .git extension. The name is not case sensitive.

Responses

StatusDescriptionHas JSON body
201Responseyes
422Validation failed, or the endpoint has been spammed.yes
409Conflictyes

Get a tag

GET /repos/{owner}/{repo}/git/tags/{tag_sha}

Signature verification object

Parameters

NameInRequiredDescription
ownerpathyesThe account owner of the repository. The name is not case sensitive.
repopathyesThe name of the repository without the .git extension. The name is not case sensitive.
tag_shapathyes

Responses

StatusDescriptionHas JSON body
200Responseyes
404Resource not foundyes
409Conflictyes

Create a tree

POST /repos/{owner}/{repo}/git/trees

The tree creation API accepts nested entries. If you specify both a tree and a nested path modifying that tree, this endpoint will overwrite the contents of the tree with the new path contents, and create a new tree structure.

Parameters

NameInRequiredDescription
ownerpathyesThe account owner of the repository. The name is not case sensitive.
repopathyesThe name of the repository without the .git extension. The name is not case sensitive.

Responses

StatusDescriptionHas JSON body
201Responseyes
422Validation failed, or the endpoint has been spammed.yes
404Resource not foundyes
403Forbiddenyes
409Conflictyes

Get a tree

GET /repos/{owner}/{repo}/git/trees/{tree_sha}

Returns a single tree using the SHA1 value or ref name for that tree.

Parameters

NameInRequiredDescription
ownerpathyesThe account owner of the repository. The name is not case sensitive.
repopathyesThe name of the repository without the .git extension. The name is not case sensitive.
tree_shapathyesThe SHA1 value or ref (branch or tag) name of the tree.
recursivequerynoSetting this parameter to any value returns the objects or subtrees referenced by the tree specified in :tree_sha. For example, setting recursive to any of the following will enable returning objects or subtrees: 0, 1, "true", and "false". Omit this parameter to prevent recursively returning objects or subtrees.

Responses

StatusDescriptionHas JSON body
200Responseyes
422Validation failed, or the endpoint has been spammed.yes
404Resource not foundyes
409Conflictyes