Skip to content
Try Gitea Cloud ☁️ for 30 days → Accelerate your Development & Deploys!
This is the documentation of 1.25.5, which is no longer the latest release. See the latest release.

Gets the tree of a repository.

GET
/repos/{owner}/{repo}/git/trees/{sha}
curl --request GET \
--url https://gitea.com/api/v1/repos/example/example/git/trees/example \
--header 'Authorization: Basic <credentials>'
owner
required
string

Owner of the repo

repo
required
string

Name of the repo

sha
required
string

Sha of the commit

recursive
boolean

Show all directories and files

page
integer

Page number; the ‘truncated’ field in the response will be true if there are still more items after this page, false if the last page

per_page
integer

Number of items per page

GitTreeResponse

Media typeapplication/json

GitTreeResponse returns a git tree

object
page

Page is the current page number for pagination

integer format: int64
sha

SHA is the tree object SHA

string
total_count

TotalCount is the total number of entries in the tree

integer format: int64
tree

Entries contains the tree entries (files and directories)

Array<object>

GitEntry represents a git tree

object
mode

Mode is the file mode (permissions)

string
path

Path is the file or directory path

string
sha

SHA is the Git object SHA

string
size

Size is the file size in bytes

integer format: int64
type

Type indicates if this is a file, directory, or symlink

string
url

URL is the API URL for this tree entry

string
truncated

Truncated indicates if the response was truncated due to size

boolean
url

URL is the API URL for this tree

string
Examplegenerated
{
"page": 1,
"sha": "example",
"total_count": 1,
"tree": [
{
"mode": "example",
"path": "example",
"sha": "example",
"size": 1,
"type": "example",
"url": "example"
}
],
"truncated": true,
"url": "example"
}

APIError is error format response

Media typeapplication/json
message
string
url
string

APINotFound is a not found empty response

Media typeapplication/json