Configure how people will use pre-receive hooks within their GitHub Enterprise appliance.
Creating pre-receive hooks
As a site admin, sign in to your GitHub Enterprise instance at
http(s)://[hostname]/login
.In the upper-right corner of any page, click .
In the left sidebar, click Admin center.
In the left sidebar, click Pre-receive hooks.
Click Add pre-receive hook.
- In the Hook name field, enter the name of the hook that you want to create.
From the Environment drop-down menu, select the environment on which you want the hook to run.
From the Script drop-down menu, select the repository that contains your pre-receive hook script. In the Script field, enter the filename of the pre-receive hook script.
Select Use the exit-status to accept or reject pushes to enforce your script. Unselecting this option allows you to test the script while the exit-status value is ignored. In this mode, the output of the script will be visible to the user in the
command-line but not on the web interface.- Select Enable this pre-receive hook on all repositories by default if you want the pre-receive hook to run on all repositories.
- Select Administrators can enable and disable this hook to allow organization members with admin or owner permissions to select whether they wish to enable or disable this pre-receive hook.
Editing pre-receive hooks
In the left sidebar, click Pre-receive hooks.
Next to the pre-receive hook that you want to edit, click .
Deleting pre-receive hooks
In the left sidebar, click Pre-receive hooks.
Next to the pre-receive hook that you want to delete, click .
Configure pre-receive hooks for an organization
An organization administrator can only configure hook permissions for an organization if the site administrator selected the Administrators can enable or disable this hook option when they created the pre-receive hook. To configure pre-receive hooks for a repository, you must be an organization administrator or owner.
In the top right corner of GitHub Enterprise, click your profile photo, then click Your profile.
On the left side of your profile page, under "Organizations", click the icon for your organization.
Under your organization name, click Settings.
In the left sidebar, click Hooks.
- Next to the pre-receive hook that you want to configure, click the Hook permissions drop-down menu. Select whether to enable or disable the pre-receive hook, or allow it to be configured by the repository administrators.
Configure pre-receive hooks for a repository
A repository owner can only configure a hook if the site administrator selected the Administrators can enable or disable this hook option when they created the pre-receive hook. In an organization, the organization owner must also have selected the Configurable hook permission. To configure pre-receive hooks for a repository, you must be a repository owner.
In the top right corner of GitHub Enterprise, click your profile photo, then click Your profile.
Click Repositories and select which repository you want to configure pre-receive hooks for.
Under your repository name, click Settings.
In the left sidebar, click Hooks & Services.
- Next to the pre-receive hook that you want to configure, click the Hook permissions drop-down menu. Select whether to enable or disable the pre-receive hook.