是否有`ssh-add` Linux alpine one衬垫? [英] Is there a `ssh-add` Linux alpine one liner
本文介绍了是否有`ssh-add` Linux alpine one衬垫?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在构建Gitlab-CI时,我需要使用来自高山图像的ssh-agent进行身份验证.
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")
我尝试过:
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
推荐答案
您必须在第一个命令中引用该变量:
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 -
-----^
这篇关于是否有`ssh-add` Linux alpine one衬垫?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文