Imagine you want to commit and push a changed file during a build.
- Grant the user “Project Collection Build Service (DefaultCollection)” the following permissions on the repository:
Enable the option “Allow scripts to access OAuth token” on the build.
Set the variable “system.prefergit” to “true” on the build.
Add a PowerShell-task to the build
The issue is that either
a) GIT has no idea what STDERR is and writes success messages to the error stream
b) TFS Build interprets the output of GIT wrong and fails the build even if the exit code is 0. Fun fact: It works with the “Command Line”-Task without any issues.
Both out of my control – maybe another Issue/PR on the GIT project could solve it as it is open source, But I need a solution NOW!
So here is how to modify the script: