.nh .TH "GH-CODESPACE-CP" "1" "Oct 2024" "GitHub CLI 2.58.0" "GitHub CLI manual" .SH NAME gh-codespace-cp - Copy files between local and remote file systems .SH SYNOPSIS \fBgh codespace cp [-e] [-r] [-- [...]] ... \fR .SH DESCRIPTION The \fBcp\fR command copies files between the local and remote file systems. .PP As with the UNIX \fBcp\fR command, the first argument specifies the source and the last specifies the destination; additional sources may be specified after the first, if the destination is a directory. .PP The \fB--recursive\fR flag is required if any source is a directory. .PP A \fBremote:\fR prefix on any file name argument indicates that it refers to the file system of the remote (Codespace) machine. It is resolved relative to the home directory of the remote user. .PP By default, remote file names are interpreted literally. With the \fB--expand\fR flag, each such argument is treated in the manner of \fBscp\fR, as a Bash expression to be evaluated on the remote machine, subject to expansion of tildes, braces, globs, environment variables, and backticks. For security, do not use this flag with arguments provided by untrusted users; see \[la]https://lwn.net/Articles/835962/\[ra] for discussion. .PP By default, the \fBcp\fR command will create a public/private ssh key pair to authenticate with the codespace inside the \fB~/.ssh directory\fR\&. .SH OPTIONS .TP \fB-c\fR, \fB--codespace\fR \fB\fR Name of the codespace .TP \fB-e\fR, \fB--expand\fR Expand remote file names on remote shell .TP \fB-p\fR, \fB--profile\fR \fB\fR Name of the SSH profile to use .TP \fB-r\fR, \fB--recursive\fR Recursively copy directories .TP \fB-R\fR, \fB--repo\fR \fB\fR Filter codespace selection by repository name (user/repo) .TP \fB--repo-owner\fR \fB\fR Filter codespace selection by repository owner (username or org) .SH EXIT CODES 0: Successful execution .PP 1: Error .PP 2: Command canceled .PP 4: Authentication required .PP NOTE: Specific commands may have additional exit codes. Refer to the command's help for more information. .SH EXAMPLE .EX $ gh codespace cp -e README.md 'remote:/workspaces/$RepositoryName/' $ gh codespace cp -e 'remote:~/*.go' ./gofiles/ $ gh codespace cp -e 'remote:/workspaces/myproj/go.{mod,sum}' ./gofiles/ $ gh codespace cp -e -- -F ~/.ssh/codespaces_config 'remote:~/*.go' ./gofiles/ .EE .SH SEE ALSO \fBgh-codespace(1)\fR