【发布时间】:2020-05-06 18:48:29
【问题描述】:
我正在尝试设置一个 gitlab CI/CD。
我使用的脚本之一是:
sshpass -p $PRIVATE_KEY ssh -p $PORT -o StrictHostKeyChecking=no $USER@$SERVER01 "cd /var/www/html/app && export HISTIGNORE='*sudo -S*' && echo "$PRIVATE_KEY" | ( sudo -S -k git fetch && sudo -S -k git pull )"
如您所见,我正在尝试更新服务器中的应用程序。
仅供参考,我已经在 gitlab CI/CD 设置页面中设置了变量。
但是,当作业运行时,它总是返回此错误消息:
Conflicting password source
Usage: sshpass [-f|-d|-p|-e] [-hV] command parameters
-f filename Take password to use from file
-d number Use number as file descriptor for getting password
-p password Provide password as argument (security unwise)
-e Password is passed as env-var "SSHPASS"
With no parameters - password will be taken from stdin
-P prompt Which string should sshpass search for to detect a password prompt
-v Be verbose about what you're doing
-h Show help (this screen)
-V Print version information
At most one of -f, -d, -p or -e should be used
我已经搜索过,但没有找到任何线索。
任何线索将不胜感激。
【问题讨论】:
-
双引号
$PRIVATE_KEY.