cor*_*eyt 2 google-compute-engine google-cloud-platform google-cloud-shell
我花了太多时间试图弄清楚如何将文件从分配的 Google Cloud Shell VM 复制到我的本地机器。云外壳很棒,但拥有本地副本也很棒。
大部分时间都花在尝试使某种形式的gcloud compute scp
工作上,类似于以下语法:
$ gcloud compute scp some-instance:~/littlefile.zip ~/
但是,除了compute
命令之外,还有alpha cloud-shell
!
无效的方法:
me@mylocalhost:~$ gcloud alpha cloud-shell scp ~/littlefile.zip .
ERROR: (gcloud.alpha.cloud-shell.scp) argument (cloudshell|localhost):SRC: Bad value [/home/me/littlefile.zip]: must start with cloudshell: or localhost:
Run Code Online (Sandbox Code Playgroud)
me@mylocalhost:~$ gcloud alpha cloud-shell scp cloudshell:~/littlefile.zip localhost:~/littlefile.zip
~/littlefile.zip: No such file or directory
ERROR: (gcloud.alpha.cloud-shell.scp) [/usr/bin/scp] exited with return code [1].
Run Code Online (Sandbox Code Playgroud)
提及:如何将文件从 google 计算引擎复制到本地目录,以防其他人找到它但需要 Cloud Shell 命令。
冒着“回答我自己的问题”的风险,我实际上刚刚解决了它!W00T!
有效的方法:
me@mylocalhost:~$ gcloud alpha cloud-shell scp cloudshell:littlefile.zip localhost:.
littlefile.zip 100% 16KB 253.1KB/s 00:00
Run Code Online (Sandbox Code Playgroud)
me@mylocalhost:~$ gcloud alpha cloud-shell scp cloudshell:littlefile.zip localhost:littlefile.zip
littlefile.zip 100% 16KB 212.1KB/s 00:00
Run Code Online (Sandbox Code Playgroud)
me@mylocalhost:~$ gcloud alpha cloud-shell scp cloudshell:~/adirectory/still-littlefile.zip localhost:.
still-littlefile.zip 100% 16KB 198.0KB/s 00:00
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
1931 次 |
最近记录: |