Copy the hooks to the .git/hooks
folder inside your project directory.
To apply Git hooks globally, place the hook scripts in a designated directory and configure Git to use it:
git config --global core.hooksPath /path/to/global/hooks
- Prevent accidental commits of
.env
files to protect sensitive data. - Prevent large files from being committed.
The pre-commit hook blocks any commit containing a .env
file or a file larger than 5MB.
To explicitly allow commits with .env
files, use the following command:
GIT_ALLOW_ENV=1 git commit -m "Your commit message"
To allow commits with large files, use the following command:
GIT_ALLOW_LARGE_FILES=1 git commit -m "Your commit message"