Skip to content

Git pre-commit hook

We have configs and secrets inside .env or .conf files and that files we can't push to github. That is why we use ansible-vault encrypt/decrypt, buy using this method we are at risk that on some point we will make commit without encrypting that secrets. To prevent this we can use git hook pre-commit. This is place where we can put script where on every git commit -m 'Txt' the pre-commit script will be triggered and check.

[

github.com

https://github.com/Attracs/docker-superset/blob/main/script.sh

](https://github.com/Attracs/docker-superset/blob/main/script.sh)

I created this script where we will put this script to: .git/hook/pre-commit