如何防止用户从远程 git 存储库中删除提交

How to prevent users from deleting commit from remote git repository

我在共享托管服务上设置了 git 远程存储库,可以通过 https 访问 git。我想阻止部分或所有开发人员从远程存储库中删除提交。我怎样才能做到这一点?

gitolite specifically, you have different types of permissions.
它们包括一个 'D' 用于删除:

repo @all
    RWCD dummy-branch = foo

这将授权删除一个分支 dummy-branch,但是这将 使所有现有的 RW+ 规则 拒绝删除(因为他们没有'D')

If a rule specifies RWD or RW+D, then rules that do NOT have the D qualifier will no longer permit deleting a ref.

在这种情况下,您指定谁有权删除,其他人默认情况下没有该权利。