gpt4 book ai didi

upload - gcloud计算复制文件实例目的地?

转载 作者:行者123 更新时间:2023-12-02 01:18:45 26 4
gpt4 key购买 nike

我在从实例复制文件时遇到问题,尤其是向实例复制文件时遇到困难。我在实例中创建了 instance.txt(使用 SSH),但这不起作用:

C:\test>gcloud compute copy-files instance-4:~/instance.txt . --zone us-central1-b
Passphrase for key "censoredbyme":
unable to identify instance.txt: no such file or directory
ERROR: (gcloud.compute.copy-files) [C:\Program Files\Google\Cloud SDK\google-cloud-sdk\bin\..\bin\sdk\scp.EXE] exited with return code [1].

写入完整路径有效:

C:\test>gcloud compute copy-files instance-4:/home/stefan_pochmann_gmail_com/instance.txt . --zone us-central1-b
Passphrase for key "censoredbyme":
instance.txt | 0 kB | 0.0 kB/s | ETA: 00:00:00 | 100%

为什么 ~/不起作用?文档示例使用它,它不应该是相同的吗?请参阅:

stefan_pochmann_gmail_com@instance-4:~$ cd ~/
stefan_pochmann_gmail_com@instance-4:~$ pwd
/home/stefan_pochmann_gmail_com

另一个方向根本不起作用(?):

C:\test>gcloud compute copy-files local.txt instance-4:/home/stefan_pochmann_gmail_com --zone us-central1-b
Passphrase for key "censoredbyme":
scp: unable to open /home/stefan_pochmann_gmail_com/local.txt: permission denied
ERROR: (gcloud.compute.copy-files) [C:\Program Files\Google\Cloud SDK\google-cloud-sdk\bin\..\bin\sdk\scp.EXE] exited with return code [1].

C:\test>gcloud compute copy-files local.txt instance-4:/home/stefan_pochmann_gmail_com/ --zone us-central1-b
Passphrase for key "censoredbyme":
scp: unable to open /home/stefan_pochmann_gmail_com//local.txt: permission denied
ERROR: (gcloud.compute.copy-files) [C:\Program Files\Google\Cloud SDK\google-cloud-sdk\bin\..\bin\sdk\scp.EXE] exited with return code [1].

为什么权限被拒绝?好吧,我尝试 ~/而不是写完整路径:

C:\test>gcloud compute copy-files local.txt instance-4:~/ --zone us-central1-b
Passphrase for key "censoredbyme":
local.txt | 0 kB | 0.0 kB/s | ETA: 00:00:00 | 100%

看起来好像已上传文件,但该文件不存在。至少不在我期望的/home/stefan_pochmann_gmail_com/中。但我不知道,因为我必须使用 ~/,它在下载方向上根本不起作用。我该如何让它发挥作用?

最佳答案

在本例中,Google Cloud SDK 正在按预期工作。

当您尝试使用gcloud compute时第一次使用命令时,它会告诉您“您没有 Google Compute Engine 的 SSH key ”,并且它会创建私钥、公钥 (.pub) 和 PuTTY 格式 key (. ppk)通常在 C:\Users\<username>\.ssh\目录(不同 Windows 版本可能有所不同)。

如果您打开 google_compute_engine.pub 文件,最后您将找到用于访问实例的用户名。此用户名与您执行 gcloud 命令时记录的本地用户名匹配。

如果你想运行gcloud compute copy-files instance-4:~/instance.txt . --zone us-central1-b您可以按照以下步骤操作:1- 转到开发人员控制台 -> 选择您的项目 -> 计算 -> 计算引擎 -> 元数据 -> SSH key -> 编辑和修改 SSH key ,其中 Stefan 在左侧输入 stefan_pochmann_gmail_com而不是关键内容末尾的 Stefan。

关于upload - gcloud计算复制文件实例目的地?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26775492/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com