Question

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.

Was it helpful?

Solution

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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top