I am trying to follow the solution given in the following link: How to fix Github to Azure DevOps Sync?
My requirement is to trigger Azure Devops pipeline when a commit is done in any branch of GitHub repository. I have already imported the code from GitHub repository using PAT token from GitHub repo. The PAT token is given all access in GitHub repository.
But I am getting the following error:
Following is my pipeline yaml code:
trigger:
branches:
include:
- '*'
variables:
system_accesstoken: $(System.AccessToken)
pool:
vmImage: 'ubuntu-latest'
steps:
- checkout: self
persistCredentials: true #Allow scripts to access the system token
clean: true
- task: Bash@3
name: SyncRepo
inputs:
targetType: 'inline'
script: |
git config --global user.email "[email protected]"
git config --global user.name "sormita"
git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote"; done
git remote add vsts https://xxx.visualstudio.com/xxx/_git/xxxx
git branch -r | grep -v '\->' | while read remote; do git -c http.extraheader="AUTHORIZATION: bearer $(system_accesstoken)" push -u vsts "${remote#origin/}"; done
Can someone please help me synchronize GitHub repository with Azure Devops repo?