---
name: "gt-repo-clone"
section: "1"
platform: "linux"
package: "gitea-cli"
version: "1.0.0-1"
release: "Arch Linux 2026-11-07"
platforms: ["linux"]
url: "https://carta.tech/man/gt-repo-clone"
---

# gt-repo-clone(1)

Clone a repository locally

## NAME

gt-repo-clone - Clone a repository locally

## SYNOPSIS

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

## DESCRIPTION

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.

### ARGUMENTS

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

### JSON FIELDS

```
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
```

## OPTIONS

**-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

## OPTIONS INHERITED FROM PARENT COMMANDS

**--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)

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

## EXAMPLE

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

## SEE ALSO

**[gt-repo(1)](/man/gt-repo/1.md)**
