Git for Confluence

1. About the add-on

This Confluence add-on enables you to embed files from Git in Confluence or add them as attachments. Once added they will kept in sync with Git automatically. The advantage of syncing a file as an attachment, is that it can be transparently picked up by other add-ons, such as the xsd viewer, Markdown macro or image gallery add-ons.

If you spend your time copying images, source files or whatever file type from Git to Confluence manually every time they are updated, this add-on can help you automate that.

2. Installation

This add-on is available for download directly from the add-on manager in your Confluence installation. Alternatively, you can download the add-on from the Atlassian Marketplace directly and install the add-on manually. You can find more information about installing add-ons in the Confluence documentation.

3. How to use the add-on

3.1. Administration

Git servers and repositories are managed from the Confluence adminstration area. Administrative access to the git add-on requires the Confluence Administrator permission. Go to Confluence Admin > Git Plugin, alternatively type Git Add-on in the search area.

  1. Choose the cog icon Cog icon at the top right of the screen, then choose Confluence Admin.

  2. Choose Git Add-on in the menu under ADMINISTRATION

The server configuration page

3.1.1. Adding a server

  1. Choose New Server

  2. Enter the server’s details: Name, Connection Protocol, Host and Port.

  3. Choose the Authentication Method

  4. Depending on the Authentication Method, enter further details

3.1.2. Adding a repository

  1. Click the Repository’s name, this takes you to the repository overview for this server

  2. Choose New Repository

  3. Enter the details: Name, URL

The repository configuration page

3.1.3. Managing access rights

  1. Go to the access rights management of a repository by clicking on the user icon of a repository.

  2. This will take you to the access rights page, configure the groups that should gain access.

  3. If you don’t configure any group the repository will be accessible by all Confluence users.

3.1.4. Sync frequency

The sync is performed by a Confluence scheduled job. If you want to change the sync frequency, you can edit the configuration for that job.

  1. Go the Confluence administration area

  2. Go to Scheduled Jobs

  3. Go to the job Synchronize Git repositories

  4. Choose Edit

  5. Change the cron expression, there is documentation link available if you need explanation for the cron syntax.

Note that this changes the sync frequency for all repositories. There is currently no way to change the frequency per repository.

3.1.5. Notes

  • When using private key authentication the path to the key file is on the server, there is currently no option to upload keys to the server.

  • The options 'private key' also shows for the http/https protocol, this will be fixed in a future release

  • Repositories are cloned entirely, this may take a while!

  • Attached and viewed files are the latest versions from MASTER.

3.2. View git file macro

Edit the Confluence page and start typing '{view' and select View Git file in the drop down menu. Alternatively use the macro browser to insert the View Git file macro.

insert macro.png

See the Confluence documentation for help on inserting macros and editing macro parameters.

3.3. Add attachment from Git

  1. Go to the Confluence page you want to add an attachment to.
    Adding a Git attachment to a Confluence page

  2. Go to the Tools menu, then choose Add Git Attachment

  3. Choose a repository and enter the file path, the file path is relative to your repository root.
    Choosing a path from a repository

  4. On clicking Add attachment the attachment will be attached to the page.