Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/azure/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何将Github修复到Azure DevOps Sync?_Git_Azure_Github_Azure Devops_Azure Pipelines - Fatal编程技术网

如何将Github修复到Azure DevOps Sync?

如何将Github修复到Azure DevOps Sync?,git,azure,github,azure-devops,azure-pipelines,Git,Azure,Github,Azure Devops,Azure Pipelines,我在Azure DevOps和Github之间进行了同步,以将Github回购与Azure DevOps中的回购同步。 去年年底一切正常。 今年,同步不再工作。 失败消息是致命的:无法读取“https://$XXXXXXXXXToken@yyyyyy.visualstudio.com“:终端提示已禁用” 我忘记了,PAT将于2019年12月31日到期。 因此,我重新创建了管道,而不仅仅是更改PAT的过期日期。脸掌。 我的想法是创建一条新的管道,以达到问题的根源。 但我觉得我把一切都搞得很糟 现在

我在Azure DevOps和Github之间进行了同步,以将Github回购与Azure DevOps中的回购同步。 去年年底一切正常。 今年,同步不再工作。 失败消息是致命的:无法读取“https://$XXXXXXXXXToken@yyyyyy.visualstudio.com“:终端提示已禁用”

我忘记了,PAT将于2019年12月31日到期。 因此,我重新创建了管道,而不仅仅是更改PAT的过期日期。脸掌。 我的想法是创建一条新的管道,以达到问题的根源。 但我觉得我把一切都搞得很糟

现在,我将脚本更改为:

git推送https://$XXXXXXXToken@yyyyyy.visualstudio.com/nnnnn/_git/kkkk-u-all

致:

git推送https://$System。AccessToken@yyyyyy.visualstudio.com/nnnnn/_git/kkkk-u-all

我将令牌更改为“System.AccessToken”,因为允许脚本访问OAuth令牌的信息显示:

我撤销了我名单上的每一项专利。 在我重新创建管道并将访问权限更改为“System.AccessToken”后,DevOps会自动创建一个PAT,如下所示:

管道运行为绿色,但Azure DevOps git回购仍未更新。 似乎仍然没有与Azure DevOps git回购的连接。 管道日志向我显示,从github回购协议签出工作正常。没有失败

我使用UI而不是使用YAML编辑器的directyl创建管道的管道YAML代码是:

在Github站点上,我安装了Azure管道和Azure板应用程序。 我还授权了这两个应用程序,并将这两个应用程序授权给OAuth。 我在GitHub和Azure DevOps回购之间也有一个Webhok。Webhook配置为拉请求、推送和释放 在Azure DevOps中,有一个GitHub连接到GitHub中的所有我的回购。
有人能帮我让同步正常工作吗?

我们必须在YAML中声明一个变量才能访问$System.AccessToken。看

我可以使用以下YAML管道将Github回购成功同步到Azure DevOps回购:只需相应地替换Azure DevOps git回购即可:https://xxx.visualstudio.com/GithubSync/_git/GithubSync

有关详细信息,请参阅此博客:

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: shellexec@0
  inputs:
    code: |
      git config --global user.email "xx@xx.com"
      git config --global user.name "xxx"
      git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote"; done
      git remote add vsts https://xxx.visualstudio.com/GithubSync/_git/GithubSync
      git branch -r | grep -v '\->' | while read remote; do git -c http.extraheader="AUTHORIZATION: bearer $(system_accesstoken)" push -u vsts "${remote#origin/}"; done