Get a commit
Returns the contents of a single commit reference. You must have `read` access for the repository to use this endpoint. **Note:** If there are more than 300 files in the commit diff, the response will include pagination link headers for the remaining files, up to a limit of 3000 files. Each page contains the static commit information, and the only changes are to the file listing. You can pass the appropriate [media type](https://docs.github.com/[email protected]/rest/overview/media-types/#commits-commit-comparison-and-pull-requests) to fetch `diff` and `patch` formats. Diffs with binary data will have no `patch` property. To return only the SHA-1 hash of the commit reference, you can provide the `sha` custom [media type](https://docs.github.com/[email protected]/rest/overview/media-types/#commits-commit-comparison-and-pull-requests) in the `Accept` header. You can use this endpoint to check if a remote reference's SHA-1 hash is the same as your local reference's SHA-1 hash by providing the local SHA-1 reference as the ETag. **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: | Name | Type | Description | | ---- | ---- | ----------- | | `verified` | `boolean` | Indicates whether GitHub considers the signature in this commit to be verified. | | `reason` | `string` | The reason for verified value. Possible values and their meanings are enumerated in table below. | | `signature` | `string` | The signature that was extracted from the commit. | | `payload` | `string` | The value that was signed. | These are the possible values for `reason` in the `verification` object: | Value | Description | | ----- | ----------- | | `expired_key` | The key that made the signature is expired. | | `not_signing_key` | The "signing" flag is not among the usage flags in the GPG key that made the signature. | | `gpgverify_error` | There was an error communicating with the signature verification service. | | `gpgverify_unavailable` | The signature verification service is currently unavailable. | | `unsigned` | The object does not include a signature. | | `unknown_signature_type` | A non-PGP signature was found in the commit. | | `no_user` | No user was associated with the `committer` email address in the commit. | | `unverified_email` | The `committer` email address in the commit was associated with a user, but the email address is not verified on her/his account. | | `bad_email` | The `committer` email address in the commit is not included in the identities of the PGP key that made the signature. | | `unknown_key` | The key that made the signature has not been registered with any user's account. | | `malformed_signature` | There was an error parsing the signature. | | `invalid` | The signature could not be cryptographically verified using the key whose key-id was found in the signature. | | `valid` | None of the above errors applied, so the signature is considered to be verified. |
/repos/{owner}/{repo}/commits/{ref}- Source
github-v3-rest.json- Revision
f5f067c1e6f6- Active snapshot
85e53e3d0d65
Request
Path Parameters
- owner stringrequired
- repo stringrequired
- ref stringrequired
ref parameter
Query Parameters
- page integeroptional
Page number of the results to fetch.
- per_page integeroptional
Results per page (max 100)
Responses
Response
author Simple User objectrequirednullable Simple User
Simple User
Example: https://github.com/images/error/octocat_happy.gif
Example: https://api.github.com/users/octocat/events{/privacy}
Example: https://api.github.com/users/octocat/followers
Example: https://api.github.com/users/octocat/following{/other_user}
Example: https://api.github.com/users/octocat/gists{/gist_id}
Example: 41d064eb2195891e12d0413f63227ea7
Example: https://github.com/octocat
Example: 1
Example: octocat
Example: MDQ6VXNlcjE=
Example: https://api.github.com/users/octocat/orgs
Example: https://api.github.com/users/octocat/received_events
Example: https://api.github.com/users/octocat/repos
Example: "2020-07-09T00:17:55Z"
Example: https://api.github.com/users/octocat/starred{/owner}{/repo}
Example: https://api.github.com/users/octocat/subscriptions
Example: User
Example: https://api.github.com/users/octocat
https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e/comments commit objectrequired
author Git User objectrequirednullable Metaproperties for Git author/committer information.
Metaproperties for Git author/committer information.
Example: "2007-10-29T02:42:39.000-07:00"
Example: "[email protected]"
Example: "Chris Wanstrath"
Example: 0
committer Git User objectrequirednullable Metaproperties for Git author/committer information.
Metaproperties for Git author/committer information.
Example: "2007-10-29T02:42:39.000-07:00"
Example: "[email protected]"
Example: "Chris Wanstrath"
Example: Fix all the bugs
tree objectrequired
Example: 827efc6d56897b048c772eb4087f854f46256132
Example: https://api.github.com/repos/octocat/Hello-World/tree/827efc6d56897b048c772eb4087f854f46256132
https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e verification Verification objectoptional
committer Simple User objectrequirednullable Simple User
Simple User
Example: https://github.com/images/error/octocat_happy.gif
Example: https://api.github.com/users/octocat/events{/privacy}
Example: https://api.github.com/users/octocat/followers
Example: https://api.github.com/users/octocat/following{/other_user}
Example: https://api.github.com/users/octocat/gists{/gist_id}
Example: 41d064eb2195891e12d0413f63227ea7
Example: https://github.com/octocat
Example: 1
Example: octocat
Example: MDQ6VXNlcjE=
Example: https://api.github.com/users/octocat/orgs
Example: https://api.github.com/users/octocat/received_events
Example: https://api.github.com/users/octocat/repos
Example: "2020-07-09T00:17:55Z"
Example: https://api.github.com/users/octocat/starred{/owner}{/repo}
Example: https://api.github.com/users/octocat/subscriptions
Example: User
Example: https://api.github.com/users/octocat
files array[Diff Entry object]optional
items Diff Entry objectDiff Entry
Diff Entry
Example: 103
Example: https://github.com/octocat/Hello-World/blob/6dcb09b5b57875f334f61aebed695e2e4193db5e/file1.txt
Example: 124
https://api.github.com/repos/octocat/Hello-World/contents/file1.txt?ref=6dcb09b5b57875f334f61aebed695e2e4193db5eExample: 21
Example: file1.txt
Example: @@ -132,7 +132,7 @@ module Test @@ -1000,7 +1000,7 @@ module Test
Example: file.txt
Example: https://github.com/octocat/Hello-World/raw/6dcb09b5b57875f334f61aebed695e2e4193db5e/file1.txt
Example: bbcd538c8e72b8c175046e27cc8f907076331401
Example: added
Example: https://github.com/octocat/Hello-World/commit/6dcb09b5b57875f334f61aebed695e2e4193db5e
Example: MDY6Q29tbWl0NmRjYjA5YjViNTc4NzVmMzM0ZjYxYWViZWQ2OTVlMmU0MTkzZGI1ZQ==
parents array[object]required
items object
Example: https://github.com/octocat/Hello-World/commit/7638417db6d59f3c431d3e1f261cc637155684cd
Example: 7638417db6d59f3c431d3e1f261cc637155684cd
https://api.github.com/repos/octocat/Hello-World/commits/7638417db6d59f3c431d3e1f261cc637155684cdExample: 6dcb09b5b57875f334f61aebed695e2e4193db5e
stats objectoptional
https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5eResource not found
Validation failed
errors array[object]optional
items object
Internal Error