I have a bitbucket pipeline that works well but now on a project i need to pull from a private repository wich contains a package that is required in my composer.json.
When i do a composer install in the pipeline, it stops with this error
Failed to execute git clone --no-checkout '[email protected]:company/package.git' [...]
Cloning into '/opt/atlassian/pipelines/agent/build/vendor/company/package'...
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
The pipeline do not have any SSH key defined so it's not allowed to pull, but how could i define one since it's ephemeral ?
Or maybe i should define the requirement otherwise ?
A private Git repository on Bitbucket can be accessed using either SSH or HTTPS. The preferred method is to always use SSH and a SSH key pair. Only use HTTPS if you have no choice.
Then, open the Bitbucket website on your browser and navigate to the repository in question. Click on the menu button in the top-left, and select Pull Requests. Here, click on the Create pull request button. The pull request creation form will open.
.ssh
directory.That should be enough to get it running.
Moreover, I’ve just seen that there is now (maybe this is new, but I’m not sure) a new page “Settings” > “Pipelines” > “SSH keys” for managing pipelines SSH keys. This way, you wouldn’t even need to add the private key to the docker image you are using. But I haven’t used that so far, so I can’t say anything about it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With