mirror of
https://github.com/imjasonh/gcloud-help
synced 2026-07-08 18:45:13 +00:00
81 lines
2.7 KiB
Text
81 lines
2.7 KiB
Text
|
|
NAME
|
||
|
|
gcloud cloud-shell scp - copies files between Cloud Shell and the local
|
||
|
|
machine
|
||
|
|
|
||
|
|
SYNOPSIS
|
||
|
|
gcloud cloud-shell scp (cloudshell|localhost):SRC
|
||
|
|
[(cloudshell|localhost):SRC ...] (cloudshell|localhost):DEST
|
||
|
|
[--dry-run] [--force-key-file-overwrite] [--recurse]
|
||
|
|
[--scp-flag=SCP_FLAG] [--ssh-key-file] [GCLOUD_WIDE_FLAG ...]
|
||
|
|
|
||
|
|
DESCRIPTION
|
||
|
|
gcloud cloud-shell scp copies files between your Cloud Shell instance and
|
||
|
|
your local machine using the scp command.
|
||
|
|
|
||
|
|
EXAMPLES
|
||
|
|
To denote a file in Cloud Shell, prefix the file name with the string
|
||
|
|
"cloudshell:" (e.g. cloudshell:~/FILE). To denote a local file, prefix the
|
||
|
|
file name with the string "localhost:" (e.g. localhost:~/FILE). For
|
||
|
|
example, to copy a remote directory to your local machine, run:
|
||
|
|
|
||
|
|
$ gcloud cloud-shell scp cloudshell:~/REMOTE-DIR \
|
||
|
|
localhost:~/LOCAL-DIR
|
||
|
|
|
||
|
|
In the above example, ~/REMOTE-DIR from your Cloud Shell instance is copied
|
||
|
|
into the ~/LOCAL-DIR directory.
|
||
|
|
|
||
|
|
Conversely, files from your local computer can be copied into Cloud Shell:
|
||
|
|
|
||
|
|
$ gcloud cloud-shell scp localhost:~/LOCAL-FILE-1 \
|
||
|
|
localhost:~/LOCAL-FILE-2 cloudshell:~/REMOTE-DIR
|
||
|
|
|
||
|
|
Under the covers, scp(1) or pscp (on Windows) is used to facilitate the
|
||
|
|
transfer.
|
||
|
|
|
||
|
|
POSITIONAL ARGUMENTS
|
||
|
|
(cloudshell|localhost):SRC [(cloudshell|localhost):SRC ...]
|
||
|
|
Specifies the files to copy.
|
||
|
|
|
||
|
|
(cloudshell|localhost):DEST
|
||
|
|
Specifies a destination for the source files.
|
||
|
|
|
||
|
|
FLAGS
|
||
|
|
--dry-run
|
||
|
|
If provided, prints the command that would be run to standard out
|
||
|
|
instead of executing it.
|
||
|
|
|
||
|
|
--force-key-file-overwrite
|
||
|
|
If enabled gcloud will regenerate and overwrite the files associated
|
||
|
|
with a broken SSH key without asking for confirmation in both
|
||
|
|
interactive and non-interactive environment.
|
||
|
|
|
||
|
|
If disabled gcloud will not attempt to regenerate the files associated
|
||
|
|
with a broken SSH key and fail in both interactive and non-interactive
|
||
|
|
environment.
|
||
|
|
|
||
|
|
--recurse
|
||
|
|
Upload directories recursively.
|
||
|
|
|
||
|
|
--scp-flag=SCP_FLAG
|
||
|
|
Extra flag to be sent to scp. This flag may be repeated.
|
||
|
|
|
||
|
|
--ssh-key-file
|
||
|
|
The path to the SSH key file. By default, this is
|
||
|
|
~/.ssh/google_compute_engine.
|
||
|
|
|
||
|
|
GCLOUD WIDE FLAGS
|
||
|
|
These flags are available to all commands: --access-token-file, --account,
|
||
|
|
--billing-project, --configuration, --flags-file, --flatten, --format,
|
||
|
|
--help, --impersonate-service-account, --log-http, --project, --quiet,
|
||
|
|
--trace-token, --user-output-enabled, --verbosity.
|
||
|
|
|
||
|
|
Run $ gcloud help for details.
|
||
|
|
|
||
|
|
NOTES
|
||
|
|
These variants are also available:
|
||
|
|
|
||
|
|
$ gcloud alpha cloud-shell scp
|
||
|
|
|
||
|
|
$ gcloud beta cloud-shell scp
|
||
|
|
|