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 …]
gcloud cloud-shell scp copies files between your Cloud Shell
instance and your local machine using the scp command.
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, from
your Cloud Shell instance is copied into the ~/~/REMOTE-DIRLOCAL-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-DIRscp(1) or pscp (on Windows) is used to facilitate
the transfer.
localhost):SRC-[(cloudshell|localhost):SRC-…]">(cloudshell|localhost):SRC [(cloudshell|localhost):SRC …]localhost):DEST">(cloudshell|localhost):DEST--dry-run--force-key-file-overwrite--recurse--scp-flag=SCP_FLAG--ssh-key-file~/.ssh/google_compute_engine.
--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.
gcloud alpha cloud-shell scpgcloud beta cloud-shell scp
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-06-09 UTC.