aboutsummaryrefslogtreecommitdiff
path: root/.githooks/pre-commit
blob: d104d78604249ed71b3117e94d3126da3612ee87 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
#!/usr/bin/env sh
# Author:  cirakg & claude ai
# Summary: Scan staged changes with Gitleaks before committing.
set -eu

if ! command -v gitleaks >/dev/null 2>&1; then
    echo "Gitleaks is required by this hook. See CONTRIBUTING.md for installation." >&2
    exit 1
fi

repo_root=$(git rev-parse --show-toplevel)
exec gitleaks git --pre-commit --staged --redact --no-banner --config "$repo_root/.gitleaks.toml" "$repo_root"