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
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 - -----^