Cannot push on github suddently
In my case a Branch Protection Rule was misfiring. Deleting the rule, then recreating it in GitHub fixed the issue.
The latest issue I had :
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
Because I'm admin/owner I was able to go and do the following and that helped me to resolve the push
problem.
Steps :
--> Settings
-->Branches
--> Tick Allow force pushes
Permit force pushes for all users with push access.
That will do the work.
I solved it finally giving admin access to the user instead of just write access. Now it is able to push avoiding approvals and status check. But I don't understand why does not work just being in the white list of protection branch rules... It worked before, looks like GitHub made some changes...
Master [now Main] is a protected branch. You need to make a new branch and push that instead.
Seen in branch protection rules: