Pre-receive hooks run tests on code pushed to a repository to ensure contributions meet repository or organization policy. If the commit contents pass the tests, the push will be accepted into the repository. If the commit contents do not pass the tests, the push will not be accepted.
If your push isn't accepted, you'll see an error message corresponding to the failed pre-receive hook.
$ git push Counting objects: 3, done. Delta compression using up to 4 threads. Compressing objects: 100% (2/2), done. Writing objects: 100% (3/3), 916 bytes | 0 bytes/s, done. Total 3 (delta 0), reused 0 (delta 0) remote: always_reject.sh: failed with exit status 1 remote: error: rejecting all pushes To https://188.8.131.52/hodor/nope.git ! [remote rejected] main -> main (pre-receive hook declined) error: failed to push some refs to 'https://184.108.40.206/hodor/nope.git'
Your GitHub Enterprise Server site administrator can create and remove pre-receive hooks for your organization or repository, and may allow organization or repository administrators to enable or disable pre-receive hooks. For more information, see "Enforcing policy with pre-receive hooks."