I have project which require in composer my private package from bitbucket.
I have following pipeline in my bitbucket-pipeline yml file
- apt-get -y install openssh-server
- echo $PRIVATE_KEY > ~/.ssh/id_rsa.tmp
- base64 -d ~/.ssh/id_rsa.tmp > ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
- base64 ~/.ssh/id_rsa
- chmod 600 ~/.ssh/config
- chmod 700 ~/.ssh
- apt-get install git -y
- apt-get install -y php7.1-cgi
- apt-get install -y php7.1-json
- composer install
- sh bin/cli/test.sh
But in time of installation my private repository by composer I get following error:
Failed to execute git clone --no-checkout 'email@example.com:krajcik/cms-banner-module.git'
'/opt/atlassian/pipelines/agent/build/vendor/krajcik/cms-banner-module' && cd '/opt/atlassian/pipelines/agent/build/vendor/krajcik/cms-banner-module' && git remote add composer 'firstname.lastname@example.org:krajcik/cms-banner-module.git' && git fetch composer
Cloning into '/opt/atlassian/pipelines/agent/build/vendor/krajcik/cms-banner-module'...
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
In my environment variables in butbucket I have variable PRIVATE_KEY with ssh key in base64. Key was generated without passphrase.
When I execute:
on my computer with same ssh key then everything execute successfully but in bitbucket throw error.
Can you help we with my issue?
Thank you very much :-)
You could add your SSH key to pipelines specifically following this guide: https://confluence.atlassian.com/bitbucket/use-ssh-keys-in-bitbucket-pipelines-847452940.html?_ga=2.131578383.1856844316.1538948135-298513200.1517436601
The section at the bottom about multiple keys looks quite like what you are already doing, and so, if you expand that section, check through that you've done each step, especially step 5...
We are excited to announce the open beta program for self-hosted runners. Bitbucket Pipelines Runners is available to everyone. Please try it and let us know your feedback. If you have any issue...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events