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/ ⟨https://lwn.net/Arti‐
38 cles/835962/⟩ for discussion.
39
40
41 By default, the 'cp' command will create a public/private ssh key pair
42 to authenticate with the codespace inside the ~/.ssh directory.
43
44
45
47 -c, --codespace <string>
48 Name of the codespace
49
50
51 -e, --expand
52 Expand remote file names on remote shell
53
54
55 -p, --profile <string>
56 Name of the SSH profile to use
57
58
59 -r, --recursive
60 Recursively copy directories
61
62
63
65 $ gh codespace cp -e README.md 'remote:/workspaces/$RepositoryName/'
66 $ gh codespace cp -e 'remote:~/*.go' ./gofiles/
67 $ gh codespace cp -e 'remote:/workspaces/myproj/go.{mod,sum}' ./gofiles/
68 $ gh codespace cp -e -- -F ~/.ssh/codespaces_config 'remote:~/*.go' ./gofiles/
69
70
71
72
73
75 gh-codespace(1)
76
77
78
79 Jan 2023 GH-CODESPACE-CP(1)