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
```
pipelines:
default:
- step:
script:
# Configure git to use ssh.
- git remote set-url origin ${BITBUCKET_GIT_SSH_ORIGIN}
- echo $PRIVATE_KEY > ~/.ssh/id_rsa.tmp
- base64 -d ~/.ssh/id_rsa.tmp > ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
# Commit back.
- echo "Made a change in build ${BITBUCKET_BUILD_NUMBER}" >> changes.txt
- git add changes.txt
- git commit -m "[skip ci] Updating changes.txt with latest build number."
- git push
```
- 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.