You can turn on history protection for the entire integration server or for an individual Git repository.
To turn on history protection server-wide (for all repositories hosted on the Git
integration Server), do the following:
Note: If you enable history protection server–wide, it cannot be overridden (turned off) for an individual Git repository. It will remain in effect for all Git repositories on the integration server.
Set the property forceHistoryProtection=true in
/opt/collabnet/gerrit/etc/gerrit.config under the
Restart the gerrit service.
- service gerrit restart
- Set the property forceHistoryProtection=true in /opt/collabnet/gerrit/etc/gerrit.config under the [gerrit] section.
To turn on history protection for an individual Git repository in a TeamForge project,
do the following:
- In the Source Code page, select the Git repository.
In the Description field, enter [Repo:ProtectHistory].
You can turn history protection on or off any time. However, your change will not be reflected in Gerrit immediately. It will be effective after the time defined as the regular refresh interval while installing the Git integration.If you want your change to take effect immediately, do this right after changing the repository description: as a user with the Source Code Admin permission, temporarily remove any user having a project role with any SCM permission, and then add that user back. This will trigger an immediate sync, which will then enable History Protection. After that, the Gerrit Administrator will be able to see History Protection enabled in the Gerrit web interface (by logging in as a Gerrit Administrator and clicking the General link for the project with the name of the Git repository).