---
title: "Get a tree"
method: GET
path: "/repos/{owner}/{repo}/git/trees/{tree_sha}"
tags: ["git"]
---

# 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.

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.

> [!NOTE]
> The limit for the `tree` array is 100,000 entries with a maximum size of 7 MB when using the `recursive` parameter.

## Path parameters

- `owner` string, required
- `repo` string, required
- `tree_sha` string, required

## Query parameters

- `recursive` string

## Response `200`

Response

- GitTree — The hierarchy between files in a Git repository.
  - `sha` string, required
  - `url` string, uri
  - `truncated` boolean, required
  - `tree` object[], required — Objects specifying a tree structure
    - `path` string, required
    - `mode` string, required
    - `type` string, required
    - `sha` string, required
    - `size` integer
    - `url` string

## Other responses

- `404` — Resource not found
- `409` — Conflict
- `422` — Validation failed, or the endpoint has been spammed.

---

[API](https://skmtc.net/github/apis/rest-api.md) · [All operations](https://skmtc.net/github/apis/rest-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/github/rest-api/versions/80850db290cd/schema)
