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:
<span> Cloning into '/opt/atlassian/pipelines/agent/build/vendor/krajcik/cms-banner-module'... </span><span> Permission denied (publickey). </span><span> fatal: Could not read from remote repository. </span>
<span> Please make sure you have the correct access rights </span><span> and the repository exists. </span> <span> Failed to execute git clone --no-checkout 'git@bitbucket.org:krajcik/cms-banner-module.git'<br> '/opt/atlassian/pipelines/agent/build/vendor/krajcik/cms-banner-module' && cd '/opt/atlassian/pipelines/agent/build/vendor/krajcik/cms-banner-module' && git remote add <a href="https://bitbucket.org/krajcik/eshop-samolepky/src/7e6c30acd6b5605a32a84b9e1adc4d3b42709aa5/composer" target="_blank" rel="noopener noreferrer">composer</a> 'git@bitbucket.org:krajcik/cms-banner-module.git' && git fetch <a href="https://bitbucket.org/krajcik/eshop-samolepky/src/7e6c30acd6b5605a32a84b9e1adc4d3b42709aa5/composer" target="_blank" rel="noopener noreferrer">composer</a> </span>
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 :-)