Precommit hook

Prevent .env files from being committed to code with dotenvx's pre-commit hook.


dotenvx precommit --install

This installs a shell script to .git/hooks/pre-commit.


If you have installed the precommit hook with dotenvx precommit --install, simply attempt to commit a .env file to code.

touch .env
git add .env
git commit -am "add .env file"
[[email protected]][precommit] .env not properly gitignored
? add .env to .gitignore with [echo ".env*" >> .gitignore]

The dotenvx precommit hook tries to give you next steps wherever possible.

Manual Usage

If you prefer not to install it as a hook you can run it manually. This can be useful for ci.

dotenvx precommit