Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot push on github suddently

Tags:

github

Well, it is very weird. I'm using Github protection rules to enforce to make pull requests and to trigger TravisCI for every push. However, because of continuous translation, I need a user who should be able to push without making a pull request and avoiding TravisCI status check (for that I use [ci skip]). This user is included in the white list that Github provides in branch protection rules. It worked perfect since last week, suddenly when I try to push with this user I receive this:

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://*****'

It is very weird since it always worked till now. And, the user has permissions to push without making a pull request and it is skipping Travis with through the commit message so I do not understand why Github is asking me about status check and approvals.

like image 511
David Escalera Avatar asked Oct 01 '18 10:10

David Escalera


5 Answers

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...

like image 141
David Escalera Avatar answered Oct 11 '22 19:10

David Escalera


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.

like image 42
JohnBegood Avatar answered Oct 11 '22 18:10

JohnBegood


Master [now Main] is a protected branch. You need to make a new branch and push that instead.

Seen in branch protection rules: enter image description here

like image 8
Kalanos Avatar answered Oct 11 '22 18:10

Kalanos


In my case a Branch Protection Rule was misfiring. Deleting the rule, then recreating it in GitHub fixed the issue.

like image 2
O Wigley Avatar answered Oct 11 '22 17:10

O Wigley


In my case a security rule was somehow created for the repo. This rule allowed only admins to push. I deleted that rule and things started working as expected.

Repo > Settings > Branches > Branch protection rules [Delete]

like image 1
singh2005 Avatar answered Oct 11 '22 19:10

singh2005