---
title: "Gets the tree of a repository."
method: GET
path: "/repos/{owner}/{repo}/git/trees/{sha}"
tags: ["repository"]
---

# Gets the tree of a repository.

`GET /repos/{owner}/{repo}/git/trees/{sha}`

## Path parameters

- `owner` string, required
- `repo` string, required
- `sha` string, required

## Query parameters

- `recursive` boolean
- `page` integer
- `per_page` integer

## Response `200`

GitTreeResponse

- GitTreeResponse — GitTreeResponse returns a git tree
  - `page` integer — Page is the current page number for pagination
  - `sha` string — SHA is the tree object SHA
  - `total_count` integer — TotalCount is the total number of entries in the tree
  - `tree` GitEntry[] — Entries contains the tree entries (files and directories)
    - `mode` string — Mode is the file mode (permissions)
    - `path` string — Path is the file or directory path
    - `sha` string — SHA is the Git object SHA
    - `size` integer — Size is the file size in bytes
    - `type` string — Type indicates if this is a file, directory, or symlink
    - `url` string — URL is the API URL for this tree entry
  - `truncated` boolean — Truncated indicates if the response was truncated due to size
  - `url` string — URL is the API URL for this tree

## Other responses

- `400` — APIError is error format response
- `404` — APINotFound is a not found empty response

---

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