Hello,
I've followed the instructions in this article: https://confluence.atlassian.com/bitbucket/use-ssh-keys-in-bitbucket-pipelines-847452940.html
It looks like the information provided is more or less useless as following step by step does not result in having success.
Using the built-in "feature" of having bitbucket generate a SSH pair for the user results in a password protected private-key which can not be used to connect.
Why is this information in the documentation?
---
What I want to achieve:
Connect via SSH and run a simple command (write some text into a file). That's it for now.
---
Anyways .. here's what I did:
1. go to bitbucket.org -> your repo -> settings -> pipelines -> ssh keys
2. generate SSH key & copy public key (also fetch host fingerprint while already here)
3. login to the target server and add the generated public key to ~./ssh/authorized_keys (and making sure the file and enclosing folder are having the right permissions 600/700)
4. use this recipe:
image: atlassian/default-image:2
pipelines:
default:
- step:
script:
- apt-get update -y
- apt-get install -y ssh
- ssh -t pipelines@staging.xxxxxxxx.xx "echo `foo` > httpdocs/foo"
- echo "Everything is awesome!"
--> the build fails with this error message:
<span>ssh_askpass: exec(/usr/bin/ssh-askpass): No such file or directory</span><span>Permission denied, please try again.</span>
<span>ssh_askpass: exec(/usr/bin/ssh-askpass): No such file or directory</span><span>Permission denied, please try again. </span>
<span>ssh_askpass: exec(/usr/bin/ssh-askpass): No such file or directory</span><span>Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).</span>
I have a couple of questions already which neither the documentation nor the help in the GUI answers.
I used ssh -t pipelines@.... to connect - why? Because running without the -t flag results in another error (the interactive terminal error)
Also I added a username (pipelines) which I did not set anywhere in Bitbucket. If I omit that, I'll get an error message (need a user).
So I wonder.. what is it that I am not getting? What is the missing piece? Does it have something to do with that I used the generate SSH key function that Bitbucket / Pipelines provides which is just not working as it maybe is intended to work? <- my guess...
I hope that my description is not too confusing and somebody (@Philip Hodder maybe?) has a couple minutes to point me into the right direction.
I've spent hours on reading .. there are a lot of users having the exact same or similar problems. Atlassian.. where is your infamous support and superior documentation? :-/