How to add/update files in git repository from Azure DevOps Pipeline Dynamics 365 CE

后端 未结 1 980
盖世英雄少女心
盖世英雄少女心 2021-01-14 16:25

Short Version

When a build pipeline is triggered, one of the build pipeline task will get the latest files and it has to be added/updated in the git

相关标签:
1条回答
  • 2021-01-14 17:16

    By default the source files are checked out to the Build.SourcesDirectory (e.g : Directory: D:\a\1\s), it can be considered as a temporary git repository.

    According to the error message, it appears that the working directory of the command line task is not under the Build.SourcesDirectory and you did't git checkout again to that working directory.

    So, please try unpack the solution zip file and store in Build.SourcesDirectory, then run below Command line to push the commits (it works for me):

    ECHO "Setting git config..."
    git config --global user.email "xxx@xyz.com"
    git config --global user.name "Admin"
    
    ECHO "CHECK GIT STATUS..."
    git status
    
    git checkout -b master
    
    ECHO "GIT ADD..."
    git add -A
    
    ECHO "CHECK GIT STATUS..."
    git status
    
    ECHO "Commiting the changes..."
    git commit -m "Latest Customizations updated"
    
    ECHO "Pushing the changes..."
    git push -u origin master
    
    ECHO "Customization Committed Successfully"
    

    Please note that you need to Grant version control permissions to the build service and enable Allow scripts to access the system token.

    0 讨论(0)
提交回复
热议问题