【发布时间】:2021-03-05 21:15:41
【问题描述】:
我正在尝试遵循以下链接中给出的解决方案: How to fix Github to Azure DevOps Sync?
我的要求是在 GitHub 存储库的任何分支中完成提交时触发 Azure Devops 管道。我已经使用 GitHub 存储库中的 PAT 令牌从 GitHub 存储库导入了代码。 PAT 令牌被授予 GitHub 存储库中的所有访问权限。
以下是我的管道 yaml 代码:
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 "xxxx@xxx.com"
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
有人可以帮我将 GitHub 存储库与 Azure Devops 存储库同步吗?
【问题讨论】:
标签: git github azure-devops azure-pipelines