gh repo clone Clone a GitHub repository by name

Clones a repository using just owner/name, picking the right address for you. If you cloned your own fork, it sets up the upstream remote as well.

Synopsis

gh repo clone REPOSITORY [DIRECTORY] [-- GIT-FLAGS]

Common options

Option or formWhat it does
REPOSITORYowner/name, a full URL, or just a name for your own repository
DIRECTORYFolder to clone into
-- FLAGSAnything after -- is passed to git clone, such as --depth 1
-u, --upstream-remote-name NAMEName of the remote for the parent when cloning a fork

Examples

Clone a repository
gh repo clone octocat/Hello-World
Cloning into 'Hello-World'...
Clone into a named folder
gh repo clone octocat/Hello-World hello
Clone one of your own by short name
gh repo clone my-site
Clone with only recent history
gh repo clone octocat/Hello-World -- --depth 1

Notes

See also

Last reviewed 2026-10-09.