Check out the docs from GitLab on how to configure custom git hooks. This would need to be done by an administrator as you need filesystem access. If you used the DigitalOcean One-Click or GitLab’s Omnibus installer, you can find the git repository in disk at:
/var/opt/gitlab/git-data/repositories/<group>/<project>.git
Inside of that directory, you can create a new directory named custom_hooks
In there, you can create and use normal git hooks. For instance if you wanted to run a script to compile SASS after a push, you could use a post-receive
hook.
You’ll also need to make sure the directory is owned by the git
user:
- chown -R git:git /var/opt/gitlab/git-data/repositories/<group>/<project>.git/custom_hooks
For more info on writing git hooks, check out:

by Justin Ellingwood
Git is a very robust and mature version control system that has seen great adoption in recent years. One of git's great features is its ability to use "hooks" to call arbitrary scripts when certain git events occur. In this guide, we'll discuss the general idea behind git hooks, talk about how to work around some of its inconsistencies, and demonstrate some implementations that you can use in your development process.
Rather than reinventing the wheel, here you go:
Jenkins Gitlab plugin