add pre-commit instructions (#749)

This commit is contained in:
Zachary Rice authored and GitHub committed 2021-12-10 18:08:31 -06:00
1 parent 3fedf6f8e7
commit b8141713e8
1 file changed
+22
+22
View File
@@ -61,6 +61,28 @@ cd gitleaks
make build make build
``` ```
### Pre-Commit
1. Install pre-commit from https://pre-commit.com/#install
2. Create a `.pre-commit-config.yaml` file at the root of your repository with the following content:
```
repos:
- repo: https://github.com/zricethezav/gitleaks
rev: v8.2.0
hooks:
- id: gitleaks
```
3. Install with `pre-commit install`
4. Now you're all set!
```
➜ git commit -m "this commit contains a secret"
Detect hardcoded secrets.................................................Failed
```
Note: to disable the gitleaks pre-commit hook you can prepend `SKIP=gitleaks` to the commit command
and it will skip running gitleaks
```
➜ SKIP=gitleaks git commit -m "skip gitleaks check"
Detect hardcoded secrets................................................Skipped
```
## Usage ## Usage
``` ```