Is there a `ssh-add` Linux alpine one liner

后端 未结 1 1308
故里飘歌
故里飘歌 2021-02-13 22:52

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

1条回答
  •  时光说笑
    2021-02-13 23:43

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

    0 讨论(0)
提交回复
热议问题