(gcloud.compute.scp)无法获取资源

时间:2018-07-11 18:18:46

标签: google-cloud-platform gcloud

我第一次使用Google Cloud,并且试图将测试文件上传到实例的根文件夹中。但是,出现此错误:

ERROR: (gcloud.compute.scp) Could not fetch resource:
 - Invalid value '[ua2r-website]'. Values must match the following regular expression: '[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?'

我在该文件的路径中。这是我的命令:

gcloud compute scp [testtext.txt] [ua2r-website]:~/

我已经仔细检查了VM实例的拼写和标点,但找不到任何区别。

3 个答案:

答案 0 :(得分:1)

删除[和]

gcloud compute scp testtext.txt ua2r-website:〜/

答案 1 :(得分:1)

您需要使用gcloud auth登录 gcloud auth登录-授权gcloud使用Google用户凭据访问Cloud Platform

编写命令

gcloud auth login

然后,您将获得一个链接,可从GCP单击。您将从链接中获取代码,然后将其复制回VM。那么您将被授权执行该操作。 这是更多详细信息

https://cloud.google.com/sdk/gcloud/reference/auth/login

答案 2 :(得分:0)

您还可以将文件从本地计算机文件系统拖放到项目所在的unix外壳程序中。