I am trying to clone a repository, update values in a file, and then commit and push while inside a bitbucket pipeline.
I followed the example in this repository provided by bitbucket to use ssh keys to push to another bitbucket repository.
https://bitbucket.org/bitbucketpipelines/git-auth-ssh-using-variables/src/master/bitbucket-pipelines.yml
```
```
- I added my private ssh keys as a secure variable
- and I tried to create file for my ssh key to use as a private key, but in the bitbucket pipeline, it echos the variable itself and not the value into the file.
My guess is that the above behaviour is because I added it as a secure variable. Please is there a work around for this?
We have several repositories that will need to clone this one repository, it is not scalable to all all their pipeline ssh keys into that one repository.
Hi David,
Thank you for contacting Atlassian Community, I'm Norbert from Bitbucket Cloud Support team, it's nice to meet with you!
I would like to inform you that this is an expected behavior as we don't show the secured variable, but the file actually should contain the private key. When I tested this, I did an "cat ~/.ssh/id_rsa" command and I could see the content of the file.
Can I ask you to run a "cat ~/.ssh/id_rsa" command in your Pipelines, after the "base64 -d ~/.ssh/id_rsa.tmp > ~/.ssh/id_rsa" command and let me know if you can see any content in the file?
I'm looking forward to hear from you.
Best Regards,
Norbert
Atlassian Bitbucket Cloud Support
Norbet C, I have the same problem! I ran cat ~/.ssh/id_rsa, and I dint show me anything; the private key was empty.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for commenting on this ticket.
Can you let me know if you were creating the "id_rsa.pub" file the same way as David did?
- echo $PRIVATE_KEY > ~/.ssh/id_rsa.tmp
- base64 -d ~/.ssh/id_rsa.tmp > ~/.ssh/id_rsa
I'm looking forward to hear from you.
Best Regards,
Norbert
Atlassian Bitbucket Cloud Support
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.