Git hooks allow scripts to be invoked when certain important git repository actions occur. This configuration controls the execution of client-side hooks on Jenkins agents. It is recommended that git hooks be disabled on Jenkins agents.
Most git repositories do not use hooks in the repository and do not need repository hooks. In those rare cases where repository hooks are needed, it is highly recommended that they are disabled on the Jenkins controller and on Jenkins agents.
Client-side hooks are not copied when the repository is cloned. However, client-side hooks might be installed in a repository by build steps or by misconfiguration.
If hook scripts are allowed on agents, a client-side hook script installed in a repository on a Jenkins agent will execute when the matching git operation is performed.
For example, if hooks are allowed on agents and a git repository on an agent includes a post-checkout
hook, the hook script will run on the agent after any checkout in that repository.
If hooks are allowed on agents and a git repository on an agent includes a pre-auto-gc
hook, the hook script will run on the agent before any automatic git garbage collection task.
See "Customizing Git - Git Hooks" for more details about git repository hooks.