I am trying to add an ssh key for installing private git repositories for my build script. This is a requirement for php composer to access other private packages.
First problem occured when rsa fingerprint is not added automatically so I added a script command: - mkdir ~/.ssh - chmod 700 ~/.ssh - echo 'bitbucket.org,220.127.116.11 SOMECHARS' > ~/.ssh/known_hosts
That solved fingerprint problem. After that I tried to added an private key from command line but I need to add it securely. So I tried to add private key via environment variable but env vars removes new lines and that didn't work either.
- echo $PRIVATE_KEY > ~/.ssh/private_rsa
- chmod 600 ~/.ssh/private_rsa
- ssh-add ~/.ssh/private_rsa
Is there any way to add a private key or accessing our own private repositories somehow?