mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-12-01 13:34:23 +01:00
add pre-commit instructions (#749)
This commit is contained in:
1 parent
3fedf6f8e7
commit
b8141713e8
1 file changed
+22
@@ -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
|
||||||
```
|
```
|
||||||
|
|||||||
Reference in new issue
Block a user