In this page

Overview

This page is about implementing Better Commit Policy specifically in Git repositories hosted by the GitLab.com service. If you use Git, but not GitLab.com, please see the general Git guide instead. Or, if you use GitLab Community Edition (CE) or GitLab Enterprise Edition (EE), not GitLab.com, see the Git with GitLab Self-Managed guide instead.

Working with GitLab.com commit policies

GitLab.com hooks: the limitation

GitLab.com is a public cloud-based service operated by its own team. Being a managed service, it doesn't give access the filesystem where the central repositories are stored, therefore you cannot manually install Git hooks to those. GitLab.com has no web-based feature to manage Git hooks, either.

It means that GitLab.com does not allow using custom server-side hooks currently.

As Better Commit Policy relies on server-side hooks for server-side verification, you can implement Better Commit Policy only in the local repositories for GitLab.com at the moment.

There are no other limitations. All features of the Better Commit Policy app work 100% also for GitLab.com hosted repositories.

GitLab.com hooks: the solution

To work around the limitation caused by missing server-side hooks, use local hooks consistently.

Note that it is possible to reach the same level of safety by using local hooks only as by using server-side hooks. For that, all developers in your team should activate local verification in their local repositories. It guarantees that only verified commits will be pushed to the central repository hosted by GitLab.com.

The ultimate solution

Although the current solution works fine, we will absolutely implement server-side verification also for GitLab.com as soon as they support custom server-side hooks. Note that only the GitLab.com team can remove this blocker.

To indicate its importance:

  1. Please open a ticket in the GitLab.com support system. Ask for the feature "Support for custom pre-receive hooks" and explain your use case in short. As it takes only 2 minutes of your time, absolutely do this. The more tickets opened with this feature request, the higher probability it will be implemented.
  2. Also, there is a counter-part feature request at Midori. Although the GitLab.com feature request must be solved first, we use this one to collect feedback and interest on our side. Vote for this by clicking the "thumbs-up" icon, add your use case as a comment and click "Follow". All future updates on this story will be posted there.

Installing GitLab.com hooks

Installing GitLab.com hooks for local verification

The process is straight-forward:

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

That's it.

GitLab.com commits

In your daily developer workflow, when creating commits and pushing those to GitLab.com, you can use your Git client in the usual way. Looking from the client side, GitLab.com will be totally transparent for you: it will be "just a Git server".

See the Git commits section for detailed instructions.

Questions?

Ask us any time.