GT-REPO-CLONE(1) gitea-cli Manual GT-REPO-CLONE(1)

gt-repo-clone - Clone a repository locally

gt repo clone <repository> [<directory>] [-- <gitflags>...] [flags]

Clone a repository with gt's credentials, over the protocol of a URL argument, else the configured Git protocol. Git flags can follow --. A fork's parent is added as the "upstream" remote (or the --upstream-remote-name one), and gt commands in the clone then target the parent; with remote names other than upstream and origin, it is saved as with gt repo set-default. A pull mirror's source is added as the "source" remote; gt commands keep targeting the mirror. An HTTPS clone keeps the instance's stored TLS client certificate and --insecure setting in its Git configuration; GITEA_INSTANCE_INSECURE applies to the clone only. With --find-instance, when no instance is selected and accounts exist on several, the repository is looked up on each of them; if more than one has it, gt asks which to clone from, or fails without prompts. The lookup sends the repository name to every instance with an account.

A repository can be supplied as NAME (one of yours), OWNER/NAME, HOST/OWNER/NAME or a URL.

actions_enabled, archived, clone_url, default_branch, description, empty,
fork, forks_count, full_name, id, mirror, mirror_interval, name,
open_issues_count, open_pr_count, original_url, parent, private, ssh_url,
stars_count, template, topics, updated_at, url, website

-d, --depth=0 Number of commits to fetch (0: full history)

--find-instance[=false] Look the repository up on each instance with an account when none is selected

-h, --help[=false] help for clone

--no-upstream[=false] Do not add a remote for the parent of a fork or the source of a mirror

-u, --upstream-remote-name="upstream" Remote name for the parent of a fork

--csv[=""] Output CSV with the specified comma-separated fields, or all fields

--cwd="" Working directory for repository discovery

--debug[=false] Log the method, URL, status, and duration of each HTTP request to stderr

--host="" Gitea instance URL, including any base path

--interactive[=false] Allow prompts with machine output

-q, --jq="" Filter JSON output using a jq expression; implies --json

--json[=""] Output JSON with the specified comma-separated fields, or all fields

--no-input[=false] Disable prompts and implicit editor/browser interactions

--sudo="" Perform API requests as this user (requires an administrator account)

--template="" Format JSON output using a Go template; implies --json (see gt help formatting)

--user="" Account name on the selected instance

# Clone a repository into ./project
$ gt repo clone alice/project
# Clone into another directory with the last commit only
$ gt repo clone alice/project src --depth 1
# Clone from whichever instance with an account has the repository
$ gt repo clone alice/project --find-instance
# Clone over SSH whatever the configured Git protocol
$ gt repo clone git@gitea.com:alice/project.git
# Pass flags to git clone
$ gt repo clone alice/project -- --branch develop --recurse-submodules

gt-repo(1)

Nov 2026 gitea-cli