Hi,
I have project which require in composer my private package from bitbucket.
I have following pipeline in my bitbucket-pipeline yml file
pipelines:
branches:
master:
- step:
script:
- 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 'git@bitbucket.org: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 'git@bitbucket.org:krajcik/cms-banner-module.git' && git fetch composerCloning 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:
composer install
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...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.