gcloud - 无法在云构建中使用 gcloud scp 复制隐藏文件 - 远程构建器

标签 gcloud scp google-cloud-build

我正在使用 remote builder 运行云构建,能够将工作区中的所有文件复制到我自己的虚拟机中,但是无法复制隐藏文件

用于复制文件的命令

gcloud compute scp --compress --recurse '/workspace/*' [username]@[instance_name]:/home/myfolder --ssh-key-file=my-key --zone=us-central1-a

因此,这仅复制非隐藏文件。

还使用点运算符复制隐藏文件

gcloud compute scp --compress --recurse '/workspace/.' [username]@[instance_name]:/home/myfolder --ssh-key-file=my-key --zone=us-central1-a

仍然无法复制并出现以下错误

scp: error: unexpected filename: .

任何人都可以向我建议如何使用 gcloud scp 将隐藏文件复制到虚拟机。

提前致谢

最佳答案

如果删除斜杠后面的尾随字符,它可能会起作用。例如,这对我有用:

gcloud compute scp --compress --recurse 'test/' [username]@[instance_name]:/home/myfolder

关于gcloud - 无法在云构建中使用 gcloud scp 复制隐藏文件 - 远程构建器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59582895/

相关文章:

google-app-engine - 为什么在 IntelliJ 中升级 App Engine SDK 如此痛苦?

python - Python 中 Paramiko 上的 NoValidConnectionError

bash - 如何比较重复目录之间的文件大小匹配?

google-cloud-platform - 如何部署使用google cloud build和Source Repository新推送的多个云函数?

go - gCloud 实例 : ssh: handshake failed: ssh: unable to authenticate, 尝试的方法 [无公钥],没有支持的方法

google-cloud-platform - 指定通过 gcloud SDK 安装的 kubectl 客户端版本

在我从代码创建它之后,Golang 代码没有插入到 BigQuery 的表中

ubuntu - SSH Scp - 无法指定从服务器复制文件的本地路径

google-cloud-platform - 超出 Google Cloud 构建配额(构建和操作获取请求)

google-cloud-platform - Google Cloud 在另一个路径中构建挂载卷