I am trying to push to master branch of a repo and I am failing to do so, since it is protected.
I tried to look into the project settings and do not see any option for protected branches. The only option I could see is members.
remote: GitLab: You are not allowed to push code to protected branches on this project. To [email protected]:cmd/release.git ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to '[email protected]:cmd/release.git'
My repo has only one branch, with no contents in it so far.
I do see protected branches options of my other Repos but not for this specific one.
It is a new repo with no contents and with only default branch.
I have the master
permission.
Unfortunately I am not able to upload the image here somehow.
Please suggest how to push code to master branch.
You can allow everyone with write access to push to the protected branch. Go to your project and select Settings > Repository. Expand Protected branches. From the Branch dropdown menu, select the branch you want to protect.
A protected branch does three simple things: it prevents pushes from everybody except users with Maintainer permission. it prevents anyone from force pushing to the branch. it prevents anyone from deleting the branch.
Push Protected - GitHub Action. Push to "status check"-protected branches. Push commit(s) to a branch protected by required status checks by creating a temporary branch, where status checks are run, before fast-forward merging it into the protected branch, finally removing the temporary branch.
12/17/2018
git push
: "error: failed to push some refs to"git push -f
: "remote rejected"Gitlab - Repository - Branches
Gitlab - Settings - Repository - Protected Branches - Unprotect
git push -f
with no contents in it so far
That means there is no master
branch to protect yet, because the empty repo does not has one.
To "Enable/disable branch protection", you need to be Master or Owner of the GitLab project (which you are).
Make sure:
git push -u origin master
;origin
does reference the right repo (git remote -v
);ssh -T [email protected]
);cmd
group.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With