此内容没有您所选择的语言版本。

Chapter 3. 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.

3.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 BPM Suite 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.

  1. In Business Central, go to Authoring Administration.
  2. Below the main menu, click Repositories Clone repository.
  3. 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.git

      Important

      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 3.1. An invalid SCP-style SSH URL.

    • User Name: your Git user name
    • Password: your Git password
  4. Change to the created repository:

    cd JBOSS_HOME/bin/.niogit/REPOSITORY_NAME.git
    Copy to Clipboard Toggle word wrap
  5. Change the remote URL:

    git remote set-url origin git@github.com:USERNAME/REPOSITORY_NAME.git
    Copy to Clipboard Toggle word wrap

    Make 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.

    If you created a new repository, you may encounter the following error:

    fatal: No such remote 'origin'
    Copy to Clipboard Toggle word wrap

    To resolve it, add the remote origin URL:

    git remote add origin git@github.com:USERNAME/REPOSITORY_NAME.git
    Copy to Clipboard Toggle word wrap
  6. Verify that the remote repository was successfully added:

    git remote -v
    Copy to Clipboard Toggle word wrap

    The command should list the following:

    origin  git@github.com:USERNAME/REPOSITORY_NAME.git (fetch)
    origin  git@github.com:USERNAME/REPOSITORY_NAME.git (push)
    Copy to Clipboard Toggle word wrap
  7. Create a file named post-commit with the permissions set to rwxr--r-- under JBOSS_HOME/bin/.niogit/REPOSITORY_NAME.git/hooks with the following content:

    #!/bin/sh
    git push origin master
    Copy to Clipboard Toggle word wrap
  8. Make sure that the configuration was successful by creating a new guided rule in Business Central:

    1. Go to Authoring Project Authoring New Item Guided Rule.
    2. Fill in the required information in the displayed Create new Guided Rule window.
    3. Click Ok.

All of the changes should be pushed automatically.

For further information about remote Git repositories, see How to configure the BxMS 6 server to use a remote Git repository for storing assets?.

It is also possible to specify the system property org.uberfire.nio.git.hooks. Its value determines a directory with default hook files, which 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>
Copy to Clipboard Toggle word wrap
返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2025 Red Hat