Git Integration for Jira Cloud Documentation

Contact support
GitKraken Status  

GitLab.com

Using Jira Server or Data Center? See the corresponding article.

 

Integrate GitLab.com with Jira Cloud

GitLab introduced personal access tokens (PAT) since version 8.8 and now (v10+) prefers this type of authentication for accessing the git repositories.  Service users are strongly advised to switch from using username/password to using Personal Access Tokens (PAT) for GitLab.com.

Support for Gitlab API v3 is deprecated. We recommend to use GitLab API v4 when adding new integrations for increased security.

Quickly learn how to connect GitLab.com git repositories via Git Integration for Jira Cloud app.

What’s on this page:

 


 

Right click here to open this video in a new browser tab for more viewing options.
(Updated video coming soon)

 

Permissions

GitLab can have users with different access level to a group or project. If the user’s connected GitLab repositories to Jira are not accessible or commits are not showing for that user — it’s related to permission issues. This can be a per user, repository or a project level restriction.

If you encounter access permission issues, you will need to ask your Git administrator to grant you the required level of access to specific projects. If you are a Git administrator, you will need to setup a GitLab user with the minimum required permissions to view GitLab projects from Jira.

Take the following cases for example:

  • The personal access token (PAT) that the GitLab user provided doesn’t have the correct permissions within GitLab to view source code for specific repositories.

  • The GitLab user doesn’t have access privileges to a GitLab repository or is not a member of a group that has access to specific repositories.

We recommend creating a specific GitLab user for the integration. This way, the GitLab user can have specific permissions to do the given tasks.

gitlab user permissions or repository permissions

For minimum access (read-only) permissions:

  1. Set the user account profile’s PAT scope to read_repository.

  2. The GitLab user is set to only read a specific repository. Set to Reporter role.

This level of access allows the user to view commits for the specific repository.

For users who will be tasked with creating branches and merge requests:

  1. Set the user account profile’s PAT scope to api.

  2. The GitLab user should be set to read/write access for the specific repository. Set to Developer role.

This level of access allows the user to create/delete branches and create merge requests.

For more information, see GitLab Permissions ».

Creating a personal access token

If two-factor authentication is enabled for your GitLab account, you will need to create a personal access token (PAT) to access your git repositories. Enable two-factor authentication in your GitLab.com account for increased security.

While instructions from GitHub works just fine, follow this article for a quick step-by-step guide to get you started.

 

Using Git service integration

This process requires an existing GitLab.com account. Multiple git repositories in a GitLab.com account will be connected via Git Integration for Jira Cloud app.

While instructions from GitLab works just fine, here are some specific instructions to get you up and running.

We recommend using the Git service integration panel1 to connect multiple repositories from your GitLab.com account.

  1. On your Jira Cloud dashboard menu, go to Apps ➜ Git Integration: Manage integrations.


  2. On the Manage integrations page, click Add integration.


  3. For the following screen, click GitLab.com to start integration with this git service.


  4. On the following screen, click on the Git service integration panel for your integration type.


  5. For this guide, click on the GitLab Personal Access Token to select it.

    • We recommend the PAT integration for this git service. This uses personal access tokens to setup GitLab.com integrations. Users will have to configure their own PAT from GitLab.com to use for this setup.

    • For admins/owners, repository managers, collaborators or users that have enabled 2FA, enter the PAT on the Personal Access Token field.

    • For GitLab webhook indexing integration, see this article instead.

    • Configuring the Advanced settings is optional. However, admins/power users may set how the project listing is displayed. These settings are used with integration to retrieve the list of tracked repositories. Set a filter that will only load some cloned repositories which can be viewed in the Manage repositories page.


      • Custom API Path  –  this is a relative path that starts with “/”. The maximum allowed length is 2000 characters or less. The integration will use the relative REST API path to retrieve the list of tracked repositories.

        For more information on GitLab custom API paths, see GitLab API.

        For more examples, see article Jira Cloud: Working with Custom API Path.

        GitLab version API support:
        -------------------------------------------
        Gitlab v9.5 and above -- only API v4.            

        • The GitLab.com API can see all the public projects. For GitLab.com, we recommend using JMESPath over the Custom API path when possible.

      • JMESPath filter  –  JMESPath is a query language for JSON used to filter API results and to limit which repositories are integrated. The maximum allowed length is 2000 characters or less.

        Read about JMESPath expressions on their website. For help with writing expressions, please contact support.

        To learn more examples, see article Jira Cloud: Working with JMESPath Filters.

    • While Custom API Path and JMESPath filter are mutually exclusive, you can use one, the other, both or neither.

  6. Click Connect and select repositories to proceed to the next step.

  7. On the following screen, the Git Integration for Jira app will read all available repositories from your GitLab account.


    • Repositories of the logged-in GitLab user can be automatically connected to Jira Cloud. Repositories that are added or removed from GitLab will be likewise connected or disconnected from Jira Cloud.

    • Use the search options to filter displayed repositories for the current screen.

    • Connect all repositories and organizations or select specific repositories to connect for this integration.

  8. Click Connect repositories to complete this setup.

The GitLab.com git repositories are now connected to Jira Cloud.

There will be a slight delay in adding 2FA-enabled repositories compared to others. These will show in the git configuration list eventually.

Administrators
If you need to require users PAT for creating branches or merge requests, turn on this setting via the selected integration in Manage integrations page ➜ Actions ➜ Edit integration** ➜ Feature settings.

 

Single git repository integration

This process requires an existing GitLab git repository. Look for the the GitLab repository clone URL on the repository project page. Choose between SSH or HTTPS.

Use this information to connect the GitLab git repository to your Jira Cloud via Git Integration for Jira app:

Single git repository integration (HTTPS)

Single git repository integration (SSH)

There will be a slight delay in adding 2FA-enabled repositories compared to others. These will show in the git configuration list eventually.

In order to access a Git repository over HTTP, use the username as the username and the PAT for the password.

 

Setting up GitLab web links

The Git Integration for Jira app automatically configures web linking for GitLab git repositories.

For single repository connections, web link setup is optional. However, git links will become available in Git Commits tab when configured.

For more information on this feature, see Documentation: Web linking.

 

Viewing git commits in Jira Cloud

  1. Perform a git commit by adding the Jira issue key in the commit message. This action will associate the commit to the mentioned Jira issue.

  2. Open the Jira issue on your Jira instance.

  3. Scroll down to the Activity panel then click the Git Commits tab.

  4. Click View full commit to view the code diff.

For more information about this feature, see Documentation: Linking git commits to Jira issues.

 

Working with branches and merge requests with GitLab

This process requires a GitLab git repository and a PAT with api scope.

For GitLab Group, the user must have the Write permissions and the api PAT scope.

Default branch

Most git integrations allow changing of the default branch of the repository/project other than “master”. This change is reflected in the Repository Settings of the Git Integration for Jira app on the next reindex. Full feature integrations support this function where Git Integration for Jira app gets the default branch from almost all integrations and apply this setting at repository level.

Main branch for repositories within an integration can only be changed on the git server.

Creating branches

On your Jira Cloud instance, open a Jira issue. On the Jira Git integration development panel, click Open Git integration then click Create branch. The following dialog is displayed.


Pointers:

  1. Select a Repository from the list.

    • The git host service logo is displayed for all the repositories in the dropdown list to easily identify which git service they belong.

    • If there are several repositories with the same name, the listed GitLab repositories will have their names attached with a GitLab owner name. For example, johnsmith/second-webhook-test-repo.

    • Use the search box in the dropdown list to filter displayed repositories.

    • OPTIONAL  Designate the repository to be the default selected repository for current Jira project. To configure default repositories for more than one Jira project – use the User settings page.

  2. Choose a Source branch. OPTIONAL  Designate the branch to be the default selected branch for the currently selected repository. To configure default branches for more than one connected repository – use the User settings page.

  3. Enter a Branch name or leave it as is (recommended).

  4. Click Create branch to complete this process.

For more detailed information on this feature, see Create branch.

The newly-created branch is now listed in the developer panel under Branches. Perform a commit to the newly-created branch to be ready for merge.

Creating merge requests

The merge request feature works the same as merge request. On your Jira Cloud, open the Jira issue where your previously created a branch. On the Jira Git integration development panel, click Open Git integration then click Create merge request. The following dialog is displayed.


Pointers:

  1. Select a Repository from the list.

    • The git host service logo is displayed for all the repositories in the dropdown list to easily identify which git service they belong.

    • If there are several repositories with the same name, the listed GitLab repositories will have their names attached with a GitLab group name. For example, BigBrassBand/second-webhook-test-repo.

    • Use the search box in the dropdown list to filter displayed repositories.

    • OPTIONAL  Designate the repository to be the default selected repository for current Jira project. To configure default repositories for more than one Jira project – use the User settings page.

  2. Choose the newly-created branch as the Source branch.

    OPTIONAL  Designate the branch to be the default selected branch for the currently selected repository. To configure default branches for more than one connected repository – use the User settings page.

  3. Set master as the Target branch.

  4. Enter a descriptive Title or leave it as is (recommended).

  5. Click Create pull request to complete this process. Follow the link to the PR to setup for review and approval.

Merge requests are still indexed based on branch name even if the MR title does not have the Jira issue key – as long as the branch name contains the Jira issue key.

Preview allows you to see the comparison view of the current changes in the selected Source branch vs Target branch (usually master).

For more detailed information on this feature, see Create pull/merge request.

The merge request is listed on the developer panel of the Jira issue page.

The merge request is also ready for approval by the reviewers in your GitLab web portal.

 

More Integration Guides

GitHub.com (Git Integration for Jira Cloud)

GitHub Enterprise Server (Git Integration for Jira Cloud)

GitLab.com (this page)

GitLab CE/EE (Git Integration for Jira Cloud)

Azure DevOps | Visual Studio Team Services (VSTS) (Git Integration for Jira Cloud)

Azure DevOps Server | Team Foundation Services (TFS) (Git Integration for Jira Cloud)

AWS CodeCommit (Git Integration for Jira Cloud)

Gerrit (Git Integration for Jira Cloud)

Bitbucket Cloud (Git Integration for Jira Cloud)

Introduction to Git integration (Git Integration for Jira Cloud)

 

 

1 Logo owned by GitLab Inc used under license.

  All product names, logos, and brands are property of their respective owners.


Have feedback about this article? Did we miss something? Let us know!
On this page