cookbook/.hooks
Christian Wolf 0ff8bcc252 Make pre-push hook a bit more robust
Signed-off-by: Christian Wolf <github@christianwolf.email>
2023-11-15 20:41:26 +01:00
..
README.md Added some documentation to the hooks 2021-09-26 18:16:44 +02:00
pre-commit Fix bug in hook 2023-08-29 16:20:26 +02:00
pre-push Make pre-push hook a bit more robust 2023-11-15 20:41:26 +01:00

README.md

Usage of git hooks for development

This folder holds some default hooks, you can use while developing.

Before installing make sure, you have no existing hooks installed that might get overwritten.

To install them, you can (under Linux) do from the root folder of the repository

ln -sr .hook/* .git/hooks

Security considerations

Please be aware, that this is sort of a security risk to do this. When checking out foreign code (aka checkout a branch you want to inspect that is from a foreign source), the foreign user might have introduced arbirtrary malicious code into the hook scripts. This code can then be executed depending on your local settings and command line options. Be aware that this might destroy your data!

One option is to copy instead of link the hooks in the folder. That way, you can be sure the hooks are safe (as far as you trust them at the time of copying). The downside is that the hooks will never be updated automatically once you configure it this way.

cp .hook/* .git/hooks

When you need to work with untrusted code (for inspection), you could also remove the links in the .git/hooks folder. That way you disabled the hooks. After being sure, the hooks are clear of malicious code, you can reenable them.

Windows users

You will most likly have to copy the hook scripts as indicated in the security section. As at the time of writing this documentation no windows machine was available, this needs to be added later.