GitPolicyEnforcer 0.3.0

GitPolicyEnforcer is a command-line tool that helps you enforce Git policies through Git hooks, both server and client side

Build status


This is a command line utility written in Rust, that helps you utilize Git hooks, to enforce various policies.

It currently supports only the update server side Git hook. The goal is to include client side hooks too.

The tool has been developed so far for usage with self-hosted GitLab CE instances, due to internal needs. It should also work though, for bare git servers (maybe with some minor changes).

This is work in progress. You are welcome to contribute if this project is useful to you.


For now, please check the following YouTube video:

Rust: GitPolicyEnforcer

According to time availability, more documentation will be added, and further development will happen.

On the fly regex validation

You can quickly test you regexes both for successful regex creation and value validation, before deploying by using the respective feature. Example usage:

Expected to succeed:

gpe --regex '^\d test$' --regex-value '1 test'

Expected to fail at value validation:

gpe --regex '^\d test$' --regex-value 'hello world'

Expected to fail during regex creation:

gpe --regex '^\e{1,1}$' --regex-value 'hello world'


You need a Rust installation in order to compile it.

To build GitPolicyEnforcer:

git clone
cd GitPolicyEnforcer
cargo build --release
./target/release/gpe --help

The produced binary is gpe located in the GitPolicyEnforcer/target/release directory.


GitPolicyEnforcer is distributed under the terms of both the MIT license and the Apache License (Version 2.0).