GH-REPO-CLONE(1)
π NAME
gh-repo-clone β clone a repo to your machine, boom, done, bestie π
β¨ SYNOPSIS
gh repo clone <repository> [<directory>] [-- <gitflags>...]
π¦ DESCRIPTION
Okay so: this clones a GitHub repository locally. That's the whole vibe. And if you wanna pass extra git clone flags? Literally just list them after --. That's it. Slay.
If you leave off the OWNER/ part of the OWNER/REPO repository argument, it defaults to the name of the authenticating user β so you can be lazy, it's fine, we love that for you π«Ά
If you don't give a protocol scheme in the repository argument, then git_protocol gets chosen from your configuration β you can peek at what it's set to with gh config get git_protocol. But if you do provide the protocol scheme, the repo gets cloned using that specified protocol. Periodt.
If the repository is a fork, its parent repository will be added as an additional git remote called upstream. Yep, automatically, no cap. You can rename that remote with --upstream-remote-name. And the --upstream-remote-name option supports an @owner value, which will name the remote after the owner of the parent repository β iconic behavior honestly π
Also (yes, another one): if the repository is a fork, its parent repository will be set as the default remote repository. If you're not about that life, use --no-upstream to skip this behavior.
π OPTIONS
--no-upstreamβ don't add an upstream remote when you're cloning a fork. Sometimes you just want the fork, alone, main character energy.-u,--upstream-remote-name<string>(default"upstream") β the name for the upstream remote when cloning a fork.
π EXIT CODES
0: Successful execution β¨1: Error π2: Command canceled4: Authentication required π
NOTE: Specific commands may have additional exit codes. Refer to the command's help for more information. iykyk π«
π 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
gh-repo(1) β go read that one too bestie, it's giving comprehensive π
Also, since you made it all the way down here: this lil page is from GitHub CLI v2.102.0, dated Oct 2026. Mwah, go clone something cute πΈ
π¦ where this page comes from
- opensuse-leap 16.0: gh 2.102.0-bp160.1.1 Β· MIT
- opensuse-leap 16.0: gh 2.102.0-bp160.1.1 Β· MIT
- opensuse-leap 16.0: gh 2.102.0-bp160.1.1 Β· MIT
- opensuse-leap 16.0: gh 2.102.0-bp160.1.1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms