GitLab allow force push

By default, Gitlab has protection to force push to repository. It’s a good protection while collaborating with other peoples. But in this blog post, I’ll talk about how to break rules 🙂

Today by mistake our developer pushed important credentials to repository. It’s not nice to share secrets with everybody. We wanted momentarily to open force push.

If you want to do that also you have to change few things. All things are easy to perform, otherwise not easy to guess where is the correct button 🙂 So that I’ll want to share recipes of that steps which explains where they are 🙂

1 General push settings

  1. Main page right corner click Admin area
  2. Settings
  3. Visibility and Access Controls
  4. Change default branch protection

1.1 User role in repository(If  Partially protected(Recommended))

  1. Go to project page which you want to change
  2. Click members from left menu
  3. Change member permission as Master

2 Branch protection

If there is a problem still this is the last thing that you have to do. Actually this well-hidden configuration.

  1. You must go to project page
  2. Click to project setting
  3. Protected Branches
  4. Click Unprotect master branch

After that settings, you can use push -f command (Be careful you can lose your data!). I am not the responsible person if it happens 🙂

Take care.