GH-REPO-CLONE(1) GitHub CLI manual GH-REPO-CLONE(1)

# [NAME](#NAME)

gh-repo-clone - Clone a repository locally

# [SYNOPSIS](#SYNOPSIS)

**gh repo clone &lt;repository&gt; \[&lt;directory&gt;] \[-- &lt;gitflags&gt;...]**

# [DESCRIPTION](#DESCRIPTION)

Clone a GitHub repository locally. Pass additional **git clone** flags by listing them after **--**.

If the **OWNER/** portion of the **OWNER/REPO** repository argument is omitted, it defaults to the name of the authenticating user.

When a protocol scheme is not provided in the repository argument, the **git\_protocol** will be chosen from your configuration, which can be checked via **gh config get git\_protocol**. If the protocol scheme is provided, the repository will be cloned using the specified protocol.

If the repository is a fork, its parent repository will be added as an additional git remote called **upstream**. The remote name can be configured using **--upstream-remote-name**. The **--upstream-remote-name** option supports an **@owner** value which will name the remote after the owner of the parent repository.

If the repository is a fork, its parent repository will be set as the default remote repository. To skip this behavior, use **--no-upstream**.

# [OPTIONS](#OPTIONS)

[**--no-upstream**](#no_upstream)

Do not add an upstream remote when cloning a fork

[**-u**, **--upstream-remote-name** **&lt;string&gt; (default "upstream")**](#u)

Upstream remote name when cloning a fork

# [EXIT CODES](#EXIT_CODES)

0: Successful execution

1: Error

2: Command canceled

4: Authentication required

NOTE: Specific commands may have additional exit codes. Refer to the command's help for more information.

# [EXAMPLE](#EXAMPLE)

```
# Clone a repository from a specific org
$ gh repo clone cli/cli
# Clone a repository from your own account
$ gh repo clone myrepo
# Clone a repo, overriding git protocol configuration
$ gh repo clone https://github.com/cli/cli
$ gh repo clone git@github.com:cli/cli.git
# Clone a repository to a custom directory
$ gh repo clone cli/cli workspace/cli
# Clone a repository with additional git clone flags
$ gh repo clone cli/cli -- --depth=1
# Clone a fork without adding an upstream remote
$ gh repo clone myfork --no-upstream
```

# [SEE ALSO](#SEE_ALSO)

[**gh-repo(1)**](/man/os/gh/gh-repo.1)

Oct 2026

---

Document: gh-repo-clone(1) from gh 2.102.1-r0 (Chainguard OS)
Source: https://github.com/cli/cli
