简体   繁体   English

如何将 Google Cloud Platform 存储库克隆到 Google Cloud Platform VM

[英]How can I clone Google Cloud Platform repository to Google Cloud Platform VM

Can't clone a Google Cloud Platform repository to a Google Cloud Platform VM无法将 Google Cloud Platform 代码库克隆到 Google Cloud Platform VM

Issue: When I attempt to clone I get "Permission denied (publickey)"问题:当我尝试克隆时,我得到“权限被拒绝(公钥)”

Setup:设置:

  • Created an SSH key pair on the VM在 VM 上创建了 SSH 密钥对
  • In the Google Cloud Platform VM edited the instance details via the dashboard, added the key, and saved it在 Google Cloud Platform VM 中,通过仪表板编辑实例详细信息,添加密钥并保存
  • Started the VM and confirmed in the instance details that the key was registered.启动 VM 并在实例详细信息中确认已注册密钥。
  • On the Cloud Source Repositories dashboard for my repo registered the public key在我的仓库的 Cloud Source Repositories 仪表板上注册了公钥

Attempts:尝试:

  • Connected to the instance via ssh from my local terminal, confirmed again that the key existed then attempted to clone the repo.从我的本地终端通过 ssh 连接到实例,再次确认密钥存在,然后尝试克隆存储库。 Same permission denied result.相同的权限被拒绝结果。
  • Connected to the instance via the terminal created by the remote access button on the GCP instance details dashboard.通过 GCP 实例详细信息仪表板上的远程访问按钮创建的终端连接到实例。 Same permission denied result.相同的权限被拒绝结果。

The keys on my local machine are also registered with Cloud Source Repositories and I am able to clone the repo into my local machine without any problem.我本地机器上的密钥也注册了 Cloud Source Repositories,我可以毫无问题地将 repo 克隆到我的本地机器中。

This issue was resolved with a command different than the one provided by Cloud Source Repositories.此问题已通过与 Cloud Source Repositories 提供的命令不同的命令得到解决。 Problem was related to the fact that my company set up my account - I don't have the creds to manage it.问题与我的公司设置我的帐户有关 - 我没有管理它的信誉。 The clone command provided by provided by Cloud Source Repositories included a reference to the account the company set up which was not accepted even though I used gcloud init on the VM. Cloud Source Repositories 提供的克隆命令包含对公司设置的帐户的引用,即使我在 VM 上使用 gcloud init 也没有被接受。

I tried using the cloud SDK on the VM.我尝试在 VM 上使用云 SDK。 This resulted in the clone being successful: gcloud source repos clone [repo-name] --project=[project-name]这导致克隆成功: gcloud source repos clone [repo-name] --project=[project-name]

My team is just now migrating from on-prem to GCP and we're hitting the occasional speed bump like this.我的团队刚刚从本地迁移到 GCP,我们偶尔会遇到这样的减速带。

By the way, most of the references to "credential helper" on the GCP doc related to Docker.顺便说一句,GCP 文档中对“凭证助手”的大多数引用都与 Docker 相关。 That did not seem relevant to the repo issue.这似乎与回购问题无关。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM