Error
Attempting to stage files that match a blocked pattern (default: tmp/*).
Why this matters
Temporary files, build artifacts, and scratch directories should not be committed. Staging them clutters history and can leak sensitive data or large binaries.
How to fix
Remove the blocked files from your git add command:
# Instead of:
git add tmp/scratch.txt
# Add only the files you want:
git add src/main.go internal/parser.go
If you need to track a file in a blocked directory, update the blocked patterns in configuration.
Configuration
[validators.git.add]
blocked_patterns = ["tmp/*", "*.secret"]
Disable the validator:
[validators.git.add]
enabled = false
Hook output
When this error is triggered, klaudiush writes JSON to stdout:
permissionDecisionReason (shown to Claude):
[GIT019] Blocked files in git add: tmp/scratch.txt. Remove blocked files from your git add command. Do not stage these files.
systemMessage (shown to user): Formatted error with fix hint and reference URL.
additionalContext (behavioral guidance):
Automated klaudiush validation check. Fix the reported errors and retry the same command.
Related
- GIT009 - file does not exist for git add