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 form | What it does |
|---|---|
REPOSITORY | owner/name, a full URL, or just a name for your own repository |
DIRECTORY | Folder to clone into |
-- FLAGS | Anything after -- is passed to git clone, such as --depth 1 |
-u, --upstream-remote-name NAME | Name of the remote for the parent when cloning a fork |
Examples
gh repo clone octocat/Hello-World
Cloning into 'Hello-World'...
gh repo clone octocat/Hello-World hello
gh repo clone my-site
gh repo clone octocat/Hello-World -- --depth 1
Notes
- It needs gh auth login first. The git protocol it uses (https or ssh) is the one chosen at login.
- Equivalent to git clone with the full address.
- To fork and clone together, use gh repo fork --clone.
See also
Last reviewed 2026-10-09.