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

时间:2020-02-24 17:08:28

标签: 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 git@bitbucket.org:xxx/xxx.git

我有以下错误;

git clone git@bitbucket.org:xxx/xxx.git

+ git clone git@bitbucket.org: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密钥Use SSH keys in Bitbucket Pipelines 如何调试?

谢谢!

1 个答案:

答案 0 :(得分:0)

我不确定您要尝试做什么。根据您要实现的目标,请参见以下三个选项:

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

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

  1. 您要访问公开的Bitbucket存储库。

确保您可以在不设置任何身份验证的情况下从本地终端克隆公共存储库。如果可行,您可以通过管道进行相同的操作,而无需SSH。

  1. 您是否要克隆另一个自己的存储库?

在这种情况下,您需要具有该存储库的正确访问权限。 SSH是执行此操作的好方法。 在具有管道的存储库中创建SSH密钥对。在回购设置>管道设置> SSH密钥>生成密钥下。然后,使用生成的公钥并将其添加到您要克隆的存储库中。回购设置>常规>访问键