This repository includes automated security checks to prevent accidental commits of sensitive information.
The pre-commit hook automatically scans staged files for:
- Personal file paths - Absolute paths to user home or mount directories
- Credentials and secrets - Passwords, API keys, tokens, private keys
- Local development files -
CLAUDE.md,.claude/folder - Suspicious patterns - Keywords like
password=,secret=,token=, AWS keys, etc.
If violations are found, the commit is blocked with a clear error message.
The hook is ready to use. Install it with:
./setup-hooks.shThis copies the hook from .githooks/pre-commit to .git/hooks/pre-commit and makes it executable.
If the hook detected sensitive information:
- Review the error message
- Locate and fix the file
- Stage the corrected file
- Commit again
Example:
# Hook blocked commit due to hardcoded path
git diff --cached # See what's staged
# Edit the file to remove the hardcoded path references
git add path/to/file
git commit -m "Fix hardcoded paths"# See all staged changes
git diff --cached
# See specific file
git diff --cached path/to/file
# Unstage if needed
git reset HEAD path/to/fileNever commit files containing:
- Absolute paths to user home or mount directories
- User-specific directory references
- API keys or tokens
- Passwords or credentials
- Private SSH keys
- Secrets files
If you have a legitimate reason to bypass the hook:
git commit --no-verify -m "message"Warning: Use --no-verify only in exceptional cases. It disables all security checks.
To modify what the hook checks:
- Edit
.githooks/pre-commit - Run
./setup-hooks.shto reinstall - Test with a dummy commit
Test the hook by staging a file containing an absolute user path, then attempting a commit. The hook should block it with a clear error message.
If you need to temporarily disable the hook:
# Disable
chmod -x .git/hooks/pre-commit
# Re-enable
chmod +x .git/hooks/pre-commit.githooks/pre-commit- The actual hook script (versioned in git).git/hooks/pre-commit- Installed copy (created bysetup-hooks.sh)setup-hooks.sh- Script to install the hook
The .githooks/ directory is versioned, so all team members get the same hook. The .git/hooks/ directory is local to each clone.
If the hook is too strict or blocks legitimate commits:
- Check if the file should be in
.gitignore - Review the error message
- Ensure the file doesn't contain actual sensitive information
- KICAD_CHECKLIST.md - Security best practices
- ../.gitignore - Files excluded from git