从 Azure DevOps 管道推送到受保护的 Github 分支
Pushing to Protected Github Branch from Azure DevOps pipeline
我有一个 DevOps 管道,其任务是更新文件,并将其提交回 Github 中的受保护分支。从回购协议中签出就可以了。我以为我有正确的权限设置,但它不起作用。
我在这里允许 azure-pipelines 权限:
我已指定以下内容以保留原始结帐时的身份验证:
steps:
- checkout: self
persistCredentials: true
- task: Bash@3
inputs:
targetType: inline
script: |
git checkout integration
然后在我做出更改之后,我想像这样推回集成分支:
- task: Bash@3
inputs:
targetType: inline
script: |
cd ./Test/Test.UWP
git config --global user.email "test@test.com"
git status
cd ../..
git add .
git commit -m "Release $(versionNumber)"
git push origin integration
这 returns 以下输出并没有将其推回到 integration
分支:
remote: error: GH006: Protected branch update failed for refs/heads/integration.
remote: error: At least 1 approving review is required by reviewers with write access.
To https://github.com/test/test-app
! [remote rejected] integration -> integration (protected branch hook declined)
error: failed to push some refs to 'https://github.com/test/test-app'
您可以查看这种情况的解决方案:
您可以授予管理员对 azure-pipelines 的访问权限,或者转到设置 --> 分支以勾选 Allow force pushes (Permit force pushes for all users with push access)
以强制推送。
此问题的解决方案是创建另一个帐户并从中生成具有管理员访问权限的 PAT。
然后我将应用程序克隆到代理上的一个单独目录中。修改了我需要的内容,并能够使用 git bash.
创建我的标签和所有内容
我有一个 DevOps 管道,其任务是更新文件,并将其提交回 Github 中的受保护分支。从回购协议中签出就可以了。我以为我有正确的权限设置,但它不起作用。
我在这里允许 azure-pipelines 权限:
我已指定以下内容以保留原始结帐时的身份验证:
steps:
- checkout: self
persistCredentials: true
- task: Bash@3
inputs:
targetType: inline
script: |
git checkout integration
然后在我做出更改之后,我想像这样推回集成分支:
- task: Bash@3
inputs:
targetType: inline
script: |
cd ./Test/Test.UWP
git config --global user.email "test@test.com"
git status
cd ../..
git add .
git commit -m "Release $(versionNumber)"
git push origin integration
这 returns 以下输出并没有将其推回到 integration
分支:
remote: error: GH006: Protected branch update failed for refs/heads/integration.
remote: error: At least 1 approving review is required by reviewers with write access.
To https://github.com/test/test-app
! [remote rejected] integration -> integration (protected branch hook declined)
error: failed to push some refs to 'https://github.com/test/test-app'
您可以查看这种情况的解决方案:
您可以授予管理员对 azure-pipelines 的访问权限,或者转到设置 --> 分支以勾选 Allow force pushes (Permit force pushes for all users with push access)
以强制推送。
此问题的解决方案是创建另一个帐户并从中生成具有管理员访问权限的 PAT。
然后我将应用程序克隆到代理上的一个单独目录中。修改了我需要的内容,并能够使用 git bash.
创建我的标签和所有内容