嗯,这很奇怪。我正在使用 Github 保护规则来强制执行拉取请求并为每次推送触发 TravisCI。但是,由于连续翻译,我需要一个应该能够在不发出拉取请求并避免 TravisCI 状态检查的情况下进行推送的用户(为此我使用 [ci skip])。该用户包含在 Github 在分支保护规则中提供的白名单中。自上周以来,它运行良好,突然当我尝试与该用户推送时,我收到了它:
remote: Resolving deltas: 100% (5/5), completed with 5 local objects.
remote: error: GH006: Protected branch update failed for refs/heads/master.
remote: error: Required status check "Travis CI - Pull Request" is expected. At least 1 approving review is required by reviewers with write access.
To https://github.com/*****
! [remote rejected] master -> master (protected branch hook declined)
error: failed to push some refs to 'https://*****'
这很奇怪,因为它一直工作到现在......而且用户有权在不发出拉取请求的情况下进行推送,并且它通过提交消息跳过 Travis,所以我不明白为什么 github 向我询问状态检查和批准...
我最终解决了它,为用户提供了管理员访问权限,而不仅仅是写访问权限。现在它能够推动避免批准和状态检查。但我不明白为什么只是在保护分支规则的白名单中不起作用......它之前工作过,看起来GitHub做了一些改变......
小智 5
我最近遇到的问题:
remote: error: GH006: Protected branch update failed for refs/heads/master.
remote: error: Cannot force-push to this protected branch
To https://github.com/org/project.git
! [remote rejected] master -> master (protected branch hook declined)
error: failed to push some refs to 'https://github.com/org/project.git
Run Code Online (Sandbox Code Playgroud)
因为我是管理员/所有者,所以我能够执行以下操作,这有助于我解决push
问题。步骤:--> 设置--> 分支--> 勾选即可Allow force pushes
Permit force pushes for all users with push access.
。