【问题标题】:Azure pipeline powershell and git on windows server 2019 gives error in outputWindows Server 2019 上的 Azure 管道 powershell 和 git 在输出中出现错误
【发布时间】:2019-10-21 11:41:26
【问题描述】:

我的 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'.

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

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

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

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

【问题讨论】:

  • 能发一下脚本吗
  • 你是不是在ps1文件中指定了git命令,然后在task中调用了?你能用你的 git 命令更新吗?
  • 嗨,唯一的合作伙伴真的是“git pull orgin master”。然后,无论通过 azure pipelines powershell 做什么,输出中返回的内容似乎都以错误形式返回。这只发生在这台服务器上 - 由于某种原因,我无法弄清楚 azure pipelines powershell 设置为在出错时停止 - 而不是继续 - 这很重要 - 所以我知道它是否失败。我可以将其设置为继续 - 但我不会收到错误通知。
  • 我不认为这是一个 dup ... git 命令是成功的,不像链接的问题。

标签: azure powershell azure-devops azure-pipelines


【解决方案1】:

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

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-10-20
    • 2016-04-23
    • 2020-05-16
    • 1970-01-01
    • 1970-01-01
    • 2015-05-09
    • 2015-07-21
    • 2015-01-08
    相关资源
    最近更新 更多