In this page

This page is specifically for Git repositories hosted by the GitHub service!

If you use Git, but not GitHub, please see the general Git guide instead.

Working with GitHub commit policies

The problem with GitHub hooks

GitHub is a public cloud-based service operated by its own team. Unfortunately, the service does not allow customizing the server-side hooks in the GitHub repositories! It is by design.

They decided to disallow it, because customizing uncontrolled hooks could lead to stability problems and security issues, which would then destroy the GitHub experience. Again, it is a deliberate decision by the GitHub team, not a defect in GitHub and not a defect in Better Commit Policy.

Consequently, as Better Commit Policy relies on Git hooks, it is not possible to implement Better Commit Policy directly in the server-side GitHub repositories.

Read on, there is another approach you can take!

Using local hooks instead of GitHub hooks

What you can do is executing the verification in the developers' local repositories instead of the central repository. It works perfectly also with GitHub. If all developers install the hooks to their local clone repositories, you get the same level of safety as if you'd enforce the policy in the central repository.

There are no other limitations. All features of the Better Commit Policy app work also for GitHub hosted repositories.

Installing GitHub commit policies

The process looks like this:

  1. Create the commit policy.
  2. Ask your developers to install hook script of the policy to their local repositories. (It's a short self-service process everyone can complete in minutes.)

(Please note that a "share policy" feature that eases distributing and monitoring the hook script installation will be implemented soon. If it were valuable to you, vote to the public feature request.)

Has every team member installed the hook script?

First the bad news: this is not possible to strictly enforce the installation of the hook scripts. Why? If the hook script is not installed, then your Git is basically not talking to Jira, so Better Commit Policy cannot know about your repository at all.

Nevertheless, administrators still have the possibility to keep their eyes on the commits, to spot the ones that are eventually violating the policy. For example, if you know that the policy requires mentioning a Jira issue, and a committer is sending commits without that, then clearly: he forgot to install the hook script! Ask him to do so!

(We have an idea for a creative solution for this problem, using a post-mortem mechanism to automagically detect these missing installations. If this is valuable to you, please vote to the public feature request.)

Questions?

Ask us any time.