I've added a PowerShell task to checkout a branch and commit some changes once TFSBuild has already cloned my TFS-hosted GIT repository.
It looks like this:
$gitBranch = $env:BUILD_SOURCEBRANCH.Split("/")[-1]
git checkout $gitBranch
git add ../sql/
git commit -m "Updated database backup"
git push
Once I queue a build and it gets executed, it gets stuck on git push
:
1 file changed, 1071 insertions(+) create mode 100644 sql/web.sql
I can't figure out how can I fix this issue, because when I run the whole command in the build machine from a Powershell command line, it works flawlessly.
I run a number of Powershell scripts using git and output is redirected to a log file. Git is prompting for credentials and waiting for user input.
Check that you have a properly configured credential manager in place, like Git Credential Manager for Windows, and the credentials are stored for the account running the build.