1
0
mirror of synced 2025-12-26 14:02:45 -05:00
Files
docs/content/github/collaborating-with-issues-and-pull-requests/working-with-pre-receive-hooks.md
Nick Schonning d9167f1449 chore: Add missing code fence languages (#772)
* chore: Add missing code fence languages

* Update content/actions/creating-actions/dockerfile-support-for-github-actions.md

* Add raw & endraw markers around shell content

See review comment by @rachmari

* Add raw & endraw markers around shell content

See review comment by @rachmari

* Remove language from code fences

to avoid the problem of replaceable text indicates like
<this> not showing up in the output page.

Co-authored-by: hubwriter <hubwriter@github.com>
2021-01-18 12:04:46 +00:00

1.6 KiB

title, intro, redirect_from, versions
title intro redirect_from versions
Working with pre-receive hooks *Pre-receive hooks* enforce rules for contributions before commits may be pushed to a repository.
/articles/working-with-pre-receive-hooks
enterprise-server
*

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://54.204.174.51/hodor/nope.git
 ! [remote rejected] main -> main (pre-receive hook declined)
error: failed to push some refs to 'https://54.204.174.51/hodor/nope.git'

Error message for failed pre-receive hook

Your {% data variables.product.product_name %} 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 "[Using pre-receive hooks to enforce policy](/enterprise/{{ currentVersion }}/admin/guides/developer-workflow/using-pre-receive-hooks-to-enforce-policy)."