gh repo clone

Clone a repository locally


Clone a GitHub repository locally.

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

To pass ‘git clone’ flags, separate them with ‘–’.

gh repo clone <repository> [<directory>] [flags]

Options inherited from parent commands

      --help              Show help for command
  -R, --repo OWNER/REPO   Select another repository using the OWNER/REPO format

Examples in use

Using OWNER/REPO syntax

You can clone any repository using OWNER/REPO syntax.

# Cloning a repository
~/Projects$ gh repo clone cli/cli
Cloning into 'cli'...
~/Projects$ cd cli

Using other selectors

You can also use GitHub URLs to clone repositories.

# Cloning a repository
~/Projects/my-project$ gh repo clone
Cloning into 'cli'...
remote: Enumerating objects: 99, done.
remote: Counting objects: 100% (99/99), done.
remote: Compressing objects: 100% (76/76), done.
remote: Total 21160 (delta 49), reused 35 (delta 18), pack-reused 21061
Receiving objects: 100% (21160/21160), 57.93 MiB | 10.82 MiB/s, done.
Resolving deltas: 100% (16051/16051), done.