Get a tree
Returns a single tree using the SHA1 value for that tree. If `truncated` is `true` in the response then the number of items in the `tree` array exceeded our maximum limit. If you need to fetch more items, use the non-recursive method of fetching trees, and fetch one sub-tree at a time.
/repos/{owner}/{repo}/git/trees/{tree_sha}- Source
github-v3-rest.json- Revision
f5f067c1e6f6- Active snapshot
85e53e3d0d65
Request
Path Parameters
- owner stringrequired
- repo stringrequired
- tree_sha stringrequired
Query Parameters
- recursive stringoptional
Setting 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
Response
tree array[object]requiredObjects specifying a tree structure
Example:[
{
"mode": "100644",
"path": "file.rb",
"properties": {
"mode": {
"type": "string"
},
"path": {
"type": "string"
},
"sha": {
"type": "string"
},
"size": {
"type": "integer"
},
"type": {
"type": "string"
},
"url": {
"type": "string"
}
},
"required": [
"path",
"mode",
"type",
"sha",
"url",
"size"
],
"sha": "44b4fc6d56897b048c772eb4087f854f46256132",
"size": 30,
"type": "blob",
"url": "https://api.github.com/repos/octocat/Hello-World/git/blobs/44b4fc6d56897b048c772eb4087f854f46256132"
}
]
Objects specifying a tree structure
[
{
"mode": "100644",
"path": "file.rb",
"properties": {
"mode": {
"type": "string"
},
"path": {
"type": "string"
},
"sha": {
"type": "string"
},
"size": {
"type": "integer"
},
"type": {
"type": "string"
},
"url": {
"type": "string"
}
},
"required": [
"path",
"mode",
"type",
"sha",
"url",
"size"
],
"sha": "44b4fc6d56897b048c772eb4087f854f46256132",
"size": 30,
"type": "blob",
"url": "https://api.github.com/repos/octocat/Hello-World/git/blobs/44b4fc6d56897b048c772eb4087f854f46256132"
}
] items object
Example: 040000
Example: test/file.rb
Example: 23f6827669e43831def8a7ad935069c8bd418261
Example: 12
Example: tree
https://api.github.com/repos/owner-482f3203ecf01f67e9deb18e/BBB_Private_Repo/git/blobs/23f6827669e43831def8a7ad935069c8bd418261Resource not found
Validation failed