.nh .TH "GH-REPO-CLONE" "1" "May 2024" "" "GitHub CLI manual" .SH NAME .PP gh-repo-clone - Clone a repository locally .SH SYNOPSIS .PP \fBgh repo clone [] [-- ...]\fR .SH DESCRIPTION .PP Clone a GitHub repository locally. Pass additional \fBgit clone\fR flags by listing them after \fB--\fR\&. .PP If the \fBOWNER/\fR portion of the \fBOWNER/REPO\fR repository argument is omitted, it defaults to the name of the authenticating user. .PP When a protocol scheme is not provided in the repository argument, the \fBgit_protocol\fR will be chosen from your configuration, which can be checked via \fBgh config get git_protocol\fR\&. If the protocol scheme is provided, the repository will be cloned using the specified protocol. .PP If the repository is a fork, its parent repository will be added as an additional git remote called \fBupstream\fR\&. The remote name can be configured using \fB--upstream-remote-name\fR\&. The \fB--upstream-remote-name\fR option supports an \fB@owner\fR value which will name the remote after the owner of the parent repository. .PP If the repository is a fork, its parent repository will be set as the default remote repository. .SH OPTIONS .TP \fB-u\fR, \fB--upstream-remote-name\fR \fB (default "upstream")\fR Upstream remote name when cloning a fork .SH EXAMPLE .EX # 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 .EE .SH SEE ALSO .PP \fBgh-repo(1)\fR