.gitleaksignore file is ignored when using pre-commit
Author: fabasoadCreated Dec 3, 2022Updated Aug 28, 2026
Labelsbug
Describe the bug
I have a frontend project that generates uuid during tests and save them into *.snap files. These uuid are OK to commit but gitleaks detects them as secrets, which is fine. Though, adding fingerprints of each error to .gitleaksignore file to ignore them - doesn't help.
To Reproduce
- Have project with secret hardcoded.
- Add
pre-commit-config.yamlfile with the content below. (Additional context: [1]) - Run
pre-commit run gitleaks. - Be sure that secret is detected.
- Create
.gitleaksignorefile and copy-paste fingerprint from the output at step 4. - Run
pre-commit run gitleaks.
Actual behavior
gitleaks detects that line anyway, meaning that .gitleaksignore file is ignored.
Expected behavior
Line which fingerprint has been added to the .gitleaksignore file shouldn't be detected anymore.
Screenshots N/A
Basic Info (please complete the following information):
- OS: macOS Monterey, version 12.6
- Gitleaks Version: 8.5.12
Additional context
[1] pre-commit-config.yaml:
- repo: https://github.com/zricethezav/gitleaks
rev: v8.15.2
hooks:
- id: gitleakscc @zricethezav
Source: gitleaks/gitleaks