How to install and configure the Jira Git plugin with Gitlab


Before I continue let me tell you that the Jira Git Plugin that I will talk about is not supported by Atlassian but Marcello Teodori added support for version 5 of Jira.  If you want a supported plugin you can see the Git Version Control Viewer supported by BigBrassBand, I will not talk about it because I didn’t try it.


Let’s start

First of all, you should know that it can be done with two different environments:

  1. Having Jira in one server and Gitlab with git in other server
  2. Have both in the same server

Step 1 – Install the Jira Git Plugin

  1. Open Jira
  2. Go to: Administration > Plugins > Manage Plugins
  3. Click on “Upload Plugin”
  4. Add the url for the plugin:
  5. Click on upload

By now you should have Jira Git Plugin installed.

Step 2 – Configure the Git repositories

For every single repository you will need to clone it and add the configuration for it inside Jira. Since you can have two different environments let’s do it for both.

1. Jira and Gitlab on the same server

  1. git clone (with or without –bare) the source tree that you need (run as the same user that Jira runs as). Ex.: git clone –bare git@localhost:test /home/jira/repositories/test
  2. Go to: Open Jira > Administration section > Plugins > Git Repositories > click on Add
  3. Display Name: Your repository name. Ex.: Test
  4. Repository root: Directory where you cloned your repository. Ex.: /home/jira/repositories/test
  5. Repository Origin: The url you used to clone the repository. Ex.: git@localhost:teste.git
  6. Web Linking: For the current version of Jira Git Plugin does not exist the default Gitlab formats but you can add them manually:
    1. View format: http://<gitlab server>/<repository>/master/tree
    2. Changeset format: http://<gitlab server>/<repository>/commits/${rev}
    3. File added, modified and deleted are the same formar: http://<gitlab server>/<repository>/commits/${rev}#${path}

2. Jira and Gitlab on different servers

You have two choices here:

  1. Add the private ssh key of gitlab user to the user that Jira runs
  2. Create a new user on Gitlab for Jira and generate the ssh key for that user on the Jira server.
First one:
  1. Copy the ssh key of the gitlab user (on the Gitlab server) to the user that Jira runs as (on Jira server)
  2. Now you can follow the Jira and Gitlab on the same server steps

Second one:

  1. Generate the ssh key for the user that Jira runs as (on Jira server)
  2. Create the Jira user inside Gitlab
  3. Add the public ssh key for the user that you create on step 1
  4. Add the user to the repositories you want (at least with the reporter role)
  5. Now you can follow the Jira and Gitlab on the same server steps

edited:  added the Jira version supported by this plugin


19 thoughts on “How to install and configure the Jira Git plugin with Gitlab

  1. Got this when trying to configure the plugin:

    Error creating bean with name
    ‘com.xiplink.jira.git.action.ViewGitRepositoriesAction’: Unsatisfied
    dependency expressed through constructor argument with index 0 of type
    [com.xiplink.jira.git.MultipleGitRepositoryManager]: : No unique bean of
    type [com.xiplink.jira.git.MultipleGitRepositoryManager] is defined:
    Unsatisfied dependency of type [interface
    com.xiplink.jira.git.MultipleGitRepositoryManager]: expected at least 1
    matching bean; nested exception is
    org.springframework.beans.factory.NoSuchBeanDefinitionException: No
    unique bean of type [com.xiplink.jira.git.MultipleGitRepositoryManager]
    is defined: Unsatisfied dependency of type [interface
    com.xiplink.jira.git.MultipleGitRepositoryManager]: expected at least 1
    matching bean

    Could not find what you were looking for. Maybe you should raise an issue.

      • Yep… happened to me too. This occurs after installing the plugin and error shows in the page when navigating in Jira to configure the plugin. Conjecture: Incompatible Jira libs for the plugin? Jira version v5.1.2#773-sha1:b805b97

          • For jira 4.2 I don’t know, since I never used it. But for what I know the plugins systems are quite different from jira version 4.x to 5.x. Have you tried installed it on version 4.2?

            About the problem of Jira v5.1 I was able to solve it, I think my repository of the plugin on github reflects the change but I need to confirm first (github is down due to a large DDoS atack)

          • sounds like it may not work with 4.2 after we installed it. Any ideas? Are there any other gitlab jira integration options?

  2. Thanks for the guide, great work. I’ve followed this, and it seems to have worked, but is there a hook required in Gitlab for it to talk to JIRA? Or is there a specific syntax I can use to test this out?

    • No, you only need to clone the repository in your JIRA server and then add the correct paths on the repository configuration in JIRA.

      Also this is only valid for Gitlab 3.x since after this version Gitlab removed gitorious.

      • Thanks for the reply. We’re running Gitlab 5.x now, I misread and thought it was Gitlab 3.x or above. Would explain it!

        • No problem. You can still use it with Gitlab 5 you need to do a trick! Basically you need to create a fake user with permissions for clone the repository to be able to do it in the JIRA server. This users needs to be added to all projects on Github you want to add into JIRA.

  3. I can’t find any documentation ont the supported syntax – is it possible to transition JIRA issues from a git commit?

  4. Hi Daniel. Thanks for the article. I got a question though: I’ve installed and all seemed fine, however on my issue I did not see any commit I’ve made. Using the command line, my commit was: git commit -am ‘MYPROJECT-21: My comment’. What have I done wrong? Secondly, what are the features this particular plugin brings? Thanks again!

    • Hi Wagner. To be honest I don’t work with Jira anymore more (about 7 months now) but I will try to help you.

      Have you configured the repository in Jira? You need to configure it for every repository you want to add to Jira.

      To reference it should be the same way you do in a normal comment [ISSUE-NUMBER] or #ISSUE-NUMBER (I don’t remember now what is the correct way to do it) and it should work fine.

      The features is mainly show the code in Jira related to the issue and see some diff stats and be able to open it in the browser (if you use some tool that is supported like github, gitlab, etc).

      Hope this helps.

      • Hi Daniel. Thanks for you your quick reply. Yes, the repositories are set in Jira (followed the steps below) and all seems to be fine. I think the problem is only how I commit. The commit I’ve done , I’ve added the issue id within the message of the commit which I believe is why the commit wasn’t picked up by Jira. I’ll try committing differently to see if I get any luck with it. I’ll post the result here in case it might help someone else as well. Thanks again for your help and your article.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>