【问题标题】:How to fix conflicting source password error?如何解决冲突的源密码错误?
【发布时间】: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.

标签: gitlab gitlab-ci sshpass


【解决方案1】:

我终于找到了解决办法。

所以上面的命令对master分支有效,但对develop无效,知道了这个模式,我检查了变量设置,然后发现我打开了Protect variable标志,标志说Export variable to pipelines running on protected branches and tags only.

由于develop 不是受保护的分支,我在想变量值没有传递到管道中。

所以,我取消了所有变量的这个标志,终于让它工作了。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-11-16
    • 2015-02-06
    • 2020-07-29
    • 2021-12-21
    • 1970-01-01
    • 2019-09-15
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多