I need during a Gitlab-CI build to authenticate with ssh-agent from an alpine image.
I am looking for a sh one liner equivalent of this bash command (picked from the gitlab documentation):
ssh-add <(echo "$SSH_PRIVATE_KEY")
I have tried :
echo $SSH_PRIVATE_KEY | ssh-add -
Enter passphrase for (stdin): ERROR: Job failed: exit code 1
printf '%s\n' "$SSH_PRIVATE_KEY" | ssh-add
ERROR: Job failed: exit code 1
Installing OpenSSH server on Alpine Linux Edit the /etc/ssh/sshd_config for customization purpose. By default, sshd on Alpine Linux will use TCP port 22.
– The default shell in Alpine is the busybox provided ash.
There is no Bash installed by default; Alpine uses BusyBox Bash as the default shell.
You have to quote the variable in your first command:
echo "$SSH_PRIVATE_KEY" | ssh-add -
^----------------^
Or specify -
as the filename in your second command:
printf '%s\n' "$SSH_PRIVATE_KEY" | ssh-add -
-----^
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With