jan
jan

Reputation: 319

Azure pipeline powershell and git on windows server 2019 gives error in output

I have a problem with azure pipeline and one of my servers.

The server where it fails is a windows 2019 server.

If I in powershell call git, then it treats all warnings and following lines as errors. If I do the same thing on two og my different servers - no issues - even though same outout.

This is the error returned:

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 does make the pull and everything is actually OK. But for some reason - on this server - azure pipelines treats the text as errors.

Any ideas why? hard to explain the problem aswell properly on text.

This is how its returned on the server where it works, as an example:

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

Upvotes: 2

Views: 596

Answers (1)

jan
jan

Reputation: 319

I found out what helped me. Thought I had tried it - but seems not:

Added this to the top. for some reason this server and git needs this: $env:GIT_REDIRECT_STDERR = '2>&1'

Upvotes: 6

Related Questions