Remote: GitLab: you are not allowed to enter code into secure branches in this project

I am trying to push the leading branch of the repo and I cannot do this because it is protected.
I tried to study the project settings and do not see the possibility for protected branches. The only option I could see was members.

remote: GitLab: You are not allowed to push code to protected branches on this project. To git@gitlab.ins.risk.regn.net :cmd/release.git ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to ' git@gitlab.ins.risk.regn.net :cmd/release.git' 

In my repo, there is only one branch in which there is no content yet.
I see the options for the protected branches of my other repo, but not for this particular one.
This is a new repo with no content and with a default branch.
I have master permission.
Unfortunately, I cannot upload the image here somehow.

Please suggest how to push the code to the master branch.

+8
source share
6 answers

still without content in it

This means that there is no master branch yet for protection, because an empty repo does not have it.

To enable / disable branch protection , you need to be the master or owner of the GitLab project (which you are).

Make sure that:

  • your first step is git push -u origin master ;
  • remote origin refers to the correct repo ( git remote -v );
  • your local ssh key is correct ( ssh -T git@gitlab.ins.risk.regn.net );
  • You are a member of the cmd group.
+4
source

This means that you may have a master branch, but it is protected in the project settings. Cm.:

how to fix it: you are not allowed to enter code into secure branches in this project or https://gitlab.com/gitlab-com/support-forum/issues/207 .

To access the project settings and remove protection from the branch, you need to have sufficient rights.

+2
source

Project: "Settings" β†’ "Protected branches" (if you are at least the "Wizard" of this project).

enter image description here

Then click "Unprotect" or "Developers can click"

0
source

12/12/2018

1. git push : "error: failed to send some links to"

git push: error: failed to push some refs to

git push -f : "remote failure"

git push -f: remote rejected

2. The branch is in a protected state and cannot be forced to work.

Gitlab - Repository - Branches

Gitlab - Repository - Branches

3. temporarily remove the branch of protection.

Gitlab - Settings - Repository - Protected Branches - Unprotect

Gitlab - Settings - Repository - Protected Branches - Unprotect

4. try pressing again

git push -f

git push -f

5. can add protection

0
source

In GitLab, some branches can be protected. By default, only the "main" user can commit protected branches, and the main branch is protected by default.

You can enable and disable protection for selected branches in the project settings (go to the project: "Settings" β†’ "Storage" β†’ "Expand" in "Protected branches").

On the same settings page, you can also allow developers to push secure branches. With this setting, protection will be limited to rejecting operations requiring git push --force

0
source

Perhaps the master branch opens protection. You need to select a developer to click in the settings of the protection branch.

-1
source

Source: https://habr.com/ru/post/1263887/


All Articles