It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Composer install private repositories

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 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:

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 :-)

1 answer

0 votes
Linette Atlassian Team Oct 07, 2018

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...

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bitbucket Pipelines

What We Learned When We Researched Open Source Vulnerabilities in 7 Popular Coding Languages

...hey are a part of us, shaping how we interact with the world around us. The same holds true for programming languages when we think about how different kinds of vulnerabilities raise their heads in t...

145 views 0 1
Read article

Community Events

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

Events near you