azure-devopsyamlazure-pipelines-yamlpower-platform

error: pathspec 'main' did not match any file(s) known to git


I have a very simple Yaml code, I am trying to use and it is causing me so much pain but I cannot see an error besides the one i am getting at the end

error: pathspec 'main' did not match any file(s) known to git
[detached HEAD d1f4c36] Work now

Here is the code :

stages:
- stage : Build

  jobs:
     - job:
       displayName: "Build Ripple 3 dataverse Solution"
       pool :
         vmImage: 'windows-2019'
       variables:
       - group: "Ripple 3 Core"
      
       steps:
       - task: PowerPlatformToolInstaller@2
         inputs:
           DefaultVersion: true
         displayName : "Power Platform Tool Installer"
       
       - task: PowerPlatformExportSolution@2
         inputs:
           authenticationType: 'PowerPlatformSPN'
           PowerPlatformSPN: 'Service Connection'
           SolutionName: '$(PowerPlatformSolution)'
           SolutionOutputFile: '$(Pipeline.Workspace)\$(PowerPlatformSolution).zip'
            
      
       - task: PowerPlatformUnpackSolution@2
         inputs:
           SolutionInputFile: '$(Pipeline.Workspace)\Ripple3Core.zip'
           SolutionTargetFolder: '$(Build.SourcesDirectory)\$(PowerPlatformSolution)_unmanaged'
           
       
       - script: |
           git config user.email  "xx@xx.com"
           git config user.name "Automatic Build"
           git checkout main
           git add --all
           git commit -m "Work now"
           git push origin main

Solution

  • Try

    git checkout "main"
    

    Also, it may be necessary to checkout before exporting solution :

    https://zupimages.net/viewer.php?id=22/40/z330.png

    It is also possible to use Publish artifacts component :

    https://learn.microsoft.com/en-us/azure/devops/pipelines/artifacts/pipeline-artifacts?view=azure-devops&tabs=yaml