Reputation: 472
I am training with bitbucket pipeline
Here my 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 [email protected]:xxx/xxx.git
I have the following errors;
git clone [email protected]:xxx/xxx.git
+ git clone [email protected]: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.
I don't understand what do to with my ssh key Use SSH keys in Bitbucket Pipelines How to debug ?
Thank you !
Upvotes: 2
Views: 3934
Reputation: 183
I am not 100% sure what you are trying to do. See the three options below depending on what you are trying to achieve:
In that case you don't need to do anything special and don't need to set up ssh. Your pipeline automatically has access to the repo it belongs to. It is also automatically cloned for you, so you don't need to that again. For other git operations against your own repo, take a look here: https://community.atlassian.com/t5/Bitbucket-Pipelines-articles/Pushing-back-to-your-repository/ba-p/958407
Make sure you can clone the public repo from your local Terminal without setting up any Auth. If that works, you can do the same from Pipelines, no SSH required.
In that case you need to have the correct access rights for that repository. SSH is a good way to do that. Create an SSH keypair in the repo that has the pipeline. Under repo settings > Pipelines Settings > SSH keys > Generate keys. Then take the generated public key and add it to the repo you are trying to clone. Repo Settings > General > Access keys
Upvotes: 4