I'm writing an Azure YAML pipeline which have to do a 'git push' to repo so, I've written my git commands inside a CmdLine@2 task. Something like this :
git checkout -b foo-branch-$(Build.BuildId)
git add myGeneratedFile
git commit -m "My commit message"
git config user.email "$(GitUserName)@foo.com"
git config user.name "$(GitUserName)"
git push --set-upstream origin feature/foo-branch-$(Build.BuildId)
Obviously this code doesn't work as git credentials aren't set anywhere. How can specify that commands?
My idea is reading them from a parameter just like $(GitUserName) or from a git secret.
Is there any parameter that I can hide to avoid showing the value in the log and when the user type it?