As part of our build process we update version numbers and we want to commit and push the changes back to the main repository. This is a git repo hosted on azure devops and using get sources as the first step:
I added a command line task at the end of the pipeline with following code. There appears to be something wrong, how can I do this properly? Thank you.
git config --global user.email "my@email.address.com"
git config --global user.name "VSTS Admin"
git status
ECHO SOURCE BRANCH IS %BUILD_SOURCEBRANCH%
ECHO ADDING MODIFIED FILES
git add *.cs
git add *.build
git add *.wxs
ECHO CREATING COMMIT
git commit -m "Update version numbers for Build %BUILD_BUILDNUMBER%"
git push origin master
here are the results:
##[section]Starting: Commit/Push Changes To Git Repo
==============================================================================
Task : Command Line
Description : Run a command line script using cmd.exe on Windows and bash on macOS and Linux.
Version : 2.148.0
Author : Microsoft Corporation
Help : [More Information](https://go.microsoft.com/fwlink/?LinkID=613735)
==============================================================================
Generating script.
========================== Starting Command Output ===========================
##[command]"C:\windows\system32\cmd.exe" /D /E:ON /V:OFF /S /C "CALL "D:\a\_temp\8b19361b-8f47-4d31-834d-132fedb0b386.cmd""
HEAD detached at e7a1479d
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: ../../../Properties/AssemblyInfo.cs
.. (more files modified)
SOURCE BRANCH IS refs/heads/master
ADDING MODIFIED FILES
CREATING COMMIT
[detached HEAD 5c1bf6dc] Update version numbers for Build myBuildNumber_5.1.001
2 files changed, 2 insertions(+), 2 deletions(-)
error: src refspec master does not match any
error: failed to push some refs to 'https://{org}@dev.azure.com/{projectName}/_git/{reponame}'
##[error]Cmd.exe exited with code '1'.
##[section]Finishing: Commit/Push Changes To Git Repo