Show Table of Contents
Chapter 4. Repository Hooks
In Business Central, it is possible to trigger a chosen action every time a particular event happens. For this purpose, you can configure the repository to use scripts called hooks.
4.1. Configuring Git Hooks
Business Central can automatically push changes to a remote repository using the Git hooks. Git hooks support has been introduced with the release of Red Hat JBoss BRMS 6.2.0.
Note
Please note that currently only the
post-commit hook is supported. Post-commit hooks are triggered after finishing the entire commit process.
The following procedure shows how to configure the
post-commit hook to automatically push your changes to the remote repository.
- In Business Central, go to → .
- Below the main menu, click → .
- In the displayed Clone repository dialog box, fill in the repository information:
- Repository Name
- Organizational Unit
- Git URL: for example
https://github.com/USERNAME/REPOSITORY-NAME.gitImportant
It is important to use the HTTPS or Git protocol instead of a SCP-style SSH URL. Business Central does not support the basic SSH URL and fails with Invalid URL format.
Figure 4.1. An invalid SCP-style SSH URL.
- User Name: your Git user name
- Password: your Git password
- Go to the created repository:
~]$
cd $JBOSS_HOME/bin/.niogit/REPOSITORY-NAME.git - Change the remote URL:
~]$
git remote set-url origin git@github.com:USERNAME/REPOSITORY-NAME.gitMake sure that you can access the remote repository through command line using SSH. For example, the private SSH key for the repository should exist under the~/.ssh/directory. - Verify that the remote repository was successfully added:
~]$
git remote -vThe command should list the following:origin git@github.com:USERNAME/REPOSITORY-NAME.git (fetch) origin git@github.com:USERNAME/REPOSITORY-NAME.git (push)
- Create a file named
post-commitwith the permissions set torwxr--r--under$JBOSS_HOME/bin/.niogit/REPOSITORY-NAME.git/hookswith the following content:#!/bin/sh git push origin master
- Make sure that the configuration was successful by creating a new guided rule in Business Central: go to → and then → below. Fill in the required information in the displayed Create new Guided Rule window and click .All of the changes should be pushed automatically.
For further information about remote Git repositories, refer to this article: How to configure the BxMS 6 server to use a remote Git repository for storing assets?
Furthermore, it is also possible to specify the system property
org.uberfire.nio.git.hooks. Its value determines a directory with default hook files that will be copied to the newly created Git repositories. See the example of a standalone.xml file with this setting below:
<system-properties> <property name="org.uberfire.nio.git.hooks" value="/opt/jboss-as/git-hooks"> </property> ... </system-properties>

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.