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
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745564501a4633310.html
--force-with-lease
– jessehouwing Commented Nov 19, 2024 at 12:04