Bitbucket 管道 - 无法从远程存储库读取?

标签 bitbucket bitbucket-pipelines

我正在使用 bitbucket 管道进行训练

这是我的 bitbucket-pipelines.yml:

image: php:7.2.9

pipelines:
    default:
        - step:
              caches:
                  - composer
              script:
                  - apt-get update && apt-get install -y unzip zlib1g-dev git curl libmcrypt-dev mysql-client ssh
                  - docker-php-ext-install bcmath pdo_mysql sockets
                  - git clone <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="c7a0aeb387a5aeb3a5b2a4aca2b3e9a8b5a0" rel="noreferrer noopener nofollow">[email protected]</a>:xxx/xxx.git

我有以下错误;

git clone <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="17707e6357757e637562747c726339786570" rel="noreferrer noopener nofollow">[email protected]</a>:xxx/xxx.git

+ git clone <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="f4939d80b4969d809681979f9180da9b8693" rel="noreferrer noopener nofollow">[email protected]</a>:xxx/xxx.git
Cloning into 'lib-purge'...
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.

我不明白如何使用我的 ssh key Use SSH keys in Bitbucket Pipelines 如何调试?

谢谢!

最佳答案

我不是 100% 确定你想做什么。根据您想要实现的目标,请参阅以下三个选项:

  1. 您想要访问自己的存储库(即您的管道所属的存储库)

在这种情况下,您不需要做任何特殊的事情,也不需要设置 ssh。您的管道自动可以访问它所属的存储库。它还会自动为您克隆,因此您无需再次进行克隆。对于针对您自己的存储库的其他 git 操作,请查看此处:https://community.atlassian.com/t5/Bitbucket-Pipelines-articles/Pushing-back-to-your-repository/ba-p/958407

  • 您想要访问公共(public) Bitbucket 存储库。
  • 确保您可以从本地终端克隆公共(public)存储库,而无需设置任何身份验证。如果有效,您可以从管道执行相同的操作,无需 SSH。

  • 您是否正在尝试克隆您自己的另一个存储库?
  • 在这种情况下,您需要拥有该存储库的正确访问权限。 SSH 是一个很好的方法。 在具有管道的存储库中创建 SSH key 对。在存储库设置 > 管道设置 > SSH key > 生成 key 下。然后获取生成的公钥并将其添加到您尝试克隆的存储库中。存储库设置 > 常规 > 访问键

    关于Bitbucket 管道 - 无法从远程存储库读取?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60380797/

    相关文章:

    git - 了解 Git : Latest push is not visible on production server

    github - 将 Github 链接挂载为 docker 卷

    node.js - 使用无服务器部署 python 时 fs-extra 的问题

    kubernetes - 为Kubernetes命名空间设置部署锁定?

    java - 对 Bitbucket API 的 HTTP PUT 请求

    bitbucket-pipelines - 是否可以在 bitbucket 管道中使用多个 docker 图像?

    javascript - 将环境变量与 BitBucket 结合使用

    linux - golang.org/x/sys/unix 缺少函数体的问题

    ssh - Ansible bitbucket 克隆配置 ssh 错误

    git - 如何只公开私有(private) git 存储库的一个文件?