【问题标题】:Unable to clone repo from Google Cloud Source Repository to a Compute Engine Instance configured with Cloud NAT无法将存储库从 Google Cloud Source Repository 克隆到配置了 Cloud NAT 的 Compute Engine 实例
【发布时间】:2020-06-19 06:22:13
【问题描述】:

我正在使用已禁用外部 IP 地址并通过 Cloud NAT 访问互联网的 Google Compute Engine 实例。问题是,当我尝试使用 SSH 身份验证从 Google Cloud Source Repo 克隆 Repo 时,出现以下错误:-

Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

我使用this example 在 GCE 中设置 Cloud NAT。当我安装了一些软件包时,GCE 能够访问互联网。我正在使用 RSA 密钥进行身份验证,并按照here 提供的说明进行操作。

我该如何解决这个问题?我不想使用手动凭据或 Cloud SDK 来克隆 Repo。

【问题讨论】:

    标签: google-cloud-platform google-compute-engine nat google-cloud-source-repos google-cloud-router


    【解决方案1】:

    这不是 Compute Engine 或 NAT 问题(或网络),而只是 GIT 问题。您的客户端未在您的存储库上获得授权

    为此,您可以依靠authentication page。

    我的猜测是计算引擎服务帐户无权访问云存储库。在设置页面(Cloud Repository 右上角的齿轮)中检查 Cloud Repository 权限。

    【讨论】:

    • 感谢您的回答。但正如我在上面的问题中所述,我已经在使用 SSH 身份验证。但是,错误仍然存​​在。
    【解决方案2】:

    信息有点不言自明

    Permission denied (publickey).
    fatal: Could not read from remote repository.
    
    Please make sure you have the correct access rights
    and the repository exists.
    

    您必须拥有@guillaume 提到的适当凭据,您不能拥有您的公共 SSH 密钥 here,或者您的 GCE 实例中缺少私钥,或者您的 git 没有正确引用该私钥。

    确认这一点的一种方法是为您当前的 GCE 实例提供一个 external IP 以绕过 Cloud NAT。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-11-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-09-25
      • 1970-01-01
      相关资源
      最近更新 更多