gh repo clone
Clone a GitHub repository by its short name
What it does
gh repo clone does what git clone does, but owner/repository is enough instead of the full URL. Leave out the owner and gh uses your account: gh repo clone shop.
When you clone your fork, gh adds a remote upstream pointing to the original repository, so you can pull its updates. Flags for git clone go after --: gh repo clone anna/shop -- --depth 1.
Syntax
gh repo clone <owner>/<repository>
gh repo clone <repository> <folder>Examples
Clone the repository shop of the user anna
gh repo clone anna/shopsame as:
gh repo clone https://github.com/anna/shoprepo— work with repositoriesclone— cloneanna/shop— owner/repository, no full URL needed
Related commands
- git clone — Download a repository from a server with its whole history
- gh repo fork — Fork someone else's repository
- gh auth — Sign in to GitHub from the terminal and check who you are signed in as