【问题标题】:How to copy files from Google Cloud to local machine? (Cloud Shell)如何将文件从 Google Cloud 复制到本地机器? (云壳)
【发布时间】:2019-11-06 20:28:13
【问题描述】:

我花了太多时间试图弄清楚如何将文件从分配的 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:

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].

提及:How to copy files from google compute engine to local directory 以防其他人找到它但需要 Cloud Shell 命令。

【问题讨论】:

    标签: google-cloud-platform google-compute-engine google-cloud-shell


    【解决方案1】:

    冒着“回答我自己的问题”的风险,我实际上刚刚解决了它! W00T!

    行之有效的方法:

    me@mylocalhost:~$ gcloud alpha cloud-shell scp cloudshell:littlefile.zip localhost:.
    littlefile.zip            100%   16KB 253.1KB/s   00:00
    
    me@mylocalhost:~$ gcloud alpha cloud-shell scp cloudshell:littlefile.zip localhost:littlefile.zip
    littlefile.zip            100%   16KB 212.1KB/s   00:00
    
    me@mylocalhost:~$ gcloud alpha cloud-shell scp cloudshell:~/adirectory/still-littlefile.zip localhost:.
    still-littlefile.zip      100%   16KB 198.0KB/s   00:00
    

    【讨论】:

      猜你喜欢
      • 2014-08-28
      • 2016-09-27
      • 1970-01-01
      • 1970-01-01
      • 2021-03-08
      • 2021-04-27
      • 2017-03-11
      • 1970-01-01
      • 2020-09-11
      相关资源
      最近更新 更多