1GH-CODESPACE-CP(1) GitHub CLI manual GH-CODESPACE-CP(1)
2
3
4
6 gh-codespace-cp - Copy files between local and remote file systems
7
8
9
11 gh codespace cp [-e] [-r] [-- [<scp flags>...]] <sources>... <dest>
12
13
14
16 The cp command copies files between the local and remote file systems.
17
18
19 As with the UNIX cp command, the first argument specifies the source
20 and the last specifies the destination; additional sources may be spec‐
21 ified after the first, if the destination is a directory.
22
23
24 The --recursive flag is required if any source is a directory.
25
26
27 A "remote:" prefix on any file name argument indicates that it refers
28 to the file system of the remote (Codespace) machine. It is resolved
29 relative to the home directory of the remote user.
30
31
32 By default, remote file names are interpreted literally. With the --ex‐
33 pand flag, each such argument is treated in the manner of scp, as a
34 Bash expression to be evaluated on the remote machine, subject to ex‐
35 pansion of tildes, braces, globs, environment variables, and backticks.
36 For security, do not use this flag with arguments provided by untrusted
37 users; see ⟨https://lwn.net/Articles/835962/⟩ for discussion.
38
39
40 By default, the 'cp' command will create a public/private ssh key pair
41 to authenticate with the codespace inside the ~/.ssh directory.
42
43
44
46 -c, --codespace <string>
47 Name of the codespace
48
49
50 -e, --expand
51 Expand remote file names on remote shell
52
53
54 -p, --profile <string>
55 Name of the SSH profile to use
56
57
58 -r, --recursive
59 Recursively copy directories
60
61
62 -R, --repo <string>
63 Filter codespace selection by repository name (user/repo)
64
65
66 --repo-owner <string>
67 Filter codespace selection by repository owner (username or org)
68
69
70
72 $ gh codespace cp -e README.md 'remote:/workspaces/$RepositoryName/'
73 $ gh codespace cp -e 'remote:~/*.go' ./gofiles/
74 $ gh codespace cp -e 'remote:/workspaces/myproj/go.{mod,sum}' ./gofiles/
75 $ gh codespace cp -e -- -F ~/.ssh/codespaces_config 'remote:~/*.go' ./gofiles/
76
77
78
79
80
82 gh-codespace(1)
83
84
85
86 Nov 2023 GH-CODESPACE-CP(1)