Windows Server 2019 上的 Azure 管道 powershell 和 git 在输出中出现错误

jan*_*jan 1 powershell azure azure-devops azure-pipelines

我的 azure 管道和我的一台服务器有问题。

失败的服务器是 Windows 2019 服务器。

如果我在 powershell 中调用 git,那么它会将所有警告和以下行视为错误。如果我在两台不同的服务器上做同样的事情 - 没有问题 - 即使输出相同。

这是返回的错误:

CD to  D:\web\test\testsite.com
 ##[error]git : Warning: Permanently added the RSA host key for IP address 'X' to the list of known hosts.
##[error]git : From bitbucket.org:SITE
##[error]At C:\azagent\A1\_work\_temp\c1ff2d2b-c773-4adc-9040-155e92a914bd.ps1:12 char:1
+ git pull origin master
+ ~~~~~~~~~~~~~~~~~~~~~~
##[error]    + CategoryInfo          : NotSpecified: (From bitbucket....b/fletcocarpets:String) [], RemoteException
##[error]    + FullyQualifiedErrorId : NativeCommandError
##[error] 
##[error]PowerShell exited with code '1'.
Run Code Online (Sandbox Code Playgroud)

Git 确实进行了拉动,实际上一切正常。但出于某种原因 - 在此服务器上 - azure 管道将文本视为错误。

任何想法为什么?很难在文本上正确解释问题。

这是它在其工作的服务器上返回的方式,例如:

CD to  D:\web\testsite.com
Warning: Permanently added the RSA host key for IP address 'X' to the list of known hosts.
From bitbucket.org:SITE
* branch            master     -> FETCH_HEAD
 ...
 1 file changed, 27 insertions(+), 23 deletions(-)
 ##[section]Finishing: PowerShell Script - GIT
Run Code Online (Sandbox Code Playgroud)

jan*_*jan 5

我发现了什么对我有帮助。以为我试过了 - 但似乎没有:

将此添加到顶部。出于某种原因,这个服务器和 git 需要这个: $env:GIT_REDIRECT_STDERR = '2>&1'