Backing up the Model to a Git Repository
- Last Updated: May 13, 2026
- 2 minute read
- Semaphore
- Documentation
The GitBackup Output Processor bean allows you to backup your model to a git repository each time you publish. It will backup both the main graph and the history graph (TCH). It also can backup any linked graphs and publishing config files. There is support for both HTTP and SSH connections.
<bean id="gitBackupWithStaticVersionUsingHTTPS" class="com.smartlogic.publisher.gitbackup.GitBackup">
<property name="remoteRepository" value="https://github.com/Smartlogic-Semaphore-Limited/test.git"/>
<property name="gitCredentialsProvider" ref="GitCredentials" />
<property name="sparqlEndpoint" value="${sparql.endpoint}" />
<property name="version" value="v_0_0_1"/>
<property name="modelsToInclude">
<list>
<value>IPSV</value>
<value>myExample</value>
</list>
</property>
<property name="filesToInclude" >
<list>
<value>config/${model.name}/publisher-template/*</value>
<value>config/${model.name}/*.xml</value>
</list>
</property>
</bean>
<bean id="GitCredentials" class="org.eclipse.jgit.transport.UsernamePasswordCredentialsProvider">
<constructor-arg index="0" value="testingUser" />
<constructor-arg index="1" value="testingUserPassword" />
</bean>
A GitBackup Output Processor bean for SSH remote connections.
<bean id="gitBackupWithStaticVersionUsingSSH" class="com.smartlogic.publisher.gitbackup.GitBackup">
<property name="remoteRepository" value="git@github.com:Smartlogic-Semaphore-Limited/test.git"/>
<property name="sshPrivateKeyPath" value="path_private_key"/>
<property name="sparqlEndpoint" value="${sparql.endpoint}" />
<property name="version" value="v_0_0_1"/>
<property name="modelsToInclude">
<list>
<value>IPSV</value>
<value>myExample</value>
</list>
</property>
<property name="filesToInclude" >
<list>
<value>config/${model.name}/publisher-template/*</value>
<value>config/${model.name}/*.xml</value>
</list>
</property>
</bean>
GitBackup Bean Properties
- remoteRepository - This is the HTTP/HTTPS git url for the remote repository.
- sparqlEndpoint - The SPARQL endpoint needs to be as provided by OE. See example.
- gitCredentialsProvider - This is another bean of type class=“org.eclipse.jgit.transport.UsernamePasswordCredentialsProvider” which provides the username and password for the git repository.
- version - The version can be a static version, which is then used to prefix for the commit message. This value can also be provided by the model.
- commitMessage - The message used for the commit. If not supplied a default value will be used
- modelsToInclude - This is a list of the models you want to backup. The user that publishes the model will need to have access to the models in this list. Otherwise, it can include any model in OE. Typically, you would include the model being published and optionally the linked models listed individually.
- filesToInclude - This is a list of files to include in the backup. The example shown will backup the publisher configuration. The included files will be located in a directory called “includedFiles” under your main model backup folder name. i.e. IPSV/includedFiles. Note, filesToInclude cannot include directories.
- localRepositoryDirectoryPath - This is the directory of your local repository. This should be empty initially. If you have trouble with merges or cloning, clear out this directory and try again.
UsernamePasswordCredentialsProvider Bean Properties
- constructor-arg index=“0” - Pass in the user name for your Git repository in this parameter.
- constructor-arg index=“1” - Pass in the password for the user in the previous argument.
By default this output processor will create a temporary directory, clone the repository, copy the updated artifacts into the temporary directory and commit any changes. The temporary directory is then destroyed. To use a static directory, set localRepositoryDirectoryPath.
SSH - In order to use SSH, you must have a RSA type entry for your remote git repository in your SSH known_hosts file on the publishing host. You can do this simply by executing ssh remote_repo_host on the command line as the user running Tomcat or by running
ssh-keyscan -t rsa,ecdsa example.git.host >> ~/.ssh/known_hosts
On Linux that is usually the Tomcat user. On Windows, it is the system account. You can copy the known_hosts from a user account to C:\Windows\System32\config\systemprofile\ssh.