admin管理员组文章数量:1023628
I am using GitHub Actions to increment my angular project version as a last step in my workflow. I configured the git user and git email before pushing (i.e, before running 'git push').
git config user.name "${{ secrets.GIT_USER }}"
git config user.email "${{ secrets.GIT_EMAIL }}"
I am getting below error
remote: error: GH006: Protected branch update failed for refs/heads/development.
remote:
remote: - Changes must be made through a pull request.
To .git
! \[remote rejected\] development -\> development (protected branch hook declined)
error: failed to push some refs to '.git'
I realised am not using any password or Git PAT for pushing so tried setting the git remote url as below
git remote set-url origin https://x-access-token:${{ secrets.GIT_TOKEN }}@github/thermofisher/de-instrument-storage-service.git
Additional context:
My repo is a private repo.
The branch ('development') I am trying to push has branch protection rule called Require a pull request before merging checked. Which I should not disable. And also the git user and email that I'm using have admin permission for the repository. So not sure why I am unable to push!
Is there any way, to be able to push changes via GitHub Actions to a protected branch as an admin?
I am using GitHub Actions to increment my angular project version as a last step in my workflow. I configured the git user and git email before pushing (i.e, before running 'git push').
git config user.name "${{ secrets.GIT_USER }}"
git config user.email "${{ secrets.GIT_EMAIL }}"
I am getting below error
remote: error: GH006: Protected branch update failed for refs/heads/development.
remote:
remote: - Changes must be made through a pull request.
To https://github/my-repo-name.git
! \[remote rejected\] development -\> development (protected branch hook declined)
error: failed to push some refs to 'https://github/my-repo-name.git'
I realised am not using any password or Git PAT for pushing so tried setting the git remote url as below
git remote set-url origin https://x-access-token:${{ secrets.GIT_TOKEN }}@github/thermofisher/de-instrument-storage-service.git
Additional context:
My repo is a private repo.
The branch ('development') I am trying to push has branch protection rule called Require a pull request before merging checked. Which I should not disable. And also the git user and email that I'm using have admin permission for the repository. So not sure why I am unable to push!
Is there any way, to be able to push changes via GitHub Actions to a protected branch as an admin?
Share Improve this question asked Nov 19, 2024 at 11:33 GhrVinayGhrVinay 113 bronze badges 7 | Show 2 more comments1 Answer
Reset to default 0I had to pass the GIT Personal Access Token while cloning the repo..
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.GIT_TOKEN }}
From then on I am able to commit/push with the git user which has admin access to the repo and effectively able to bypass the "Require a pull request before merging" check.
I referred to the following: https://www.paulmowat.co.uk/blog/resolve-github-action-gh006-protected-branch-update-failed
I am using GitHub Actions to increment my angular project version as a last step in my workflow. I configured the git user and git email before pushing (i.e, before running 'git push').
git config user.name "${{ secrets.GIT_USER }}"
git config user.email "${{ secrets.GIT_EMAIL }}"
I am getting below error
remote: error: GH006: Protected branch update failed for refs/heads/development.
remote:
remote: - Changes must be made through a pull request.
To .git
! \[remote rejected\] development -\> development (protected branch hook declined)
error: failed to push some refs to '.git'
I realised am not using any password or Git PAT for pushing so tried setting the git remote url as below
git remote set-url origin https://x-access-token:${{ secrets.GIT_TOKEN }}@github/thermofisher/de-instrument-storage-service.git
Additional context:
My repo is a private repo.
The branch ('development') I am trying to push has branch protection rule called Require a pull request before merging checked. Which I should not disable. And also the git user and email that I'm using have admin permission for the repository. So not sure why I am unable to push!
Is there any way, to be able to push changes via GitHub Actions to a protected branch as an admin?
I am using GitHub Actions to increment my angular project version as a last step in my workflow. I configured the git user and git email before pushing (i.e, before running 'git push').
git config user.name "${{ secrets.GIT_USER }}"
git config user.email "${{ secrets.GIT_EMAIL }}"
I am getting below error
remote: error: GH006: Protected branch update failed for refs/heads/development.
remote:
remote: - Changes must be made through a pull request.
To https://github/my-repo-name.git
! \[remote rejected\] development -\> development (protected branch hook declined)
error: failed to push some refs to 'https://github/my-repo-name.git'
I realised am not using any password or Git PAT for pushing so tried setting the git remote url as below
git remote set-url origin https://x-access-token:${{ secrets.GIT_TOKEN }}@github/thermofisher/de-instrument-storage-service.git
Additional context:
My repo is a private repo.
The branch ('development') I am trying to push has branch protection rule called Require a pull request before merging checked. Which I should not disable. And also the git user and email that I'm using have admin permission for the repository. So not sure why I am unable to push!
Is there any way, to be able to push changes via GitHub Actions to a protected branch as an admin?
Share Improve this question asked Nov 19, 2024 at 11:33 GhrVinayGhrVinay 113 bronze badges 7-
try
--force-with-lease
– jessehouwing Commented Nov 19, 2024 at 12:04 - @jessehouwing, Tried git push --force-with-lease, didn't work getting the same error! – GhrVinay Commented Nov 19, 2024 at 17:52
- I think you need to bypass the user without having to meet pull request required protection rule --> you can refer this doc for more details -> github.blog/changelog/… – Dayananda D R Commented Nov 19, 2024 at 17:52
- In that case the branch protection rule probably also prevents force pushes. – jessehouwing Commented Nov 19, 2024 at 18:09
- @DayanandaDR I tried bypass as well, thats when i realised if the git user is already an admin to the repo then no need to explicitly allow that user to bypass. – GhrVinay Commented Nov 21, 2024 at 10:04
1 Answer
Reset to default 0I had to pass the GIT Personal Access Token while cloning the repo..
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.GIT_TOKEN }}
From then on I am able to commit/push with the git user which has admin access to the repo and effectively able to bypass the "Require a pull request before merging" check.
I referred to the following: https://www.paulmowat.co.uk/blog/resolve-github-action-gh006-protected-branch-update-failed
本文标签: githubremote error GH006 Protected branch update failed for refsheadsdevelopmentStack Overflow
版权声明:本文标题:github - remote: error: GH006: Protected branch update failed for refsheadsdevelopment - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745564498a2156365.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
--force-with-lease
– jessehouwing Commented Nov 19, 2024 at 12:04