v50

latestOpenAPI 3.0.3MITraw.githubusercontent.com2024-01-0382859610.0 MB
git

Create a commit

Creates a new Git commit object.

Signature verification object

The response will include a verification object that describes the result of verifying the commit's signature. The following fields are included in the verification object:

NameTypeDescription
verifiedbooleanIndicates whether GitHub considers the signature in this commit to be verified.
reasonstringThe reason for verified value. Possible values and their meanings are enumerated in the table below.
signaturestringThe signature that was extracted from the commit.
payloadstringThe value that was signed.

These are the possible values for reason in the verification object:

ValueDescription
expired_keyThe key that made the signature is expired.
not_signing_keyThe "signing" flag is not among the usage flags in the GPG key that made the signature.
gpgverify_errorThere was an error communicating with the signature verification service.
gpgverify_unavailableThe signature verification service is currently unavailable.
unsignedThe object does not include a signature.
unknown_signature_typeA non-PGP signature was found in the commit.
no_userNo user was associated with the committer email address in the commit.
unverified_emailThe committer email address in the commit was associated with a user, but the email address is not verified on their account.
bad_emailThe committer email address in the commit is not included in the identities of the PGP key that made the signature.
unknown_keyThe key that made the signature has not been registered with any user's account.
malformed_signatureThere was an error parsing the signature.
invalidThe signature could not be cryptographically verified using the key whose key-id was found in the signature.
validNone of the above errors applied, so the signature is considered to be verified.
post/repos/{owner}/{repo}/git/commits

Path parameters

ownerstring required

The account owner of the repository. The name is not case sensitive.

repostring required

The name of the repository without the .git extension. The name is not case sensitive.

Request body

messagestring required

The commit message

treestring required

The SHA of the tree object this commit points to

parentsstring[]

The SHAs of the commits that were the parents of this commit. If omitted or empty, the commit will be written as a root commit. For a single parent, an array of one SHA should be provided; for a merge commit, an array of more than one should be provided.

signaturestring

The PGP signature of the commit. GitHub adds the signature to the gpgsig header of the created commit. For a commit signature to be verifiable by Git or GitHub, it must be an ASCII-armored detached PGP signature over the string commit as it would be written to the object database. To pass a signature parameter, you need to first manually create a valid PGP signature, which can be complicated. You may find it easier to use the command line to create signed commits.

Response

Response

shastring required

SHA for the commit

node_idstring required
urlstring uri required
messagestring required

Message describing the purpose of the commit

html_urlstring uri required

Example response

{
  "sha": "7638417db6d59f3c431d3e1f261cc637155684cd",
  "author": {
    "date": "2014-08-09T08:02:04+12:00",
    "email": "monalisa.octocat@example.com",
    "name": "Monalisa Octocat"
  },
  "committer": {
    "date": "2014-08-09T08:02:04+12:00",
    "email": "monalisa.octocat@example.com",
    "name": "Monalisa Octocat"
  },
  "message": "Fix #42",
  "tree": {
    "sha": "7638417db6d59f3c431d3e1f261cc637155684cd"
  },
  "parents": [
    {
      "sha": "7638417db6d59f3c431d3e1f261cc637155684cd"
    }
  ]
}