- Install packages
pip install pre-commit detect-secrets
- Initialize global git template directory
git config --global init.templateDir ~/.git-template - Install pre-commit into the git template
pre-commit init-templatedir ~/.git-template - Create initial secret scan with custom plugins
detect-secrets scan --plugin hf-token-plugin.py > .secrets.baselinedetect-secretsmay expand an absolute file path for the custom plugin, you can edit it to be relative (see our example)- Update the baseline as needed
detect scan --baseline .secrets.baseline
- Use git as normal, hooks should run when you get to
git commit [...]
- If you see the below warning, the file permissions from the git template did not copy correctly (I think this is system dependent and may be a
umaskissue? not exactly sure):hint: The '.git/hooks/pre-commit' hook was ignored because it's not set as executable. - Fix this by changing the file permissions of the hooks
chmod +x .git/hooks/pre-commit
- If you see the below warning, the file permissions from the git template did not copy correctly (I think this is system dependent and may be a
Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|