Bash error for git clone

I’m running a git clone command through the script task in bash. But I always get an error/warning despite it worked. The script is executed on a docker container.




Hi @michael.gruber2,

Thanks for reaching out!

It looks as though something on the process is passing logging information to std-err and that is why Octopus is logging it as an error.

To circumvent this, you can use service messages before and after the desired bash command to re-route certain output streams.

In example:

connectionString=$(get_octopusvariable "Git")
echo ##octopus[stderr-progress]
git clone $connectionString
echo ##octopus[stderr-default]
ls infrastructure

This should allow your deployment process to run without logging anything to std-err.

I hope this helps! Please let me know if you have any questions.

Kind Regards,
Adam

Hi,

ok, now it seem to work. You missed the quotation marks. Is it possible to see somewhere the error, which appeared, to resolve it?

connectionString=$(get_octopusvariable "Git")
echo "##octopus[stderr-progress]"
git clone $connectionString
echo "##octopus[stderr-default]"
ls infrastructure

Best regards

Hi @michael.gruber2!

Just jumping in for Adam here, as he’s out of the office today.

Another option here is to use git clone --quiet here to stop it logging the progress messages to the stderr stream. That way if there is an error, it will still generate the red error text in the logs.

With the stream redirection service messages, the command should still error and fail the step, since it operates off the exit codes, as opposed to error text. So the error messages will still be in the log, they just won’t be rendered as errors specifically.

I hope this helps, and please let us know if you have any further questions!

Hi,

thanks for your reply and providing the information.

Best regards

1 Like

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.