I would like to use pre-commit hook in gitlab. I doing everything like in documentation: https://docs.gitlab.com/ce/administration/custom_hooks.html
In custom_hooks directory I've created pre-commit file with folowing content:
#!/bin/bash
exit 1
Hook is never triggered, couse i can commit.
When i do the same with pre-receive hook - everything works good.
If Gitlab doesnt't let to use pre-commit hook?
As explained in Customizing Git - Git Hooks, a client-side hook won't be used on the server.
I explained before why it is not possible to include hooks in a clone:
Since GitLab 7.5, you can set custom Git Hooks for server-side hooks.
Git natively supports hooks that are executed on different actions. Examples of server-side git hooks include pre-receive, post-receive, and update
Normally, Git hooks are placed in the repository or project's hooks directory. GitLab creates a symlink from each project's hooks directory to the gitlab-shell hooks directory for ease of maintenance between gitlab-shell upgrades