Azure devops Azure DevOps管道从构建变量设置git用户电子邮件

Azure devops Azure DevOps管道从构建变量设置git用户电子邮件,azure-devops,azure-pipelines,Azure Devops,Azure Pipelines,当提交人“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 u

当提交人“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功能。这是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"

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

这不是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上,您不需要
。也发现了这一点,我的常规zsh终端和bash的微小差异在这里给我开了一个残酷的玩笑。在zsh上,您不需要