2

Our team members are not all familiar with git, some members may take a mistake to force push the local branch on to server especially if they are using Windows GUI tools.

I'm wondering if there is any way to control the force push permission for different roles. I googled, but found no answer. I'm using latest Gitlab.

1
  • Sorry for the downvote and close vote: this is 100% on topic on Stack Overflow.
    – VonC
    Mar 21, 2014 at 7:55

1 Answer 1

2

Not yet (should be in GitLab 6.8+): there is a pull request in progress: "pull 6190", which stemmed from this suggestion.

GitLab already has protected branches that prevent push for all except masters. However, there's still the problem of accidental history rewrites and force pushes by masters that can wipe out the whole repository (has happened in real life).

Therefore it is useful to additionally have protection against branch deletion and history rewriting.

The code changes are visible here and are based on a pull request on gitlab-shell, with a definition in lib/gitlab_update.rb:

def forced_push?
    missed_refs = IO.popen(%W(git rev-list #{@newrev}..#{@oldrev} --)).read
    missed_refs.split("\n").size > 0
end
1
  • Thanks for this information. I was expecting there might already have a solution. Hope this pull request be merged ASAP.
    – Han He
    Mar 21, 2014 at 10:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.