I'm currently building a Pipeline to deploy my PHP Symfony Project from Dev Ops Repo to my Server. I use a SSH Task to execute the commands on the Server. The SSH Connection works fine, but some outputs of the executed commands are threaded as errors, like for git pull:
Starting: Run shell inline on remote machine
==============================================================================
Task : SSH
Description : Run shell commands or a script on a remote machine using SSH
Version : 0.177.0
Author : Microsoft Corporation
Help : https://learn.microsoft.com/azure/devops/pipelines/tasks/deploy/ssh
==============================================================================
Trying to establish an SSH connection to ***@xxx
Successfully connected.
chmod +x ./sshscript_32bf87de-91b8-45b5-bae1-02400a139bfc
./sshscript_32bf87de-91b8-45b5-bae1-02400a139bfc
##[error]From vs-ssh.visualstudio.com:v3/xxx
* branch master -> FETCH_HEAD
Already up-to-date.
##[error]Command failed with errors on remote machine.
Finishing: Run shell inline on remote machine
This is my Configuration:
trigger:
- master
pool:
vmImage: 'ubuntu-latest'
steps:
- task: SSH@0
displayName: 'Clean and Pull Git'
continueOnError: false
inputs:
sshEndpoint: 'xxx'
runOptions: inline
inline: |-
cd xxx
git clean -xdf
git pull origin master
How can I solve this Issue? (e.g. composer install has the same problem)
I know I could redirect stdout, but I want to keep the Output Messages
gitcommands? As far as I know,gitcommand printed tostderrin general. To handle this, I use$env:GIT_REDIRECT_STDERR = '2>&1'for PowerShell scripts. Hope this helps. Check here for more information.##[error] - Installing composer/package-versions-deprecated (1.11.99.1): Extracting archive ##[error] - Installing symfony/flex (v1.11.0): Extracting archive ##[error] - Installing symfony/routing (v4.4.18): Extracting archive