Git Integration for Jira Self-Managed (Data Center/Server) Documentation

Update Nested Repository API

Updates the existing nested repository using the REST API.

Only Jira admins can perform the Update Nested Repository API call.

url

{JiraBaseURL}/rest/gitplugin/1.0/repository

method

PUT

Parameters

The Request body is a JSON structure similar to the Update Existing Repository API plus the id parameter:

In the table below, fields marked with a Read-only flag cannot be changed. Any defined value is ignored.

Field Description
id Integer. Required.

This is the ID of the existing nested repository. For example, id : 3,.

The Update Repository API will look for the repository with id : 3 and replaces repository properties according to the declared JSON request body structure file.

displayName String. Optional.

This is the name that will appear in the Git Integration for Jira app repositories list.

mainBranch String. Read-only.

The specified branch will intend to organize the Git Commit tab. A commit will not be shown in other branches if it is a part of the main branch. By default, “master” will be used if a main branch is not specified.

disabled Boolean. Optional.

Set the repository status to updated (enabled) or disabled. If left blank, the default setting for this field is false.

UPDATE
Use the separate API for enabling/disabling a repository which is better and more reliable than using this field here. For detailed instructions on the usage, see Enable/disable existing repository API page.

enableFetches Boolean. Read-only.

Set to true to enable fetches on git repositories hosted on remote servers.

Set to false to enable fetches on git repositories hosted on the same server as Jira.

sendCommitEmails Boolean. Optional.

Enables or disables commit notification emails for this repository.

maxMinsToCommitEmail Integer. Optional.

Set the desired value in minutes, as to when commit notifications will be sent. Commit notifications will be e-mailed if the age of the commit is less than or equal to this value.

global Boolean. Optional.

If set to true, the projectMappingIds parameter is ignored. Otherwise the projectMappingIds parameter value(s) are applied.

projectMappingIds Long [ ]. Array. Optional.

These are numeric projects IDs associated with the repository. When you create a new repository and set the field gitViewerEnabled to true, at least one project must be associated with it.

Example: "projectMappingIds": [10000]

hosted Internal field. Read-only.

This field will show whether the repository is hosted on Jira or not.

revisionIndexing Boolean. Optional.

This setting turn on/off indexing of revisions, for instance, git commits. This setting also turns on the memory cache which is used when list of commits are displayed.

Set to true if revision indexing will index and link to any mentioned issue keys in the revision history or not (false).

gitViewerEnabled Boolean. Optional.

Enables or disables the Repository Browser feature for this repository.  The default setting for this setting is enabled. Users must have the View Development Tools project permission in order to use this feature.  Consult your Jira System Administrator on permissions.

For more information, see section, Repository Browser.

username String. Read-only.

Set as username for the git host. Leave blank if 2FA is enabled. Otherwise, fill this in if password has changed.

encryptedPassword String. Read-only.

Set as password for the git host. Leave blank if 2FA is enabled. Otherwise, fill this in if password has changed.

encryptedPat String. Read-only.

This field accepts personal access token from supported git hosts. Fill this in if 2FA is enabled for the git host and if the PAT has changed.

requireUserPat String. Read-only. Default is false.

Setting this field to true will require users to provide their personal access tokens (PAT) specific for branch and pull/merge request operations.

disableSslVerification Boolean. Read-only.

The SSL Verify setting is set to false by default. If set to true, the Git Integration for Jira app will ignore verification of SSL certificates when connecting to a git server.

This setting can also be accessed via:

VERSION 4.8.x Manage repositories ➜ Actions ➜ Edit repository settings.

VERSION 5+ Manage integrations ➜ Actions ➜ Edit repository.

smartCommitsEnabled Boolean. Optional.

This setting is enabled by default. Enables/disables smart commits processing for this repository or tracked folder. The default setting for this field is true.

webLinkType String. Optional.

Set web link type equivalent to the connected git host. Set web linking formats by referring to Git Integration for Jira: Web linking.

viewFormat String. Optional.

This URL is unused and not being configured for the newly added integration types.

changesetFormat String. Optional.

This is the URL used to display revision.

Use the following variable: ${rev}  –  git revision

fileAddedFormat,
fileModifiedFormat,
fileDeletedFormat
String. Optional.

This is the URL to display content of added, modified or deleted files. Use the following variables:

  • ${num}  –  number of change (0, 1, …)
  • ${rev}  –  git revision
  • ${path}  –  path of the file being changed
  • ${parent}  –  parent git revision
  • ${blob}  –  ID of blob object
  • ${parent_blob}  –  ID of parent blob object
  • $convert(${branch},"subStr","newSubStr")  –  this inline function returns branch name with subStr replaced by a newSubStr. The ${branch} supports the character requirements on some hosting services.
mergeRequestFormat String. Optional.

This is the URL to display content of pull/merge requests on the git server. Use the following variables:

${mergereqId} — ID of the pull/merge request

branchLinkFormat String. Optional.

This is the URL to display a branch on the git server. Use the following variables:

${branch} – Name of the branch

commitsValidationRequired Boolean. Read-only.

This setting is only applicable to self-hosted git servers. For example, you are hosting your git repositories in your own server such as GitLab CE/EE or GitHub Enterprise. If a developer tries to push a commit without the issue key in its message, the push is rejected by the Git Integration for Jira app.

If this setting is enabled, the commit messages are validated according to the following rules:

  • The commit message contains at least one issue key.
  • The issue key is valid.
  • The issue key exists.
tagsFilter String. Optional.

Displays all tags for the specific issue, if left blank. Otherwise, set tags matching pattern to display tags on issue pages that match the specified regular expression pattern.

For more information, see example in Show tags.

sourcesDiffViewEnabled Boolean. Optional.

When enabled, this setting allows Jira users with the View Development Tools and correct Jira/Git Integration for Jira app permissions to view the commit and file diffs inside Jira.

trustFolderStat Boolean. Optional.

When the trustFolderStat setting is set to false, the .git/objects/pack folder will be always scanned to check for new pack files. If set to true, the last-modified attribute of the folder will be used to check the folder for modifications.

The default setting for Jira Data Center is false.

If your repository is stored on a network share, it is highly recommended to set this setting to false.

refSpecHeads Boolean. Read-only.

This is a reference to refs/heads/* used for fetching. The default value for this field is true.

refSpecTags Boolean. Read-only.

This is a reference to refs/tags/* used for fetching. The default value for this field is true.

refSpecNotes Boolean. Optional.

This is a reference to refs/notes/* used for fetching. The default value for this field is true.

Git notes are not shown…

  • when refs/notes are disabled on connecting a repository;
  • when a new note comes when refs/notes is disabled.
refSpecChanges Boolean. Optional.

This is a reference to refs/changes/* used for fetching. The default value for this field is false.

refSpecCustom String. Optional.
This is a user-defined list of references used for fetching. It is a comma-separated list with the format: +refs/refname1/*:refs/refname1/*, refs/refname2/*:refs/refname2/*, …
prHideFilter String. Optional.

Displays all pull requests for the specific issue, if left blank. Otherwise, set pull requests matching pattern to hide pull requests on issue pages that match the specified regular expression pattern.

state Integer. Read-only. This is the indexing state of the nested repository: QUEUED, UPDATED, SCANNING, ERROR.

 

The login credentials are not inherited for nested repositories to interact with external APIs and .git is based on the integration’s credentials.

 

Response

Updates the newly changed parameters to the selected repository.

Example:
http://jira.yourorg.com/rest/gitplugin/1.0/repository.json

Request body (JSON) example:

{
  "id": 3,
  "maxMinsToCommitEmail": 1441,
  "gitViewerEnabled": false
}   

Response:

{
  "id": 3,
  "displayName": "acmecorp",
  "origin": "https://gitlab.com/wileycoyote/acmecorp.git",
  "mainBranch": "master",
  "root": "/jira/home/data/git-plugin/3_acmecorp",
  "realRoot": "3_acmecorp",
  "absoluteRoot": false,
  "disabled": false,
  "enableFetches": true,
  "sendCommitEmails": true,
  "maxMinsToCommitEmail": 1441,
  "global": true,
  "hosted": false,
  "initDate": 1513662080381,
  "lastIndexedDate": 1586232584347,
  "revisionIndexing": true,
  "gitViewerEnabled": false,
  "disableSslVerification": false,
  "smartCommitsEnabled": true,
  "webLinkType": "gitlab",
  "viewFormat": "",
  "changesetFormat": "https://gitlab.com/wileycoyote/acmecorp/commit/${rev}",
  "fileAddedFormat": "https://gitlab.com/wileycoyote/acmecorp/commit/${rev}#diff-${num}",
  "fileModifiedFormat": "https://gitlab.com/wileycoyote/acmecorp/commit/${rev}#diff-${num}",
  "fileDeletedFormat": "https://gitlab.com/wileycoyote/acmecorp/commit/${rev}#diff-${num}",
  "mergeRequestFormat": "https://gitlab.com/wileycoyote/acmecorp/merge_requests/${mergereqId}",
  "branchLinkFormat": "https://gitlab.com/wileycoyote/acmecorp/tree/${branch}",  
  "commitsValidationRequired": true,
  "projectMappingIds":[],
  "trackedFolderId": 1,
  "showAllTags": true,
  "sourcesDiffViewEnabled": true,
  "refSpecNotes": true,
  "refSpecChanges": false,
  "trustFolderStat": false
}

 

Repository REST APIs

Retrieve Repository List

Add New Repository

Enable/disable Existing Repository

Update Existing Repository

Update Existing Nested Repository (this page)

Delete Existing Repository

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