How to force push to Gitlab

Gitlab で force push が出来ない。どうやら Protected Branches には force push は出来ないらしい。


How to force push to Gitlab

出典:git – How to force push to Gitlab – Stack Overflow
  1. Navigate to your project’s Settings ➔ Repository
  2. Scroll to find the Protected branches section.
  3. From the Branch dropdown menu, select the branch you want to protect and click Protect.

Protected Branches

出典:Protected branches · Project · User · Help · GitLab

By default, a protected branch does four simple things:

  • It prevents its creation, if not already created, from everybody except userswith Maintainer permission.
  • 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.

Project members permissions

出典:Permissions · User · Help · GitLab

The following table depicts the various user permission levels in a project.

  • Force push to non-protected branches
  • Force push to protected branches (4)


メールアドレスが公開されることはありません。 * が付いている欄は必須項目です