Skip to main content

Git without secrets

Project description


Git without secrets


Python 3 is required. Python 2 is not supported.

Second, Python 3's bin directory needs to be in your PATH environment variable. For example, if you are using the install on macOS, you will need to add the following to your ~/.profile.



git-secrets is located on PyPI.

To install, run the following.

$ pip3 install qpp-git-secrets

sudo may be needed if your Python 3 installation is in a protected directory. This will put the command the bin directory of your Python 3 installation.

To update git-secrets to the latest version, run the following.

$ pip3 install --upgrade qpp-git-secrets

Again, sudo may be required.


Currently, git-secrets only checks the added lines of staged files. AKA, only the added lines that are about to be committed will be checked.

Installing the Pre-commit Hook

Run the following when the PWD is in the repository you want to add a pre-commit hook...

$ git secrets install

If there exists a pre-commit.d directory, this will add a bash script into that directory. If that directory doesn't exist, the pre-commit bash script will be created directly. If the pre-commit script already exists, git-secrets will exit with an error since it chooses to not remove the previous pre-commit script.

Manually scanning

If you want to manually scan a repository, you can run the following while your PWD is in the repository...

$ git secrets scan

Secrets are then scanned.

Specifying Secrets

There are two locations that git-secrets checks for secret specifications. The secrets from the two locations are merged together.

  1. A .gitsecrets file in the top level directory of the repository.
  2. ~/.gitsecrets.

Each line in these files should contain a regular expression. The regular expression syntax is based off what the Python 3 re module supports.

Example Secrets

TINs that don't start with 000 or 999 or don't have 00 for the middle number group.



I accept PRs! Check out the issues.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

qpp-git-secrets-1.1.1.tar.gz (5.2 kB view hashes)

Uploaded source

Built Distribution

qpp_git_secrets-1.1.1-py3-none-any.whl (20.4 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page