title: How do I activate a pre-receive hook in GitLab?
body: <p>I need to check each commit coming into GitLab and block any of them which have a certain file in. I used the documentation <a href="https://docs.gitlab.com/ee/administration/server_hooks.html" rel="nofollow noreferrer">here</a></p>
  <p>I have created a file named <code>pre-receive</code> in the <code>.git/custom_hooks</code> directory.</p>
  <p>The file just has the contents:</p>
  <pre><code>#!/bin/sh
  exit 1
  </code></pre>
  <p>Which, I believe, should reject any attempt to push code to the repo (?)</p>
  <p>The file is owned by git and is executable:</p>
  <p><code>ls -a</code> gives the response:</p>
  <blockquote>
  <p>-rwxrwxrwx 1 git root 550 ...</p>
  </blockquote>
  <p>The custom_hooks directory is also executable and owned by the git user.</p>
  <p>But all commits go through without issue, the commit hook does not seem to activate in any way.</p>
  <p>I do not see anything else in the documentation that I am supposed to do.
  Have I missed anything?</p>