【问题标题】:Azure DevOps pipeline set git user email from build variableAzure DevOps 管道从构建变量设置 git 用户电子邮件
【发布时间】:2019-10-09 09:36:16
【问题描述】:

当提交者 "Teppo Tulppu" "teppo.tulppu@duckburg" 触发管道时,user.name 最终为 Teppo。

这是 Azure DevOps 的“功能”还是我可以通过某种方式解决这个问题?

  - task: Bash@3
    displayName: 'Set git config email & name'
    inputs:
      targetType: 'inline'
      script: |
        git config --global user.email $BUILD_REQUESTEDFOREMAIL
        git config --global user.name $BUILD_REQUESTEDFOR

【问题讨论】:

    标签: azure-devops azure-pipelines


    【解决方案1】:

    这不是 Azure DevOps 功能。这是 git config 命令的一些限制。如果你的用户名是“aa bb”,而你输入了git config --global user.name aa bb这样的命令,user.name 只会显示空格前的字母。

    因此您可以将脚本更改为以下内容,然后用户名将按您的预期显示。

    git config --global user.email $BUILD_REQUESTEDFOREMAIL
    git config --global user.name "$BUILD_REQUESTEDFOR"
    

    只需使用特殊字符" 包含预定义变量即可解决此问题。

    【讨论】:

    • 我也发现了这一点,我的常规 zsh 终端和 bash 的细微差别在这里对我开了个残酷的玩笑。在 zsh 上,您不需要 "
    猜你喜欢
    • 2020-04-01
    • 2021-11-23
    • 2020-04-02
    • 2021-01-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-09-30
    相关资源
    最近更新 更多