Setting up a Gitlab Hook to autocompile SASS

Posted June 9, 2015 3.6k views

Hi there,

I’m just wondering if someone ever set up a hook within gitlab to autocompile SASS as soon as a push has been done. If so, I would gladly appreciate any hint on how you did it or if there is better way to compile pushed SASS.

Kind Regards

1 comment

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

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:


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.