url
stringlengths
24
122
repo_url
stringlengths
60
156
date_extracted
stringdate
2025-08-13 00:00:00
2025-08-13 00:00:00
root
stringlengths
3
85
breadcrumbs
listlengths
1
6
filename
stringlengths
6
60
stage
stringclasses
33 values
group
stringclasses
81 values
info
stringclasses
22 values
title
stringlengths
3
110
description
stringlengths
11
359
clean_text
stringlengths
47
3.32M
rich_text
stringlengths
321
3.32M
https://docs.gitlab.com/user/project/wiki
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/_index.md
2025-08-13
doc/user/project/wiki
[ "doc", "user", "project", "wiki" ]
_index.md
Plan
Knowledge
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Wiki
Documentation, external wikis, wiki events, and history.
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} Wiki provides project and group documentation in a familiar format. Wiki pages: - Generate technical documentation, guides, and knowledge bases in Markdown, RDoc, AsciiDoc, or Org formats. - Create collaborative documents that integrate directly with GitLab projects and groups. - Store documentation in Git repositories for version control and collaboration. - Support custom navigation and organization through sidebar customization. - Export content as PDF files for offline access and sharing. - Maintain your content separately from your codebase while keeping them in the same project. Each wiki is a separate Git repository. You can create and edit wiki pages through the GitLab web interface or [locally using Git](#create-or-edit-wiki-pages-locally). Wiki pages written in Markdown support all [Markdown features](../../markdown.md) and provide [wiki-specific behavior](markdown.md) for links. Wiki pages display a [sidebar](#sidebar), which you can customize. ## View a project wiki To access a project wiki: 1. On the left sidebar, select **Search or go to** and find your project. 1. To display the wiki, either: - On the left sidebar, select **Plan > Wiki**. - On any page in the project, use the <kbd>g</kbd> + <kbd>w</kbd> [wiki keyboard shortcut](../../shortcuts.md). If **Plan > Wiki** is not listed in the left sidebar of your project, a project administrator has [disabled it](#enable-or-disable-a-project-wiki). ## Configure a default branch for your wiki Your wiki repository inherits the [default branch name](../repository/branches/default.md) from your instance or group. If no custom branch name is configured, GitLab uses `main`. To rename your wiki's default branch,see [Update the default branch name in your repository](../repository/branches/default.md#update-the-default-branch-name-in-your-repository). ## Create the wiki home page {{< history >}} - Separation of page title and path [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/30758) in GitLab 17.2 [with flags](../../../administration/feature_flags/_index.md) named `wiki_front_matter` and `wiki_front_matter_title`. Enabled by default. - Feature flags `wiki_front_matter` and `wiki_front_matter_title` removed in GitLab 17.3. {{< /history >}} When a wiki is created, it is empty. On your first visit, you can create the home page users see when viewing the wiki. This page requires a specific path to be used as your wiki's home page. To create it: 1. On the left sidebar, select **Search or go to** and find your project or group. 1. Select **Plan > Wiki**. 1. Select **Create your first page**. 1. Optional. Change the **Title** of the home page. 1. GitLab requires this first page to have path `home`. The page on this path serves as the front page for your wiki. 1. Select a **Format** for styling your text. 1. Add a welcome message for your home page in the **Content** section. You can always edit it later. 1. Add a **Commit message**. Git requires a commit message, so GitLab creates one if you don't enter one yourself. 1. Select **Create page**. ## Create a new wiki page {{< history >}} - Separation of page title and path [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/30758) in GitLab 17.2 [with flags](../../../administration/feature_flags/_index.md) named `wiki_front_matter` and `wiki_front_matter_title`. Enabled by default. - Feature flags `wiki_front_matter` and `wiki_front_matter_title` removed in GitLab 17.3. {{< /history >}} Prerequisites: - You must have at least the Developer role. 1. On the left sidebar, select **Search or go to** and find your project or group. 1. Select **Plan > Wiki**. 1. Select **Wiki actions** ({{< icon name="ellipsis_v" >}}), then **New page** on this page, or any other wiki page. 1. Select a content format. 1. Add a **Title** for your new page. 1. Optional. Uncheck **Generate page path from title** and change the **Path** of the page. Page paths use [special characters](#special-characters-in-page-paths) for subdirectories and formatting, and have [length restrictions](#length-restrictions-for-file-and-directory-names). 1. Optional. Add content to your wiki page. 1. Optional. Attach a file, and GitLab stores it in the wiki's Git repository. 1. Add a **Commit message**. Git requires a commit message, so GitLab creates one if you don't enter one yourself. 1. Select **Create page**. ### Create or edit wiki pages locally Wikis are based on Git repositories, so you can clone them locally and edit them like you would do with every other Git repository. To clone a wiki repository locally: 1. On the left sidebar, select **Search or go to** and find your project or group. 1. Select **Plan > Wiki**. 1. Select **Wiki actions** ({{< icon name="ellipsis_v" >}}), then **Clone repository**. 1. Follow the on-screen instructions. Files you add to your wiki locally must use one of the following supported extensions, depending on the markup language you wish to use. Files with unsupported extensions don't display when pushed to GitLab: - Markdown extensions: `.mdown`, `.mkd`, `.mkdn`, `.md`, `.markdown`. - AsciiDoc extensions: `.adoc`, `.ad`, `.asciidoc`. - Other markup extensions: `.textile`, `.rdoc`, `.org`, `.creole`, `.wiki`, `.mediawiki`, `.rst`. ### Special characters in page paths {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/133521) front matter based titles in GitLab 16.7 [with flags](../../../administration/feature_flags/_index.md) named `wiki_front_matter` and `wiki_front_matter_title`. Disabled by default. - Feature flags [`wiki_front_matter`](https://gitlab.com/gitlab-org/gitlab/-/issues/435056) and [`wiki_front_matter_title`](https://gitlab.com/gitlab-org/gitlab/-/issues/428259) enabled by default in GitLab 17.2. - Feature flags `wiki_front_matter` and `wiki_front_matter_title` removed in GitLab 17.3. {{< /history >}} Wiki pages are stored as files in a Git repository, and by default, the filename of a page is also its title. Certain characters in the filename have a special meaning: - Spaces are converted into hyphens when storing a page. - Hyphens (`-`) are converted back into spaces when displaying a page. - Slashes (`/`) are used as path separators, and can't be displayed in titles. If you create a file with title containing `/` characters, GitLab creates all the subdirectories needed to build that path. For example, a title of `docs/my-page` creates a wiki page with a path `/wikis/docs/my-page`. To circumvent these limitations, you can also store the title of a wiki page in a front matter block before a page's contents. For example: ```yaml --- title: Page title --- ``` ### Length restrictions for file and directory names Many common file systems have a [limit of 255 bytes](https://en.wikipedia.org/wiki/Comparison_of_file_systems#Limits) for file and directory names. Git and GitLab both support paths exceeding those limits. However, if your file system enforces these limits, you cannot check out a local copy of a wiki that contains filenames exceeding this limit. To prevent this problem, the GitLab web interface and API enforce these limits: - 245 bytes for filenames (reserving 10 bytes for the file extension). - 255 bytes for directory names. Non-ASCII characters take up more than one byte. While you can still create files locally that exceed these limits, your teammates may not be able to check out the wiki locally afterward. ## Edit a wiki page Prerequisites: - You must have at least the Developer role. 1. On the left sidebar, select **Search or go to** and find your project or group. 1. Select **Plan > Wiki**. 1. Go to the page you want to edit, and either: - Use the <kbd>e</kbd> wiki [keyboard shortcut](../../shortcuts.md#wiki-pages). - Select **Edit**. 1. Edit the content. 1. Select **Save changes**. Unsaved changes to a wiki page are preserved in local browser storage to prevent accidental data loss. ### Create a table of contents {{< history >}} - Table of contents in the wiki sidebar [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/281570) in GitLab 17.2. {{< /history >}} Wiki pages with headings in their contents automatically display a table of contents section in the sidebar. You can also choose to optionally display a separate table of contents section on the page itself. To generate a table of contents from a wiki page's subheadings, use the `[[_TOC_]]` tag. For an example, read [Table of contents](../../markdown.md#table-of-contents). ## Delete a wiki page Prerequisites: - You must have at least the Developer role. 1. On the left sidebar, select **Search or go to** and find your project or group. 1. Select **Plan > Wiki**. 1. Go to the page you want to delete. 1. Select **Wiki actions** ({{< icon name="ellipsis_v" >}}), then **Delete page**. 1. Confirm the deletion. ## Move or rename a wiki page {{< history >}} - Redirects for moved or renamed wiki pages [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/257892) in GitLab 17.1 [with a flag](../../../administration/feature_flags/_index.md) named `wiki_redirection`. Enabled by default. - Separation of page title and path [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/30758) in GitLab 17.2 [with flags](../../../administration/feature_flags/_index.md) named `wiki_front_matter` and `wiki_front_matter_title`. Enabled by default. - Feature flags `wiki_redirection`, `wiki_front_matter` and `wiki_front_matter_title` removed in GitLab 17.3. {{< /history >}} In GitLab 17.1 and later, when you move or rename a page, a redirect is automatically set up from the old page to the new page. A list of redirects is stored in the `.gitlab/redirects.yml` file in the Wiki repository. Prerequisites: - You must have at least the Developer role. 1. On the left sidebar, select **Search or go to** and find your project or group. 1. Select **Plan > Wiki**. 1. Go to the page you want to move or rename. 1. Select **Edit**. 1. To move the page, add the new path to the **Path** field. For example, if you have a wiki page called `About` under `Company` and you want to move it to the wiki's root, change the **Path** from `About` to `/About`. 1. To rename the page, change the **Path**. 1. Select **Save changes**. ## Export a wiki page {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/414691) in GitLab 16.3 [with a flag](../../../administration/feature_flags/_index.md) named `print_wiki`. Disabled by default. - [Enabled on GitLab.com and GitLab Self-Managed](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/134251/) in GitLab 16.5. - Feature flag `print_wiki` removed in GitLab 16.6. {{< /history >}} You can export a wiki page as a PDF file: 1. On the left sidebar, select **Search or go to** and find your project or group. 1. Select **Plan > Wiki**. 1. Go to the page you want to export. 1. On the top right, select **Wiki actions** ({{< icon name="ellipsis_v" >}}), then select **Print as PDF**. A PDF of the wiki page is created. ## Creating diagrams in the wiki using Draw.io With the diagrams.net integration, you can create and embed SVG diagrams on wiki pages! The diagram editor is available in both the plain text editor and the rich text editor. On GitLab.com, this integration is enabled for all SaaS users and does not require any additional configuration. On GitLab Self-Managed, you can integrate with the free diagrams.net website or host your own diagrams.net site in offline environments. To set up the integration, you must: 1. Choose to integrate with the free diagrams.net website or configure your diagrams.net server. 1. Enable the integration. After completing the integration, the diagrams.net editor opens with the URL you provided. ## Wiki page templates {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/442228) in GitLab 16.10. {{< /history >}} You can create templates to use when creating new pages, or to apply to existing pages. Templates are wiki pages that are stored in the `templates/` directory in the wiki repository. ### Create a template Prerequisites: - You must have at least the Developer role. 1. On the left sidebar, select **Search or go to** and find your project or group. 1. Select **Plan > Wiki**. 1. Select **Wiki actions** ({{< icon name="ellipsis_v" >}}), then **Templates**. 1. Select **New Template**. 1. Enter template title, format and content, as if creating a regular wiki page. Templates of a particular format can only be applied to pages of the same format. For example, Markdown templates only apply to Markdown pages. ### Apply a template When you are [creating](#create-a-new-wiki-page) or [editing](#edit-a-wiki-page) a wiki page, you can apply a template. Prerequisites: - You must have [created](#create-a-template) at least one template already. 1. In the **Content** section, select the **Choose a template** dropdown list. 1. Select a template from the list. If the page already has some content, a warning displays indicating that the existing content will be overridden. 1. Select **Apply template**. ## View history of a wiki page The changes of a wiki page over time are recorded in the wiki's Git repository. The history page shows: - The revision of the page. - The page author. - The commit message. - The last update. - Previous revisions, by selecting a revision number in the **Page version** column. To view the changes for a wiki page: 1. On the left sidebar, select **Search or go to** and find your project or group. 1. Select **Plan > Wiki**. 1. Go to the page you want to view history for. 1. Select **Wiki actions** ({{< icon name="ellipsis_v" >}}), then **Page history**. ### View changes between page versions You can see the changes made in a version of a wiki page, similar to versioned diff file views: 1. On the left sidebar, select **Search or go to** and find your project or group. 1. Select **Plan > Wiki**. 1. Go to the wiki page you're interested in. 1. Select **Wiki actions** ({{< icon name="ellipsis_v" >}}), then **Page history** to see all page versions. 1. Select the commit message in the **Diff** column for the version you're interested in. ## Sidebar {{< history >}} - Searching by title in the sidebar [introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/156054) in GitLab 17.1. - Limit of 15 items in the sidebar [removed](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/158084) in GitLab 17.2. {{< /history >}} Wiki pages display a sidebar that contains a list of pages in the wiki, displayed as a nested tree, with sibling pages listed in alphabetical order. You can quickly find a page by its title in the wiki using the search box in the sidebar. For performance reasons, the sidebar is limited to displaying 5000 entries. To view a list of all pages, select **View All Pages** in the sidebar. ### Customize sidebar You can manually edit the contents of the sidebar navigation. Prerequisites: - You must have at least the Developer role. This process creates a wiki page named `_sidebar` which fully replaces the default sidebar navigation: 1. On the left sidebar, select **Search or go to** and find your project or group. 1. Select **Plan > Wiki**. 1. In the upper-right corner of the page, select **Add custom sidebar** ({{< icon name="settings" >}}). 1. When complete, select **Save changes**. A `_sidebar` example, formatted with Markdown: ```markdown ### Home - [Hello World](hello) - [Foo](foo) - [Bar](bar) --- - [Sidebar](_sidebar) ``` ## Enable or disable a project wiki Wikis are enabled by default in GitLab. Project [administrators](../../permissions.md) can enable or disable a project wiki by following the instructions in [Sharing and permissions](../settings/_index.md#configure-project-features-and-permissions). Administrators for GitLab Self-Managed can [configure additional wiki settings](../../../administration/wikis/_index.md). You can disable group wikis from the [group settings](group.md#configure-group-wiki-visibility) ## Link an external wiki To add a link to an external wiki from a project's left sidebar: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Integrations**. 1. Select **External wiki**. 1. Add the URL to your external wiki. 1. Optional. Select **Test settings**. 1. Select **Save changes**. You can now see the **External wiki** option from your project's left sidebar. When you enable this integration, the link to the external wiki doesn't replace the link to the internal wiki. To hide the internal wiki from the sidebar, [disable the project's wiki](#disable-the-projects-wiki). To hide the link to an external wiki: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Integrations**. 1. Select **External wiki**. 1. Under **Enable integration**, clear the **Active** checkbox. 1. Select **Save changes**. ## Disable the project's wiki To disable a project's internal wiki: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > General**. 1. Expand **Visibility, project features, permissions**. 1. Scroll down to find and turn off the **Wiki** toggle (in gray). 1. Select **Save changes**. The internal wiki is now disabled, and users and project members: - Cannot find the link to the wiki from the project's sidebar. - Cannot add, delete, or edit wiki pages. - Cannot view any wiki page. Previously added wiki pages are preserved in case you want to re-enable the wiki. To re-enable it, repeat the process to disable the wiki but toggle it on (in blue). ## Rich text editor {{< history >}} - [Renamed](https://gitlab.com/gitlab-org/gitlab/-/issues/398152) from content editor to rich text editor in GitLab 16.2. {{< /history >}} GitLab provides a rich text editing experience for GitLab Flavored Markdown in wikis. Support includes: - Formatting text, including using bold, italics, block quotes, headings, and inline code. - Formatting ordered lists, unordered lists, and checklists. - Creating and editing table structure. - Inserting and formatting code blocks with syntax highlighting. - Previewing Mermaid, PlantUML, and Kroki diagrams. ### Use the rich text editor 1. [Create](#create-a-new-wiki-page) a new wiki page, or [edit](#edit-a-wiki-page) an existing one. 1. Select **Markdown** as your format. 1. Under **Content**, in the lower-left corner, select **Switch to rich text editing**. 1. Customize your page's content using the various formatting options available in the rich text editor. 1. Select **Create page** for a new page, or **Save changes** for an existing page. To switch back to plain text, select **Switch to plain text editing**. See also: - [Rich text editor](../../rich_text_editor.md) ### GitLab Flavored Markdown support Supporting all GitLab Flavored Markdown content types in the rich text editor is a work in progress. For the status of the ongoing development for CommonMark and GitLab Flavored Markdown support, read: - [Basic Markdown formatting extensions](https://gitlab.com/groups/gitlab-org/-/epics/5404) epic. - [GitLab Flavored Markdown extensions](https://gitlab.com/groups/gitlab-org/-/epics/5438) epic. ## Track wiki events GitLab tracks wiki creation, deletion, and update events. These events are displayed on the following pages: - [User profile](../../profile/_index.md#access-your-user-profile). - Activity pages, depending on the type of wiki: - [Group activity](../../group/manage.md#view-group-activity). - [Project activity](../working_with_projects.md#view-project-activity). Commits to wikis are not counted in [repository analytics](../../analytics/repository_analytics.md). ## Troubleshooting ### Page slug rendering with Apache reverse proxy Page slugs are encoded using the [`ERB::Util.url_encode`](https://www.rubydoc.info/stdlib/erb/ERB%2FUtil.url_encode) method. If you use an Apache reverse proxy, you can add a `nocanon` argument to the `ProxyPass` line of your Apache configuration to ensure your page slugs render correctly. ### Recreate a project wiki with the Rails console {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab Self-Managed, GitLab Dedicated {{< /details >}} {{< alert type="warning" >}} This operation deletes all data in the wiki. {{< /alert >}} {{< alert type="warning" >}} Any command that changes data directly could be damaging if not run correctly, or under the right conditions. We highly recommend running them in a test environment with a backup of the instance ready to be restored, just in case. {{< /alert >}} To clear all data from a project wiki and recreate it in a blank state: 1. [Start a Rails console session](../../../administration/operations/rails_console.md#starting-a-rails-console-session). 1. Run these commands: ```ruby # Enter your project's path p = Project.find_by_full_path('<username-or-group>/<project-name>') # This command deletes the wiki project from the filesystem. p.wiki.repository.remove # Refresh the wiki repository state. p.wiki.repository.expire_exists_cache ``` All data from the wiki has been cleared, and the wiki is ready for use. ## Related topics - [Wiki settings for administrators](../../../administration/wikis/_index.md) - [Project wikis API](../../../api/wikis.md) - [Group wikis API](../../../api/group_wikis.md) - [Group repository storage moves API](../../../api/group_repository_storage_moves.md) - [Wiki keyboard shortcuts](../../shortcuts.md#wiki-pages) - [GitLab Flavored Markdown](../../markdown.md) - [Asciidoc](../../asciidoc.md)
--- stage: Plan group: Knowledge info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments title: Wiki description: Documentation, external wikis, wiki events, and history. breadcrumbs: - doc - user - project - wiki --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} Wiki provides project and group documentation in a familiar format. Wiki pages: - Generate technical documentation, guides, and knowledge bases in Markdown, RDoc, AsciiDoc, or Org formats. - Create collaborative documents that integrate directly with GitLab projects and groups. - Store documentation in Git repositories for version control and collaboration. - Support custom navigation and organization through sidebar customization. - Export content as PDF files for offline access and sharing. - Maintain your content separately from your codebase while keeping them in the same project. Each wiki is a separate Git repository. You can create and edit wiki pages through the GitLab web interface or [locally using Git](#create-or-edit-wiki-pages-locally). Wiki pages written in Markdown support all [Markdown features](../../markdown.md) and provide [wiki-specific behavior](markdown.md) for links. Wiki pages display a [sidebar](#sidebar), which you can customize. ## View a project wiki To access a project wiki: 1. On the left sidebar, select **Search or go to** and find your project. 1. To display the wiki, either: - On the left sidebar, select **Plan > Wiki**. - On any page in the project, use the <kbd>g</kbd> + <kbd>w</kbd> [wiki keyboard shortcut](../../shortcuts.md). If **Plan > Wiki** is not listed in the left sidebar of your project, a project administrator has [disabled it](#enable-or-disable-a-project-wiki). ## Configure a default branch for your wiki Your wiki repository inherits the [default branch name](../repository/branches/default.md) from your instance or group. If no custom branch name is configured, GitLab uses `main`. To rename your wiki's default branch,see [Update the default branch name in your repository](../repository/branches/default.md#update-the-default-branch-name-in-your-repository). ## Create the wiki home page {{< history >}} - Separation of page title and path [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/30758) in GitLab 17.2 [with flags](../../../administration/feature_flags/_index.md) named `wiki_front_matter` and `wiki_front_matter_title`. Enabled by default. - Feature flags `wiki_front_matter` and `wiki_front_matter_title` removed in GitLab 17.3. {{< /history >}} When a wiki is created, it is empty. On your first visit, you can create the home page users see when viewing the wiki. This page requires a specific path to be used as your wiki's home page. To create it: 1. On the left sidebar, select **Search or go to** and find your project or group. 1. Select **Plan > Wiki**. 1. Select **Create your first page**. 1. Optional. Change the **Title** of the home page. 1. GitLab requires this first page to have path `home`. The page on this path serves as the front page for your wiki. 1. Select a **Format** for styling your text. 1. Add a welcome message for your home page in the **Content** section. You can always edit it later. 1. Add a **Commit message**. Git requires a commit message, so GitLab creates one if you don't enter one yourself. 1. Select **Create page**. ## Create a new wiki page {{< history >}} - Separation of page title and path [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/30758) in GitLab 17.2 [with flags](../../../administration/feature_flags/_index.md) named `wiki_front_matter` and `wiki_front_matter_title`. Enabled by default. - Feature flags `wiki_front_matter` and `wiki_front_matter_title` removed in GitLab 17.3. {{< /history >}} Prerequisites: - You must have at least the Developer role. 1. On the left sidebar, select **Search or go to** and find your project or group. 1. Select **Plan > Wiki**. 1. Select **Wiki actions** ({{< icon name="ellipsis_v" >}}), then **New page** on this page, or any other wiki page. 1. Select a content format. 1. Add a **Title** for your new page. 1. Optional. Uncheck **Generate page path from title** and change the **Path** of the page. Page paths use [special characters](#special-characters-in-page-paths) for subdirectories and formatting, and have [length restrictions](#length-restrictions-for-file-and-directory-names). 1. Optional. Add content to your wiki page. 1. Optional. Attach a file, and GitLab stores it in the wiki's Git repository. 1. Add a **Commit message**. Git requires a commit message, so GitLab creates one if you don't enter one yourself. 1. Select **Create page**. ### Create or edit wiki pages locally Wikis are based on Git repositories, so you can clone them locally and edit them like you would do with every other Git repository. To clone a wiki repository locally: 1. On the left sidebar, select **Search or go to** and find your project or group. 1. Select **Plan > Wiki**. 1. Select **Wiki actions** ({{< icon name="ellipsis_v" >}}), then **Clone repository**. 1. Follow the on-screen instructions. Files you add to your wiki locally must use one of the following supported extensions, depending on the markup language you wish to use. Files with unsupported extensions don't display when pushed to GitLab: - Markdown extensions: `.mdown`, `.mkd`, `.mkdn`, `.md`, `.markdown`. - AsciiDoc extensions: `.adoc`, `.ad`, `.asciidoc`. - Other markup extensions: `.textile`, `.rdoc`, `.org`, `.creole`, `.wiki`, `.mediawiki`, `.rst`. ### Special characters in page paths {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/133521) front matter based titles in GitLab 16.7 [with flags](../../../administration/feature_flags/_index.md) named `wiki_front_matter` and `wiki_front_matter_title`. Disabled by default. - Feature flags [`wiki_front_matter`](https://gitlab.com/gitlab-org/gitlab/-/issues/435056) and [`wiki_front_matter_title`](https://gitlab.com/gitlab-org/gitlab/-/issues/428259) enabled by default in GitLab 17.2. - Feature flags `wiki_front_matter` and `wiki_front_matter_title` removed in GitLab 17.3. {{< /history >}} Wiki pages are stored as files in a Git repository, and by default, the filename of a page is also its title. Certain characters in the filename have a special meaning: - Spaces are converted into hyphens when storing a page. - Hyphens (`-`) are converted back into spaces when displaying a page. - Slashes (`/`) are used as path separators, and can't be displayed in titles. If you create a file with title containing `/` characters, GitLab creates all the subdirectories needed to build that path. For example, a title of `docs/my-page` creates a wiki page with a path `/wikis/docs/my-page`. To circumvent these limitations, you can also store the title of a wiki page in a front matter block before a page's contents. For example: ```yaml --- title: Page title --- ``` ### Length restrictions for file and directory names Many common file systems have a [limit of 255 bytes](https://en.wikipedia.org/wiki/Comparison_of_file_systems#Limits) for file and directory names. Git and GitLab both support paths exceeding those limits. However, if your file system enforces these limits, you cannot check out a local copy of a wiki that contains filenames exceeding this limit. To prevent this problem, the GitLab web interface and API enforce these limits: - 245 bytes for filenames (reserving 10 bytes for the file extension). - 255 bytes for directory names. Non-ASCII characters take up more than one byte. While you can still create files locally that exceed these limits, your teammates may not be able to check out the wiki locally afterward. ## Edit a wiki page Prerequisites: - You must have at least the Developer role. 1. On the left sidebar, select **Search or go to** and find your project or group. 1. Select **Plan > Wiki**. 1. Go to the page you want to edit, and either: - Use the <kbd>e</kbd> wiki [keyboard shortcut](../../shortcuts.md#wiki-pages). - Select **Edit**. 1. Edit the content. 1. Select **Save changes**. Unsaved changes to a wiki page are preserved in local browser storage to prevent accidental data loss. ### Create a table of contents {{< history >}} - Table of contents in the wiki sidebar [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/281570) in GitLab 17.2. {{< /history >}} Wiki pages with headings in their contents automatically display a table of contents section in the sidebar. You can also choose to optionally display a separate table of contents section on the page itself. To generate a table of contents from a wiki page's subheadings, use the `[[_TOC_]]` tag. For an example, read [Table of contents](../../markdown.md#table-of-contents). ## Delete a wiki page Prerequisites: - You must have at least the Developer role. 1. On the left sidebar, select **Search or go to** and find your project or group. 1. Select **Plan > Wiki**. 1. Go to the page you want to delete. 1. Select **Wiki actions** ({{< icon name="ellipsis_v" >}}), then **Delete page**. 1. Confirm the deletion. ## Move or rename a wiki page {{< history >}} - Redirects for moved or renamed wiki pages [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/257892) in GitLab 17.1 [with a flag](../../../administration/feature_flags/_index.md) named `wiki_redirection`. Enabled by default. - Separation of page title and path [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/30758) in GitLab 17.2 [with flags](../../../administration/feature_flags/_index.md) named `wiki_front_matter` and `wiki_front_matter_title`. Enabled by default. - Feature flags `wiki_redirection`, `wiki_front_matter` and `wiki_front_matter_title` removed in GitLab 17.3. {{< /history >}} In GitLab 17.1 and later, when you move or rename a page, a redirect is automatically set up from the old page to the new page. A list of redirects is stored in the `.gitlab/redirects.yml` file in the Wiki repository. Prerequisites: - You must have at least the Developer role. 1. On the left sidebar, select **Search or go to** and find your project or group. 1. Select **Plan > Wiki**. 1. Go to the page you want to move or rename. 1. Select **Edit**. 1. To move the page, add the new path to the **Path** field. For example, if you have a wiki page called `About` under `Company` and you want to move it to the wiki's root, change the **Path** from `About` to `/About`. 1. To rename the page, change the **Path**. 1. Select **Save changes**. ## Export a wiki page {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/414691) in GitLab 16.3 [with a flag](../../../administration/feature_flags/_index.md) named `print_wiki`. Disabled by default. - [Enabled on GitLab.com and GitLab Self-Managed](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/134251/) in GitLab 16.5. - Feature flag `print_wiki` removed in GitLab 16.6. {{< /history >}} You can export a wiki page as a PDF file: 1. On the left sidebar, select **Search or go to** and find your project or group. 1. Select **Plan > Wiki**. 1. Go to the page you want to export. 1. On the top right, select **Wiki actions** ({{< icon name="ellipsis_v" >}}), then select **Print as PDF**. A PDF of the wiki page is created. ## Creating diagrams in the wiki using Draw.io With the diagrams.net integration, you can create and embed SVG diagrams on wiki pages! The diagram editor is available in both the plain text editor and the rich text editor. On GitLab.com, this integration is enabled for all SaaS users and does not require any additional configuration. On GitLab Self-Managed, you can integrate with the free diagrams.net website or host your own diagrams.net site in offline environments. To set up the integration, you must: 1. Choose to integrate with the free diagrams.net website or configure your diagrams.net server. 1. Enable the integration. After completing the integration, the diagrams.net editor opens with the URL you provided. ## Wiki page templates {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/442228) in GitLab 16.10. {{< /history >}} You can create templates to use when creating new pages, or to apply to existing pages. Templates are wiki pages that are stored in the `templates/` directory in the wiki repository. ### Create a template Prerequisites: - You must have at least the Developer role. 1. On the left sidebar, select **Search or go to** and find your project or group. 1. Select **Plan > Wiki**. 1. Select **Wiki actions** ({{< icon name="ellipsis_v" >}}), then **Templates**. 1. Select **New Template**. 1. Enter template title, format and content, as if creating a regular wiki page. Templates of a particular format can only be applied to pages of the same format. For example, Markdown templates only apply to Markdown pages. ### Apply a template When you are [creating](#create-a-new-wiki-page) or [editing](#edit-a-wiki-page) a wiki page, you can apply a template. Prerequisites: - You must have [created](#create-a-template) at least one template already. 1. In the **Content** section, select the **Choose a template** dropdown list. 1. Select a template from the list. If the page already has some content, a warning displays indicating that the existing content will be overridden. 1. Select **Apply template**. ## View history of a wiki page The changes of a wiki page over time are recorded in the wiki's Git repository. The history page shows: - The revision of the page. - The page author. - The commit message. - The last update. - Previous revisions, by selecting a revision number in the **Page version** column. To view the changes for a wiki page: 1. On the left sidebar, select **Search or go to** and find your project or group. 1. Select **Plan > Wiki**. 1. Go to the page you want to view history for. 1. Select **Wiki actions** ({{< icon name="ellipsis_v" >}}), then **Page history**. ### View changes between page versions You can see the changes made in a version of a wiki page, similar to versioned diff file views: 1. On the left sidebar, select **Search or go to** and find your project or group. 1. Select **Plan > Wiki**. 1. Go to the wiki page you're interested in. 1. Select **Wiki actions** ({{< icon name="ellipsis_v" >}}), then **Page history** to see all page versions. 1. Select the commit message in the **Diff** column for the version you're interested in. ## Sidebar {{< history >}} - Searching by title in the sidebar [introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/156054) in GitLab 17.1. - Limit of 15 items in the sidebar [removed](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/158084) in GitLab 17.2. {{< /history >}} Wiki pages display a sidebar that contains a list of pages in the wiki, displayed as a nested tree, with sibling pages listed in alphabetical order. You can quickly find a page by its title in the wiki using the search box in the sidebar. For performance reasons, the sidebar is limited to displaying 5000 entries. To view a list of all pages, select **View All Pages** in the sidebar. ### Customize sidebar You can manually edit the contents of the sidebar navigation. Prerequisites: - You must have at least the Developer role. This process creates a wiki page named `_sidebar` which fully replaces the default sidebar navigation: 1. On the left sidebar, select **Search or go to** and find your project or group. 1. Select **Plan > Wiki**. 1. In the upper-right corner of the page, select **Add custom sidebar** ({{< icon name="settings" >}}). 1. When complete, select **Save changes**. A `_sidebar` example, formatted with Markdown: ```markdown ### Home - [Hello World](hello) - [Foo](foo) - [Bar](bar) --- - [Sidebar](_sidebar) ``` ## Enable or disable a project wiki Wikis are enabled by default in GitLab. Project [administrators](../../permissions.md) can enable or disable a project wiki by following the instructions in [Sharing and permissions](../settings/_index.md#configure-project-features-and-permissions). Administrators for GitLab Self-Managed can [configure additional wiki settings](../../../administration/wikis/_index.md). You can disable group wikis from the [group settings](group.md#configure-group-wiki-visibility) ## Link an external wiki To add a link to an external wiki from a project's left sidebar: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Integrations**. 1. Select **External wiki**. 1. Add the URL to your external wiki. 1. Optional. Select **Test settings**. 1. Select **Save changes**. You can now see the **External wiki** option from your project's left sidebar. When you enable this integration, the link to the external wiki doesn't replace the link to the internal wiki. To hide the internal wiki from the sidebar, [disable the project's wiki](#disable-the-projects-wiki). To hide the link to an external wiki: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Integrations**. 1. Select **External wiki**. 1. Under **Enable integration**, clear the **Active** checkbox. 1. Select **Save changes**. ## Disable the project's wiki To disable a project's internal wiki: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > General**. 1. Expand **Visibility, project features, permissions**. 1. Scroll down to find and turn off the **Wiki** toggle (in gray). 1. Select **Save changes**. The internal wiki is now disabled, and users and project members: - Cannot find the link to the wiki from the project's sidebar. - Cannot add, delete, or edit wiki pages. - Cannot view any wiki page. Previously added wiki pages are preserved in case you want to re-enable the wiki. To re-enable it, repeat the process to disable the wiki but toggle it on (in blue). ## Rich text editor {{< history >}} - [Renamed](https://gitlab.com/gitlab-org/gitlab/-/issues/398152) from content editor to rich text editor in GitLab 16.2. {{< /history >}} GitLab provides a rich text editing experience for GitLab Flavored Markdown in wikis. Support includes: - Formatting text, including using bold, italics, block quotes, headings, and inline code. - Formatting ordered lists, unordered lists, and checklists. - Creating and editing table structure. - Inserting and formatting code blocks with syntax highlighting. - Previewing Mermaid, PlantUML, and Kroki diagrams. ### Use the rich text editor 1. [Create](#create-a-new-wiki-page) a new wiki page, or [edit](#edit-a-wiki-page) an existing one. 1. Select **Markdown** as your format. 1. Under **Content**, in the lower-left corner, select **Switch to rich text editing**. 1. Customize your page's content using the various formatting options available in the rich text editor. 1. Select **Create page** for a new page, or **Save changes** for an existing page. To switch back to plain text, select **Switch to plain text editing**. See also: - [Rich text editor](../../rich_text_editor.md) ### GitLab Flavored Markdown support Supporting all GitLab Flavored Markdown content types in the rich text editor is a work in progress. For the status of the ongoing development for CommonMark and GitLab Flavored Markdown support, read: - [Basic Markdown formatting extensions](https://gitlab.com/groups/gitlab-org/-/epics/5404) epic. - [GitLab Flavored Markdown extensions](https://gitlab.com/groups/gitlab-org/-/epics/5438) epic. ## Track wiki events GitLab tracks wiki creation, deletion, and update events. These events are displayed on the following pages: - [User profile](../../profile/_index.md#access-your-user-profile). - Activity pages, depending on the type of wiki: - [Group activity](../../group/manage.md#view-group-activity). - [Project activity](../working_with_projects.md#view-project-activity). Commits to wikis are not counted in [repository analytics](../../analytics/repository_analytics.md). ## Troubleshooting ### Page slug rendering with Apache reverse proxy Page slugs are encoded using the [`ERB::Util.url_encode`](https://www.rubydoc.info/stdlib/erb/ERB%2FUtil.url_encode) method. If you use an Apache reverse proxy, you can add a `nocanon` argument to the `ProxyPass` line of your Apache configuration to ensure your page slugs render correctly. ### Recreate a project wiki with the Rails console {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab Self-Managed, GitLab Dedicated {{< /details >}} {{< alert type="warning" >}} This operation deletes all data in the wiki. {{< /alert >}} {{< alert type="warning" >}} Any command that changes data directly could be damaging if not run correctly, or under the right conditions. We highly recommend running them in a test environment with a backup of the instance ready to be restored, just in case. {{< /alert >}} To clear all data from a project wiki and recreate it in a blank state: 1. [Start a Rails console session](../../../administration/operations/rails_console.md#starting-a-rails-console-session). 1. Run these commands: ```ruby # Enter your project's path p = Project.find_by_full_path('<username-or-group>/<project-name>') # This command deletes the wiki project from the filesystem. p.wiki.repository.remove # Refresh the wiki repository state. p.wiki.repository.expire_exists_cache ``` All data from the wiki has been cleared, and the wiki is ready for use. ## Related topics - [Wiki settings for administrators](../../../administration/wikis/_index.md) - [Project wikis API](../../../api/wikis.md) - [Group wikis API](../../../api/group_wikis.md) - [Group repository storage moves API](../../../api/group_repository_storage_moves.md) - [Wiki keyboard shortcuts](../../shortcuts.md#wiki-pages) - [GitLab Flavored Markdown](../../markdown.md) - [Asciidoc](../../asciidoc.md)
https://docs.gitlab.com/user/project/markdown
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/markdown.md
2025-08-13
doc/user/project/wiki
[ "doc", "user", "project", "wiki" ]
markdown.md
Plan
Knowledge
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Wiki-specific Markdown
null
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} The following topics show how links inside wikis behave. When linking to wiki pages, you should use the **page slug** rather than the page name. ## Direct page link A direct page link includes the slug for a page that points to that page, at the base level of the wiki. This example links to a `documentation` page at the root of your wiki: ```markdown [Link to Documentation](documentation) ``` ## Direct file link A direct file link points to a file extension for a file, relative to the current page. If the following example is on a page at `<your_wiki>/documentation/related`, it links to `<your_wiki>/documentation/file.md`: ```markdown [Link to File](file.md) ``` ## Hierarchical link A hierarchical link can be constructed relative to the current wiki page by using relative paths like `./<page>` or `../<page>`. If this example is on a page at `<your_wiki>/documentation/main`, it links to `<your_wiki>/documentation/related`: ```markdown [Link to Related Page](related) ``` If this example is on a page at `<your_wiki>/documentation/related/content`, it links to `<your_wiki>/documentation/main`: ```markdown [Link to Related Page](../main) ``` If this example is on a page at `<your_wiki>/documentation/main`, it links to `<your_wiki>/documentation/related.md`: ```markdown [Link to Related Page](related.md) ``` If this example is on a page at `<your_wiki>/documentation/related/content`, it links to `<your_wiki>/documentation/main.md`: ```markdown [Link to Related Page](../main.md) ``` ## Root link A root link starts with a `/` and is relative to the wiki root. This example links to `<wiki_root>/documentation`: ```markdown [Link to Related Page](/documentation) ``` This example links to `<wiki_root>/documentation.md`: ```markdown [Link to Related Page](/documentation.md) ``` ## diagrams.net editor {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/322174) in GitLab 15.10. {{< /history >}} In wikis, you can use the [diagrams.net](https://app.diagrams.net/) editor to create diagrams. You can also edit diagrams created with the diagrams.net editor. The diagram editor is available in both the plain text editor and the rich text editor. For more information, see [Diagrams.net](../../../administration/integration/diagrams_net.md). ### Plain text editor To create a diagram in the plain text editor: 1. On the wiki page you want to edit, select **Edit**. 1. In the text box, make sure you're using the plain text editor (the button on the bottom left says **Switch to rich text editing**). 1. In the editor's toolbar, select **Insert or edit diagram** ({{< icon name="diagram" >}}). 1. Create the diagram in the [app.diagrams.net](https://app.diagrams.net/) editor. 1. Select **Save & exit**. A Markdown image reference to the diagram is inserted in the wiki content. To edit a diagram in the plain text editor: 1. On the wiki page you want to edit, select **Edit**. 1. In the text box, make sure you're using the plain text editor (the button on the bottom left says **Switch to rich text editing**). 1. Position your cursor in the Markdown image reference that contains the diagram. 1. Select **Insert or edit diagram** ({{< icon name="diagram" >}}). 1. Edit the diagram in the [app.diagrams.net](https://app.diagrams.net/) editor. 1. Select **Save & exit**. A Markdown image reference to the diagram is inserted in the wiki content, replacing the previous diagram. ### Rich text editor To create a diagram in the rich text editor: 1. On the wiki page you want to edit, select **Edit**. 1. In the text box, make sure you're using the rich text editor (the button on the bottom left says **Switch to plain text editing**). 1. In the editor's toolbar, select **More options** ({{< icon name="plus" >}}). 1. In the dropdown list, select **Create or edit diagram**. 1. Create the diagram in the [app.diagrams.net](https://app.diagrams.net/) editor. 1. Select **Save & exit**. The diagram as visualized in the diagrams.net editor is inserted in the wiki content. To edit a diagram in the rich text editor: 1. On the wiki page you want to edit, select **Edit**. 1. In the text box, make sure you're using the rich text editor (the button on the bottom left says **Switch to plain text editing**). 1. Select the diagram that you want to edit. 1. In the floating toolbar, select **Edit diagram** ({{< icon name="diagram" >}}). 1. Edit the diagram in the [app.diagrams.net](https://app.diagrams.net/) editor. 1. Select **Save & exit**. The selected diagram is replaced with an updated version.
--- stage: Plan group: Knowledge info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments title: Wiki-specific Markdown breadcrumbs: - doc - user - project - wiki --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} The following topics show how links inside wikis behave. When linking to wiki pages, you should use the **page slug** rather than the page name. ## Direct page link A direct page link includes the slug for a page that points to that page, at the base level of the wiki. This example links to a `documentation` page at the root of your wiki: ```markdown [Link to Documentation](documentation) ``` ## Direct file link A direct file link points to a file extension for a file, relative to the current page. If the following example is on a page at `<your_wiki>/documentation/related`, it links to `<your_wiki>/documentation/file.md`: ```markdown [Link to File](file.md) ``` ## Hierarchical link A hierarchical link can be constructed relative to the current wiki page by using relative paths like `./<page>` or `../<page>`. If this example is on a page at `<your_wiki>/documentation/main`, it links to `<your_wiki>/documentation/related`: ```markdown [Link to Related Page](related) ``` If this example is on a page at `<your_wiki>/documentation/related/content`, it links to `<your_wiki>/documentation/main`: ```markdown [Link to Related Page](../main) ``` If this example is on a page at `<your_wiki>/documentation/main`, it links to `<your_wiki>/documentation/related.md`: ```markdown [Link to Related Page](related.md) ``` If this example is on a page at `<your_wiki>/documentation/related/content`, it links to `<your_wiki>/documentation/main.md`: ```markdown [Link to Related Page](../main.md) ``` ## Root link A root link starts with a `/` and is relative to the wiki root. This example links to `<wiki_root>/documentation`: ```markdown [Link to Related Page](/documentation) ``` This example links to `<wiki_root>/documentation.md`: ```markdown [Link to Related Page](/documentation.md) ``` ## diagrams.net editor {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/322174) in GitLab 15.10. {{< /history >}} In wikis, you can use the [diagrams.net](https://app.diagrams.net/) editor to create diagrams. You can also edit diagrams created with the diagrams.net editor. The diagram editor is available in both the plain text editor and the rich text editor. For more information, see [Diagrams.net](../../../administration/integration/diagrams_net.md). ### Plain text editor To create a diagram in the plain text editor: 1. On the wiki page you want to edit, select **Edit**. 1. In the text box, make sure you're using the plain text editor (the button on the bottom left says **Switch to rich text editing**). 1. In the editor's toolbar, select **Insert or edit diagram** ({{< icon name="diagram" >}}). 1. Create the diagram in the [app.diagrams.net](https://app.diagrams.net/) editor. 1. Select **Save & exit**. A Markdown image reference to the diagram is inserted in the wiki content. To edit a diagram in the plain text editor: 1. On the wiki page you want to edit, select **Edit**. 1. In the text box, make sure you're using the plain text editor (the button on the bottom left says **Switch to rich text editing**). 1. Position your cursor in the Markdown image reference that contains the diagram. 1. Select **Insert or edit diagram** ({{< icon name="diagram" >}}). 1. Edit the diagram in the [app.diagrams.net](https://app.diagrams.net/) editor. 1. Select **Save & exit**. A Markdown image reference to the diagram is inserted in the wiki content, replacing the previous diagram. ### Rich text editor To create a diagram in the rich text editor: 1. On the wiki page you want to edit, select **Edit**. 1. In the text box, make sure you're using the rich text editor (the button on the bottom left says **Switch to plain text editing**). 1. In the editor's toolbar, select **More options** ({{< icon name="plus" >}}). 1. In the dropdown list, select **Create or edit diagram**. 1. Create the diagram in the [app.diagrams.net](https://app.diagrams.net/) editor. 1. Select **Save & exit**. The diagram as visualized in the diagrams.net editor is inserted in the wiki content. To edit a diagram in the rich text editor: 1. On the wiki page you want to edit, select **Edit**. 1. In the text box, make sure you're using the rich text editor (the button on the bottom left says **Switch to plain text editing**). 1. Select the diagram that you want to edit. 1. In the floating toolbar, select **Edit diagram** ({{< icon name="diagram" >}}). 1. Edit the diagram in the [app.diagrams.net](https://app.diagrams.net/) editor. 1. Select **Save & exit**. The selected diagram is replaced with an updated version.
https://docs.gitlab.com/user/project/milestones
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/_index.md
2025-08-13
doc/user/project/milestones
[ "doc", "user", "project", "milestones" ]
_index.md
Plan
Project Management
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Milestones
Burndown charts, goals, progress tracking, and releases.
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} Milestones help track and organize work in GitLab. Milestones: - Group related issues, epics, and merge requests to track progress toward a goal. - Support time-based planning with optional start and due dates. - Work alongside iterations to track concurrent timeboxes. - Track releases and generate release evidence. - Apply to projects and groups. Milestones can belong to a [project](../_index.md) or [group](../../group/_index.md). Project milestones apply to issues and merge requests in that project only. Group milestones apply to any issue, epic or merge request in that group's projects. For information about project and group milestones API, see: - [Project Milestones API](../../../api/milestones.md) - [Group Milestones API](../../../api/group_milestones.md) ## Milestones as releases Milestones can be used to track releases. To do so: 1. Set the milestone due date to represent the release date of your release. If you do not have a defined start date for your release cycle, you can leave the milestone start date blank. 1. Set the milestone title to the version of your release, such as `Version 9.4`. 1. Add issues to your release by selecting the milestone from the issue's right sidebar. Additionally, to automatically generate release evidence when you create your release, integrate milestones with the [Releases feature](../releases/_index.md#associate-milestones-with-a-release). ## Project milestones and group milestones A milestone can belong to [project](../_index.md) or [group](../../group/_index.md). You can assign **project milestones** to issues or merge requests in that project only. You can assign **group milestones** to any issue, epic, or merge request of any project in that group. For information about project and group milestones API, see: - [Project Milestones API](../../../api/milestones.md) - [Group Milestones API](../../../api/group_milestones.md) ### View project or group milestones To view the milestone list: 1. On the left sidebar, select **Search or go to** and find your project or group. 1. Select **Plan > Milestones**. In a project, GitLab displays milestones that belong to the project. In a group, GitLab displays milestones that belong to the group and all projects and subgroups in the group. ### View milestones in a project with issues turned off If a project has issue tracking [turned off](../settings/_index.md#configure-project-features-and-permissions), to get to the milestones page, enter its URL. To do so: 1. Go to your project. 1. Add: `/-/milestones` to your project URL. For example `https://gitlab.com/gitlab-org/sample-data-templates/sample-gitlab-project/-/milestones`. Alternatively, this project's issues are visible in the group's milestone page. Improving this experience is tracked in issue [339009](https://gitlab.com/gitlab-org/gitlab/-/issues/339009). ### View all milestones You can view all the milestones you have access to in the entire GitLab namespace. You might not see some milestones because they're in projects or groups you're not a member of. To do so: 1. On the left sidebar, select **Search or go to**. 1. Select **Your work**. 1. On the left sidebar, select **Milestones**. ### View milestone details To view more information about a milestone, in the **Milestones** page, select the title of the milestone you want to view. The milestone view shows the title and description. The tabs below the title and description show the following: - **Work Items**: Shows all work items assigned to the milestone. Work items are displayed in three columns named: - Unstarted Issues (open and unassigned) - Ongoing Issues (open and assigned) - Completed Issues (closed) - **Merge Requests**: Shows all merge requests assigned to the milestone. Merge requests are displayed in four columns named: - Work in progress (open and unassigned) - Waiting for merge (open and assigned) - Rejected (closed) - Merged - **Participants**: Shows all assignees of issues assigned to the milestone. - **Labels**: Shows all labels that are used in issues assigned to the milestone. #### Burndown charts The milestone view contains a [burndown and burnup chart](burndown_and_burnup_charts.md), showing the progress of completing a milestone. ![burndown and burnup chart](img/burndown_and_burnup_charts_v15_3.png) #### Milestone sidebar The sidebar on the milestone view shows the following: - Percentage complete, which is calculated as number of closed work items divided by total number of work items. - The start date and due date. - The total time spent on all work items and merge requests assigned to the milestone. - The total issue weight of all work items assigned to the milestone. - The count of total, open, closed, and merged merge requests. - Links to associated releases. - The milestone's reference you can copy to your clipboard. ![Project milestone page](img/milestones_project_milestone_page_sidebar_v13_11.png) ## Create a milestone {{< history >}} - [Changed](https://gitlab.com/gitlab-org/gitlab/-/issues/343889) the minimum user role from Developer to Reporter in GitLab 15.0. - [Changed](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/169256) the minimum user role from Reporter to Planner in GitLab 17.7. - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/195530) milestones to Epic work items in GitLab 18.2. {{< /history >}} You can create a milestone either in a project or a group. Prerequisites: - You must have at least the Planner role for the project or group the milestone belongs to. To create a milestone: 1. On the left sidebar, select **Search or go to** and find your project or group. 1. Select **Plan > Milestones**. 1. Select **New milestone**. 1. Enter the title. 1. Optional. Enter description, start date, and due date. 1. Select **New milestone**. ![New milestone](img/milestones_new_project_milestone_v16_11.png) ## Edit a milestone {{< history >}} - [Changed](https://gitlab.com/gitlab-org/gitlab/-/issues/343889) the minimum user role from Developer to Reporter in GitLab 15.0. - [Changed](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/169256) the minimum user role from Reporter to Planner in GitLab 17.7. {{< /history >}} Prerequisites: - You must have at least the Planner role for the project or group the milestone belongs to. To edit a milestone: 1. On the left sidebar, select **Search or go to** and find your project or group. 1. Select **Plan > Milestones**. 1. Select a milestone's title. 1. In the upper-right corner, select **Milestone actions** ({{< icon name="ellipsis_v" >}}) and then select **Edit**. 1. Edit the title, start date, due date, or description. 1. Select **Save changes**. ## Close a milestone {{< history >}} - [Changed](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/169256) the minimum user role from Reporter to Planner in GitLab 17.7. {{< /history >}} A milestone closes after its due date. You can also close a milestone manually. When a milestone is closed, its open issues remain open. Prerequisites: - You must have at least the Planner role for the project or group the milestone belongs to. To close a milestone: 1. On the left sidebar, select **Search or go to** and find your project or group. 1. Select **Plan > Milestones**. 1. Either: - Next to the milestone you want to close, select **Milestone actions** ({{< icon name="ellipsis_v" >}}) > **Close**. - Select the milestone title, and then select **Close**. ## Delete a milestone {{< history >}} - [Changed](https://gitlab.com/gitlab-org/gitlab/-/issues/343889) the minimum user role from Developer to Reporter in GitLab 15.0. - [Changed](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/169256) the minimum user role from Reporter to Planner in GitLab 17.7. {{< /history >}} Prerequisites: - You must have at least the Planner role for the project or group the milestone belongs to. To delete a milestone: 1. On the left sidebar, select **Search or go to** and find your project or group. 1. Select **Plan > Milestones**. 1. Either: - Next to the milestone you want to delete, select **Milestone actions** ({{< icon name="ellipsis_v" >}}) > **Delete**. - Select the milestone title, and then select **Milestone actions** ({{< icon name="ellipsis_v" >}}) > **Delete**. 1. Select **Delete milestone**. ## Promote a project milestone to a group milestone {{< history >}} - [Changed](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/169256) the minimum user role from Reporter to Planner in GitLab 17.7. {{< /history >}} If you are expanding the number of projects in a group, you might want to share the same milestones among this group's projects. You can promote project milestones to the parent group to make them available to other projects in the same group. Promoting a milestone merges all project milestones across all projects in this group with the same name into a single group milestone. All issues and merge requests that were previously assigned to one of these project milestones become assigned to the new group milestone. {{< alert type="warning" >}} This action cannot be reversed and the changes are permanent. {{< /alert >}} Prerequisites: - You must have at least the Planner role for the group. To promote a project milestone: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Plan > Milestones**. 1. Either: - Next to the milestone you want to promote, select **Milestone actions** ({{< icon name="ellipsis_v" >}}) > **Promote**. - Select the milestone title, and then select **Milestone actions** ({{< icon name="ellipsis_v" >}}) > **Promote**. 1. Select **Promote Milestone**. ## Assign a milestone to an item {{< history >}} - Ability to assign milestones to epics [introduced](https://gitlab.com/groups/gitlab-org/-/epics/329) in GitLab 18.2. {{< /history >}} Every issue, epic, or merge request can be assigned one milestone. The milestones are visible on every issue and merge request page, on the right sidebar. They are also visible in the work item board. To assign or unassign a milestone: 1. View an issue, an epic, or a merge request. 1. On the right sidebar, next to **Milestones**, select **Edit**. 1. In the **Assign milestone** list, search for a milestone by typing its name. You can select from both project and group milestones. 1. Select the milestone you want to assign. To assign or unassign a milestone, you can also: - Use the `/milestone` [quick action](../quick_actions.md) in a comment or description - Drag an issue to a [milestone list](../issue_board.md#milestone-lists) in a board - [Bulk edit issues](../issues/managing_issues.md#bulk-edit-issues-from-a-project) from the issues list ## Filter issues and merge requests by milestone ### Filters in list pages You can filter by both group and project milestones from the project and group issue/merge request list pages. ### Filters in issue boards From [project issue boards](../issue_board.md), you can filter by both group milestones and project milestones in: - [Search and filter bar](../issue_board.md#filter-issues) - [Issue board configuration](../issue_board.md#configurable-issue-boards) From [group issue boards](../issue_board.md#group-issue-boards), you can filter by only group milestones in: - [Search and filter bar](../issue_board.md#filter-issues) - [Issue board configuration](../issue_board.md#configurable-issue-boards) ### Special milestone filters {{< history >}} - Logic for **Started** and **Upcoming** filters [changed](https://gitlab.com/gitlab-org/gitlab/-/issues/429728) in GitLab 18.0. {{< /history >}} When filtering by milestone, in addition to choosing a specific project milestone or group milestone, you can choose a special milestone filter. - **None**: Show issues or merge requests with no assigned milestone. - **Any**: Show issues or merge requests with an assigned milestone. - **Upcoming**: Show issues or merge requests with an open assigned milestone starting in the future. - **Started**: Show issues or merge requests with an open assigned milestone that overlaps with the current date. The list excludes milestones without a defined start and due date.
--- stage: Plan group: Project Management info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments title: Milestones description: Burndown charts, goals, progress tracking, and releases. breadcrumbs: - doc - user - project - milestones --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} Milestones help track and organize work in GitLab. Milestones: - Group related issues, epics, and merge requests to track progress toward a goal. - Support time-based planning with optional start and due dates. - Work alongside iterations to track concurrent timeboxes. - Track releases and generate release evidence. - Apply to projects and groups. Milestones can belong to a [project](../_index.md) or [group](../../group/_index.md). Project milestones apply to issues and merge requests in that project only. Group milestones apply to any issue, epic or merge request in that group's projects. For information about project and group milestones API, see: - [Project Milestones API](../../../api/milestones.md) - [Group Milestones API](../../../api/group_milestones.md) ## Milestones as releases Milestones can be used to track releases. To do so: 1. Set the milestone due date to represent the release date of your release. If you do not have a defined start date for your release cycle, you can leave the milestone start date blank. 1. Set the milestone title to the version of your release, such as `Version 9.4`. 1. Add issues to your release by selecting the milestone from the issue's right sidebar. Additionally, to automatically generate release evidence when you create your release, integrate milestones with the [Releases feature](../releases/_index.md#associate-milestones-with-a-release). ## Project milestones and group milestones A milestone can belong to [project](../_index.md) or [group](../../group/_index.md). You can assign **project milestones** to issues or merge requests in that project only. You can assign **group milestones** to any issue, epic, or merge request of any project in that group. For information about project and group milestones API, see: - [Project Milestones API](../../../api/milestones.md) - [Group Milestones API](../../../api/group_milestones.md) ### View project or group milestones To view the milestone list: 1. On the left sidebar, select **Search or go to** and find your project or group. 1. Select **Plan > Milestones**. In a project, GitLab displays milestones that belong to the project. In a group, GitLab displays milestones that belong to the group and all projects and subgroups in the group. ### View milestones in a project with issues turned off If a project has issue tracking [turned off](../settings/_index.md#configure-project-features-and-permissions), to get to the milestones page, enter its URL. To do so: 1. Go to your project. 1. Add: `/-/milestones` to your project URL. For example `https://gitlab.com/gitlab-org/sample-data-templates/sample-gitlab-project/-/milestones`. Alternatively, this project's issues are visible in the group's milestone page. Improving this experience is tracked in issue [339009](https://gitlab.com/gitlab-org/gitlab/-/issues/339009). ### View all milestones You can view all the milestones you have access to in the entire GitLab namespace. You might not see some milestones because they're in projects or groups you're not a member of. To do so: 1. On the left sidebar, select **Search or go to**. 1. Select **Your work**. 1. On the left sidebar, select **Milestones**. ### View milestone details To view more information about a milestone, in the **Milestones** page, select the title of the milestone you want to view. The milestone view shows the title and description. The tabs below the title and description show the following: - **Work Items**: Shows all work items assigned to the milestone. Work items are displayed in three columns named: - Unstarted Issues (open and unassigned) - Ongoing Issues (open and assigned) - Completed Issues (closed) - **Merge Requests**: Shows all merge requests assigned to the milestone. Merge requests are displayed in four columns named: - Work in progress (open and unassigned) - Waiting for merge (open and assigned) - Rejected (closed) - Merged - **Participants**: Shows all assignees of issues assigned to the milestone. - **Labels**: Shows all labels that are used in issues assigned to the milestone. #### Burndown charts The milestone view contains a [burndown and burnup chart](burndown_and_burnup_charts.md), showing the progress of completing a milestone. ![burndown and burnup chart](img/burndown_and_burnup_charts_v15_3.png) #### Milestone sidebar The sidebar on the milestone view shows the following: - Percentage complete, which is calculated as number of closed work items divided by total number of work items. - The start date and due date. - The total time spent on all work items and merge requests assigned to the milestone. - The total issue weight of all work items assigned to the milestone. - The count of total, open, closed, and merged merge requests. - Links to associated releases. - The milestone's reference you can copy to your clipboard. ![Project milestone page](img/milestones_project_milestone_page_sidebar_v13_11.png) ## Create a milestone {{< history >}} - [Changed](https://gitlab.com/gitlab-org/gitlab/-/issues/343889) the minimum user role from Developer to Reporter in GitLab 15.0. - [Changed](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/169256) the minimum user role from Reporter to Planner in GitLab 17.7. - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/195530) milestones to Epic work items in GitLab 18.2. {{< /history >}} You can create a milestone either in a project or a group. Prerequisites: - You must have at least the Planner role for the project or group the milestone belongs to. To create a milestone: 1. On the left sidebar, select **Search or go to** and find your project or group. 1. Select **Plan > Milestones**. 1. Select **New milestone**. 1. Enter the title. 1. Optional. Enter description, start date, and due date. 1. Select **New milestone**. ![New milestone](img/milestones_new_project_milestone_v16_11.png) ## Edit a milestone {{< history >}} - [Changed](https://gitlab.com/gitlab-org/gitlab/-/issues/343889) the minimum user role from Developer to Reporter in GitLab 15.0. - [Changed](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/169256) the minimum user role from Reporter to Planner in GitLab 17.7. {{< /history >}} Prerequisites: - You must have at least the Planner role for the project or group the milestone belongs to. To edit a milestone: 1. On the left sidebar, select **Search or go to** and find your project or group. 1. Select **Plan > Milestones**. 1. Select a milestone's title. 1. In the upper-right corner, select **Milestone actions** ({{< icon name="ellipsis_v" >}}) and then select **Edit**. 1. Edit the title, start date, due date, or description. 1. Select **Save changes**. ## Close a milestone {{< history >}} - [Changed](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/169256) the minimum user role from Reporter to Planner in GitLab 17.7. {{< /history >}} A milestone closes after its due date. You can also close a milestone manually. When a milestone is closed, its open issues remain open. Prerequisites: - You must have at least the Planner role for the project or group the milestone belongs to. To close a milestone: 1. On the left sidebar, select **Search or go to** and find your project or group. 1. Select **Plan > Milestones**. 1. Either: - Next to the milestone you want to close, select **Milestone actions** ({{< icon name="ellipsis_v" >}}) > **Close**. - Select the milestone title, and then select **Close**. ## Delete a milestone {{< history >}} - [Changed](https://gitlab.com/gitlab-org/gitlab/-/issues/343889) the minimum user role from Developer to Reporter in GitLab 15.0. - [Changed](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/169256) the minimum user role from Reporter to Planner in GitLab 17.7. {{< /history >}} Prerequisites: - You must have at least the Planner role for the project or group the milestone belongs to. To delete a milestone: 1. On the left sidebar, select **Search or go to** and find your project or group. 1. Select **Plan > Milestones**. 1. Either: - Next to the milestone you want to delete, select **Milestone actions** ({{< icon name="ellipsis_v" >}}) > **Delete**. - Select the milestone title, and then select **Milestone actions** ({{< icon name="ellipsis_v" >}}) > **Delete**. 1. Select **Delete milestone**. ## Promote a project milestone to a group milestone {{< history >}} - [Changed](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/169256) the minimum user role from Reporter to Planner in GitLab 17.7. {{< /history >}} If you are expanding the number of projects in a group, you might want to share the same milestones among this group's projects. You can promote project milestones to the parent group to make them available to other projects in the same group. Promoting a milestone merges all project milestones across all projects in this group with the same name into a single group milestone. All issues and merge requests that were previously assigned to one of these project milestones become assigned to the new group milestone. {{< alert type="warning" >}} This action cannot be reversed and the changes are permanent. {{< /alert >}} Prerequisites: - You must have at least the Planner role for the group. To promote a project milestone: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Plan > Milestones**. 1. Either: - Next to the milestone you want to promote, select **Milestone actions** ({{< icon name="ellipsis_v" >}}) > **Promote**. - Select the milestone title, and then select **Milestone actions** ({{< icon name="ellipsis_v" >}}) > **Promote**. 1. Select **Promote Milestone**. ## Assign a milestone to an item {{< history >}} - Ability to assign milestones to epics [introduced](https://gitlab.com/groups/gitlab-org/-/epics/329) in GitLab 18.2. {{< /history >}} Every issue, epic, or merge request can be assigned one milestone. The milestones are visible on every issue and merge request page, on the right sidebar. They are also visible in the work item board. To assign or unassign a milestone: 1. View an issue, an epic, or a merge request. 1. On the right sidebar, next to **Milestones**, select **Edit**. 1. In the **Assign milestone** list, search for a milestone by typing its name. You can select from both project and group milestones. 1. Select the milestone you want to assign. To assign or unassign a milestone, you can also: - Use the `/milestone` [quick action](../quick_actions.md) in a comment or description - Drag an issue to a [milestone list](../issue_board.md#milestone-lists) in a board - [Bulk edit issues](../issues/managing_issues.md#bulk-edit-issues-from-a-project) from the issues list ## Filter issues and merge requests by milestone ### Filters in list pages You can filter by both group and project milestones from the project and group issue/merge request list pages. ### Filters in issue boards From [project issue boards](../issue_board.md), you can filter by both group milestones and project milestones in: - [Search and filter bar](../issue_board.md#filter-issues) - [Issue board configuration](../issue_board.md#configurable-issue-boards) From [group issue boards](../issue_board.md#group-issue-boards), you can filter by only group milestones in: - [Search and filter bar](../issue_board.md#filter-issues) - [Issue board configuration](../issue_board.md#configurable-issue-boards) ### Special milestone filters {{< history >}} - Logic for **Started** and **Upcoming** filters [changed](https://gitlab.com/gitlab-org/gitlab/-/issues/429728) in GitLab 18.0. {{< /history >}} When filtering by milestone, in addition to choosing a specific project milestone or group milestone, you can choose a special milestone filter. - **None**: Show issues or merge requests with no assigned milestone. - **Any**: Show issues or merge requests with an assigned milestone. - **Upcoming**: Show issues or merge requests with an open assigned milestone starting in the future. - **Started**: Show issues or merge requests with an open assigned milestone that overlaps with the current date. The list excludes milestones without a defined start and due date.
https://docs.gitlab.com/user/project/burndown_and_burnup_charts
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/burndown_and_burnup_charts.md
2025-08-13
doc/user/project/milestones
[ "doc", "user", "project", "milestones" ]
burndown_and_burnup_charts.md
Plan
Project Management
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Burndown and burnup charts
null
{{< details >}} - Tier: Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} [Burndown](#burndown-charts) and [burnup](#burnup-charts) show progress toward completing a milestone. Burndown charts show the remaining issues (burndown) over the course of a project [milestone](_index.md). Burnup charts show the total number of issues against completed issues. ![burndown and burnup chart](img/burndown_and_burnup_charts_v15_3.png) ### Similarities and differences Burndown and burnup charts share some general features. Both burndown and burnup charts: - Show the total number of issues for each day of the current milestone. - Have a [toggle](#switch-between-number-of-issues-and-issue-weight) between the total number of issues or the total [weight](../issues/issue_weight.md) of issues for each day of the milestone. Differences between burndown and burnup charts are: - Burnup charts contain a separate line representing completed issues over a milestone. - Burnup charts reflect the difference between an issue being moved to another milestone (**Total** issues line goes down) and an issue being closed (**Total** issues line remains unchanged). - Burndown charts measure "total issues minus closed issues" for each day while burnup charts measure the total issues (open and closed) separately from the issues resolved for each day. ### Switch between number of issues and issue weight To switch between the two settings, select either **Issues** or **Issue weight** above the charts. When sorting by weight, make sure all your issues have a weight assigned, because issues with no weight are not represented in the remaining weight totals. ### When to use burndown and burnup charts Burndown and burnup charts provide valuable insights when tracking milestone progress. Their use depends on [how you structure your milestones](_index.md) in your workflow. These charts help teams: - Visualize progress in real time throughout a milestone period. - Identify potential delays early by comparing actual progress to ideal progress. - Communicate status to stakeholders with easy-to-understand visual data. - Make data-driven decisions about resource allocation and prioritization. Use burndown charts to focus on remaining work. Use burnup charts to track both completed work and scope changes over time. Burnup charts are particularly useful for monitoring scope creep (uncontrolled additions to a project's scope) by showing spikes in the chart's total issues. ## Burndown charts Burndown charts show the number of issues over the course of a milestone. ![burndown chart](img/burndown_chart_v15_3.png) At a glance, you see the current state for the completion a given milestone. Without them, you would have to organize the data from the milestone and plot it yourself to have the same sense of progress. GitLab plots it for you and presents it in a clear and beautiful chart. <i class="fa fa-youtube-play youtube" aria-hidden="true"></i> For an overview, check the video demonstration on [Mapping work versus time with burndown charts](https://www.youtube.com/watch?v=zJU2MuRChzs). To view a project's burndown chart: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Plan > Milestones**. 1. Select a milestone from the list. To view a group's burndown chart: 1. On the left sidebar, select **Search or go to** and find your group. 1. Select **Plan > Milestones**. 1. Select a milestone from the list. ### How burndown charts work A burndown chart is available for every project or group milestone that has been attributed a **start date** and a **due date**. {{< alert type="note" >}} You're able to [promote project](_index.md#promote-a-project-milestone-to-a-group-milestone) to group milestones and still see the **burndown chart** for them, respecting license limitations. {{< /alert >}} The chart indicates the project's progress throughout that milestone (for issues assigned to it). In particular, it shows how many issues were or are still open for a given day in the milestone's corresponding period. You can also toggle the burndown chart to display the [cumulative open issue weight](#switch-between-number-of-issues-and-issue-weight) for a given day. ### Fixed burndown charts For milestones created before GitLab 13.6, burndown charts have an additional toggle to switch between Legacy and Fixed views. | Legacy | Fixed | | ----- | ----- | | ![Legacy burndown chart](img/burndown_chart_legacy_v13_6.png) | ![Fixed burndown chart, showing a jump when a lot of issues were added to the milestone](img/burndown_chart_fixed_v13_6.png) | **Fixed burndown** charts track the full history of milestone activity, from its creation until the milestone expires. After the milestone due date passes, issues removed from the milestone no longer affect the chart. **Legacy burndown** charts track when issues were created and when they were last closed, not their full history. For each day, a legacy burndown chart takes the number of open issues and the issues created that day, and subtracts the number of issues closed that day. Issues that were created and assigned a milestone before its start date (and remain open as of the start date) are considered as having been opened on the start date. Therefore, when the milestone start date is changed, the number of opened issues on each day may change. Reopened issues are considered as having been opened on the day after they were last closed. ## Burnup charts Burnup charts show the assigned and completed work for a milestone. ![burnup chart](img/burnup_chart_v15_3.png) To view a project's burnup chart: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Plan > Milestones**. 1. Select a milestone from the list. To view a group's burnup chart: 1. On the left sidebar, select **Search or go to** and find your group. 1. Select **Plan > Milestones**. 1. Select a milestone from the list. ### How burnup charts work Burnup charts have separate lines for total work and completed work: - The **Total** line reflects changes to the scope of a milestone by measuring the number of issues assigned to that milestone. - The **Completed** line measures that milestone's number of closed issues. When an open issue is moved to another milestone, the **Total** line goes down but the **Completed** line stays the same. The **Completed** line remains unchanged because it only tracks issues that are closed. When an issue is closed, the **Total** line remains the same and the **Completed** line goes up. ## Roll up weights {{< details >}} - Offering: GitLab Self-Managed {{< /details >}} {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/381879) in GitLab 17.1 [with a flag](../../../administration/feature_flags/_index.md) named `rollup_timebox_chart`. Disabled by default. {{< /history >}} {{< alert type="flag" >}} On GitLab Self-Managed, by default this feature is not available. For more information, see the history. This feature is available for testing, but not ready for production use. {{< /alert >}} With [tasks](../../tasks.md), a more granular planning is possible. If this feature is enabled, the weight of issues that have tasks is derived from the tasks in the same milestone. Issues with tasks are not counted separately in burndown or burnup charts. How issue weight is counted in charts: - If an issue's tasks do not have weights assigned, the issue's weight is used instead. - If an issue has multiple tasks, and some tasks are completed in a prior iteration, only tasks in this iteration are shown and counted. - If a task is directly assigned to an iteration, without its parent, it's the top level item and contributes its own weight. The parent issue is not shown. ### Weight rollup examples **Example 1** - Issue has weight 5 and is assigned to Milestone 2. - Task 1 has weight 2 and is assigned to Milestone 1. - Task 2 has weight 2 and is assigned to Milestone 2. - Task 3 has weight 2 and is assigned to Milestone 2. The charts for Milestone 1 would show Task 1 as having weight 2. The charts for Milestone 2 would show Issue as having weight 4. **Example 2** - Issue has weight 5 and is assigned to Milestone 2. - Task 1 is assigned to Milestone 1 without any weight. - Task 2 is assigned to Milestone 2 without any weight. - Task 3 is assigned to Milestone 2 without any weight. The charts for Milestone 1 would show Task 1 as having weight 0. The charts for Milestone 2 would show Issue as having weight 5. **Example 3** - Issue is assigned to Milestone 2 without any weight. - Task 1 has weight 2 and is assigned to Milestone 1 - Task 2 has weight 2 and is assigned to Milestone 2 - Task 3 has weight 2 and is assigned to Milestone 2 The charts for Milestone 1 would show Task 1 as having weight 2. The charts for Milestone 2 would show Issue as having weight 4. ## Troubleshooting ### Burndown and burnup charts do not show the correct issue status A limitation of these charts is that [the days are in the UTC time zone](https://gitlab.com/gitlab-org/gitlab/-/issues/267967). This can cause the graphs to be inaccurate in other timezones. For example: - All the issues in a milestone are recorded as being closed on or before the last day. - One issue was closed on the last day at 6 PM PST (Pacific time), which is UTC-7. - The issue activity log displays the closure time at 6 PM on the last day of the milestone. - The charts plot the time in UTC, so for this issue, the close time is 1 AM the following day. - The charts show the milestone as incomplete and missing one closed issue.
--- stage: Plan group: Project Management info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments title: Burndown and burnup charts breadcrumbs: - doc - user - project - milestones --- {{< details >}} - Tier: Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} [Burndown](#burndown-charts) and [burnup](#burnup-charts) show progress toward completing a milestone. Burndown charts show the remaining issues (burndown) over the course of a project [milestone](_index.md). Burnup charts show the total number of issues against completed issues. ![burndown and burnup chart](img/burndown_and_burnup_charts_v15_3.png) ### Similarities and differences Burndown and burnup charts share some general features. Both burndown and burnup charts: - Show the total number of issues for each day of the current milestone. - Have a [toggle](#switch-between-number-of-issues-and-issue-weight) between the total number of issues or the total [weight](../issues/issue_weight.md) of issues for each day of the milestone. Differences between burndown and burnup charts are: - Burnup charts contain a separate line representing completed issues over a milestone. - Burnup charts reflect the difference between an issue being moved to another milestone (**Total** issues line goes down) and an issue being closed (**Total** issues line remains unchanged). - Burndown charts measure "total issues minus closed issues" for each day while burnup charts measure the total issues (open and closed) separately from the issues resolved for each day. ### Switch between number of issues and issue weight To switch between the two settings, select either **Issues** or **Issue weight** above the charts. When sorting by weight, make sure all your issues have a weight assigned, because issues with no weight are not represented in the remaining weight totals. ### When to use burndown and burnup charts Burndown and burnup charts provide valuable insights when tracking milestone progress. Their use depends on [how you structure your milestones](_index.md) in your workflow. These charts help teams: - Visualize progress in real time throughout a milestone period. - Identify potential delays early by comparing actual progress to ideal progress. - Communicate status to stakeholders with easy-to-understand visual data. - Make data-driven decisions about resource allocation and prioritization. Use burndown charts to focus on remaining work. Use burnup charts to track both completed work and scope changes over time. Burnup charts are particularly useful for monitoring scope creep (uncontrolled additions to a project's scope) by showing spikes in the chart's total issues. ## Burndown charts Burndown charts show the number of issues over the course of a milestone. ![burndown chart](img/burndown_chart_v15_3.png) At a glance, you see the current state for the completion a given milestone. Without them, you would have to organize the data from the milestone and plot it yourself to have the same sense of progress. GitLab plots it for you and presents it in a clear and beautiful chart. <i class="fa fa-youtube-play youtube" aria-hidden="true"></i> For an overview, check the video demonstration on [Mapping work versus time with burndown charts](https://www.youtube.com/watch?v=zJU2MuRChzs). To view a project's burndown chart: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Plan > Milestones**. 1. Select a milestone from the list. To view a group's burndown chart: 1. On the left sidebar, select **Search or go to** and find your group. 1. Select **Plan > Milestones**. 1. Select a milestone from the list. ### How burndown charts work A burndown chart is available for every project or group milestone that has been attributed a **start date** and a **due date**. {{< alert type="note" >}} You're able to [promote project](_index.md#promote-a-project-milestone-to-a-group-milestone) to group milestones and still see the **burndown chart** for them, respecting license limitations. {{< /alert >}} The chart indicates the project's progress throughout that milestone (for issues assigned to it). In particular, it shows how many issues were or are still open for a given day in the milestone's corresponding period. You can also toggle the burndown chart to display the [cumulative open issue weight](#switch-between-number-of-issues-and-issue-weight) for a given day. ### Fixed burndown charts For milestones created before GitLab 13.6, burndown charts have an additional toggle to switch between Legacy and Fixed views. | Legacy | Fixed | | ----- | ----- | | ![Legacy burndown chart](img/burndown_chart_legacy_v13_6.png) | ![Fixed burndown chart, showing a jump when a lot of issues were added to the milestone](img/burndown_chart_fixed_v13_6.png) | **Fixed burndown** charts track the full history of milestone activity, from its creation until the milestone expires. After the milestone due date passes, issues removed from the milestone no longer affect the chart. **Legacy burndown** charts track when issues were created and when they were last closed, not their full history. For each day, a legacy burndown chart takes the number of open issues and the issues created that day, and subtracts the number of issues closed that day. Issues that were created and assigned a milestone before its start date (and remain open as of the start date) are considered as having been opened on the start date. Therefore, when the milestone start date is changed, the number of opened issues on each day may change. Reopened issues are considered as having been opened on the day after they were last closed. ## Burnup charts Burnup charts show the assigned and completed work for a milestone. ![burnup chart](img/burnup_chart_v15_3.png) To view a project's burnup chart: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Plan > Milestones**. 1. Select a milestone from the list. To view a group's burnup chart: 1. On the left sidebar, select **Search or go to** and find your group. 1. Select **Plan > Milestones**. 1. Select a milestone from the list. ### How burnup charts work Burnup charts have separate lines for total work and completed work: - The **Total** line reflects changes to the scope of a milestone by measuring the number of issues assigned to that milestone. - The **Completed** line measures that milestone's number of closed issues. When an open issue is moved to another milestone, the **Total** line goes down but the **Completed** line stays the same. The **Completed** line remains unchanged because it only tracks issues that are closed. When an issue is closed, the **Total** line remains the same and the **Completed** line goes up. ## Roll up weights {{< details >}} - Offering: GitLab Self-Managed {{< /details >}} {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/381879) in GitLab 17.1 [with a flag](../../../administration/feature_flags/_index.md) named `rollup_timebox_chart`. Disabled by default. {{< /history >}} {{< alert type="flag" >}} On GitLab Self-Managed, by default this feature is not available. For more information, see the history. This feature is available for testing, but not ready for production use. {{< /alert >}} With [tasks](../../tasks.md), a more granular planning is possible. If this feature is enabled, the weight of issues that have tasks is derived from the tasks in the same milestone. Issues with tasks are not counted separately in burndown or burnup charts. How issue weight is counted in charts: - If an issue's tasks do not have weights assigned, the issue's weight is used instead. - If an issue has multiple tasks, and some tasks are completed in a prior iteration, only tasks in this iteration are shown and counted. - If a task is directly assigned to an iteration, without its parent, it's the top level item and contributes its own weight. The parent issue is not shown. ### Weight rollup examples **Example 1** - Issue has weight 5 and is assigned to Milestone 2. - Task 1 has weight 2 and is assigned to Milestone 1. - Task 2 has weight 2 and is assigned to Milestone 2. - Task 3 has weight 2 and is assigned to Milestone 2. The charts for Milestone 1 would show Task 1 as having weight 2. The charts for Milestone 2 would show Issue as having weight 4. **Example 2** - Issue has weight 5 and is assigned to Milestone 2. - Task 1 is assigned to Milestone 1 without any weight. - Task 2 is assigned to Milestone 2 without any weight. - Task 3 is assigned to Milestone 2 without any weight. The charts for Milestone 1 would show Task 1 as having weight 0. The charts for Milestone 2 would show Issue as having weight 5. **Example 3** - Issue is assigned to Milestone 2 without any weight. - Task 1 has weight 2 and is assigned to Milestone 1 - Task 2 has weight 2 and is assigned to Milestone 2 - Task 3 has weight 2 and is assigned to Milestone 2 The charts for Milestone 1 would show Task 1 as having weight 2. The charts for Milestone 2 would show Issue as having weight 4. ## Troubleshooting ### Burndown and burnup charts do not show the correct issue status A limitation of these charts is that [the days are in the UTC time zone](https://gitlab.com/gitlab-org/gitlab/-/issues/267967). This can cause the graphs to be inaccurate in other timezones. For example: - All the issues in a milestone are recorded as being closed on or before the last day. - One issue was closed on the last day at 6 PM PST (Pacific time), which is UTC-7. - The issue activity log displays the closure time at 6 PM on the last day of the milestone. - The charts plot the time in UTC, so for this issue, the close time is 1 AM the following day. - The charts show the milestone as incomplete and missing one closed issue.
https://docs.gitlab.com/user/project/insights
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/_index.md
2025-08-13
doc/user/project/insights
[ "doc", "user", "project", "insights" ]
_index.md
Plan
Optimize
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Insights
null
{{< details >}} - Tier: Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} Insights are interactive bar charts that display the number of items (for example, bugs created) per month. Configure insights and create custom reports for your projects and groups to explore data such as: - Issues created and closed during a specified period. - Average time for merge requests to be merged. - Triage hygiene. ## View insights Prerequisites: - For project insights, you must have access to the project and permission to view information about its merge requests and issues. - For group insights, you must have permission to view the group. To view insights for a project or group: 1. On the left sidebar, select **Search or go to** and find your project or group. 1. Select **Analyze > Insights**. 1. To view a report, from the **Select report** dropdown list, select the report you want to view. To view annotations, hover over each bar in the chart. 1. Optional. Filter the results: - To display data only from a subset of the 90-day range, select the pause icons ({{< icon name="status-paused" >}}) and slide them along the horizontal axis. - To exclude a dimension from the chart, from the legend below the chart, select the name of the dimension. ### Drill down on charts {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/372215/) in GitLab 16.7. - [Changed](https://gitlab.com/gitlab-org/gitlab/-/issues/436704) to extend support to all `issuables` charts in GitLab 16.9. {{< /history >}} You can drill down into the data of all charts whose `query.data_source` is `issuables`. To view a drill-down report of the data for a specific priority or severity in a month: - On the chart, select the bar stack you want to drill down on. ### Create a report deep link You can direct users to a specific report in insights by using the deep-linked URL. To create a deep link, append the report key to the end of the insights report URL. For example, a GitLab report with the key `bugsCharts` has the deep link URL `https://gitlab.com/gitlab-org/gitlab/insights/#/bugsCharts`. ## Configuration ### Default file GitLab reads insights from the [default configuration file](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/fixtures/insights/default.yml). Project insights are configured with the [`.gitlab/insights.yml`](#configuration) file in the project. If a project doesn't have a configuration file, it uses the [group configuration](#for-groups). The `.gitlab/insights.yml` file is a YAML file where you define: - The structure and order of charts in a report. - The style of charts displayed in the report of your project or group. In the `.gitlab/insights.yml` file: - [Configuration parameters](#parameters) define the chart behavior. - Each report has a unique key and a collection of charts to fetch and display. - Each chart definition is made up of a hash composed of key-value pairs. #### Example The following example shows a single definition that displays a report with one chart: ```yaml bugsCharts: title: "Charts for bugs" charts: - title: "Monthly bugs created" description: "Open bugs created per month" type: bar query: data_source: issuables params: issuable_type: issue issuable_state: opened filter_labels: - bug group_by: month period_limit: 24 ``` The following example shows a complete configuration for a `.gitlab/insights.yml` file that displays three charts: ```yaml .projectsOnly: &projectsOnly projects: only: - 3 - groupA/projectA - groupA/subgroupB/projectC bugsCharts: title: "Charts for bugs" charts: - title: "Monthly bugs created" description: "Open bugs created per month" type: bar <<: *projectsOnly query: data_source: issuables params: issuable_type: issue issuable_state: opened filter_labels: - bug group_by: month period_limit: 24 - title: "Weekly bugs by severity" type: stacked-bar <<: *projectsOnly query: data_source: issuables params: issuable_type: issue issuable_state: opened filter_labels: - bug collection_labels: - S1 - S2 - S3 - S4 group_by: week period_limit: 104 - title: "Monthly bugs by team" type: line <<: *projectsOnly query: data_source: issuables params: issuable_type: merge_request issuable_state: opened filter_labels: - bug collection_labels: - Manage - Plan - Create group_by: month period_limit: 24 ``` ### Parameters The following table lists the chart parameters: | Keyword | Description | |:---------------------------------------------------|:------------| | [`title`](#title) | The title of the chart. This displays on the Insights page. | | [`description`](#description) | A description for the individual chart. This displays above the relevant chart. | | [`type`](#type) | The type of chart: `bar`, `line` or `stacked-bar`. | | [`query`](#query) | A hash that defines the data source and filtering conditions for the chart. | #### `title` Use `title` to update the chart title. The title displays on the insights report. **Example**: ```yaml monthlyBugsCreated: title: "Monthly bugs created" ``` #### `description` Use `description` to add a description of the chart. The description displays above the chart, below the title. **Example**: ```yaml monthlyBugsCreated: title: "Monthly bugs created" description: "Open bugs created per month" ``` #### `type` Use `type` to define the chart type. **Supported values**: | Name | Example: | | ----- | ------- | | `bar` | ![Insights example bar chart](img/insights_example_bar_chart_v11_10.png) | | `bar` (time series with `group_by`) | ![Insights example bar time series chart](img/insights_example_bar_time_series_chart_v11_10.png) | | `line` | ![Insights example stacked bar chart](img/insights_example_line_chart_v11_10.png) | | `stacked-bar` | ![Insights example stacked bar chart](img/insights_example_stacked_bar_chart_v11_10.png) | The `dora` data source supports the `bar` and `line` [chart types](#type). **Example**: ```yaml monthlyBugsCreated: title: "Monthly bugs created" type: bar ``` #### `query` Use `query` to define the data source and filtering conditions for the chart. **Example**: ```yaml monthlyBugsCreated: title: "Monthly bugs created" description: "Open bugs created per month" type: bar query: data_source: issuables params: issuable_type: issue issuable_state: opened filter_labels: - bug collection_labels: - S1 - S2 - S3 - S4 group_by: week period_limit: 104 ``` The legacy format without the `data_source` parameter is still supported: ```yaml monthlyBugsCreated: title: "Monthly bugs created" description: "Open bugs created per month" type: bar query: issuable_type: issue issuable_state: opened filter_labels: - bug collection_labels: - S1 - S2 - S3 - S4 group_by: week period_limit: 104 ``` ##### `query.data_source` Use `data_source` to define the data source that exposes the data. **Supported values**: - `issuables`: Exposes merge request or issue data. - `dora`: Exposes DORA metrics. ##### `issuable` query parameters ###### `query.params.issuable_type` Use `query.params.issuable_type` to define the type of issuable to create a chart for. **Supported values**: - `issue`: The chart displays issues' data. - `merge_request`: The chart displays merge requests' data. ###### `query.params.issuable_state` Use `query.params.issuable_state` to filter by the current state of the queried issuable. By default, the `opened` state filter is applied. **Supported values**: - `opened`: Open issues or merge requests. - `closed`: Closed issues or merge requests. - `locked`: Issues or merge requests that have their discussion locked. - `merged`: Merged merge requests. - `all`: Issues or merge requests in all states. ###### `query.params.filter_labels` Use `query.params.filter_labels` to filter by labels applied to the queried issuable. By default, no label filter is applied. All defined labels must be applied to the issuable for it to be selected. **Example**: ```yaml monthlyBugsCreated: title: "Monthly regressions created" type: bar query: data_source: issuables params: issuable_type: issue issuable_state: opened filter_labels: - bug - regression ``` ###### `query.params.collection_labels` Use `query.params.collection_labels` to group issuables by the configured labels. Grouping is not applied by default. **Example**: ```yaml weeklyBugsBySeverity: title: "Weekly bugs by severity" type: stacked-bar query: data_source: issuables params: issuable_type: issue issuable_state: opened filter_labels: - bug collection_labels: - S1 - S2 - S3 - S4 ``` ###### `query.group_by` Use `query.group_by` to define the X-axis of the chart. **Supported values**: - `day`: Group data per day. - `week`: Group data per week. - `month`: Group data per month. ###### `query.period_limit` Use `query.period_limit` to define how far back in time to query issuables (using the `query.period_field`). The unit is related to the value defined in `query.group_by`. For example, if you defined `query.group_by: 'day'`, and `query.period_limit: 365`, the chart displays data from the last 365 days. By default, default values are applied depending on the `query.group_by` you defined. | `query.group_by` | Default value | | ---------------- | ------------- | | `day` | 30 | | `week` | 4 | | `month` | 12 | ##### `query.period_field` Use `query.period_field` to define the timestamp field by which to group issuables. **Supported values**: - `created_at` (default): Group data using the `created_at` field. - `closed_at`: Group data using the `closed_at` field (for issues only). - `merged_at`: Group data using the `merged_at` field (for merge requests only). The `period_field` is automatically set to: - `closed_at` if `query.issuable_state` is `closed` - `merged_at` if `query.issuable_state` is `merged` - `created_at` otherwise {{< alert type="note" >}} Until [this bug](https://gitlab.com/gitlab-org/gitlab/-/issues/26911), is resolved, you may see `created_at` in place of `merged_at`. `created_at` is used instead. {{< /alert >}} ##### `DORA` query parameters Use DORA-specific queries with the `dora` data source to create a DORA chart definition. **Example**: ```yaml dora: title: "DORA charts" charts: - title: "DORA deployment frequency" type: bar # or line query: data_source: dora params: metric: deployment_frequency group_by: day period_limit: 10 projects: only: - 38 - title: "DORA lead time for changes" description: "DORA lead time for changes" type: bar query: data_source: dora params: metric: lead_time_for_changes group_by: day environment_tiers: - staging period_limit: 30 ``` ###### `query.metric` Use `query.metric` to define the [DORA metrics](../../../api/dora/metrics.md#the-value-field) to query. **Supported values**: - `deployment_frequency` (default) - `lead_time_for_changes` - `time_to_restore_service` - `change_failure_rate` ###### `query.group_by` Use `query.group_by` to define the X-axis of your chart. **Supported values**: - `day` (default): Group data per day. - `month`: Group data per month. ###### `query.period_limit` Use `query.period_limit` to define how far the metrics are queried in the past (default: 15). The maximum period is 180 days or 6 months. ###### `query.environment_tiers` Use `query.environment_tiers` to define an array of environments to include the calculation. **Supported values**: - `production`(default) - `staging` - `testing` - `development` - `other` #### `projects` Use `projects` to limit where issuables are queried from: - If `.gitlab/insights.yml` is used for a group's insights, use `projects` to define the projects from which to query issuables. By default, all projects under the group are used. - If `.gitlab/insights.yml` is used for a project's insights, specifying other projects does not yield results. By default, the project is used. ##### `projects.only` Use `projects.only` to specify the projects from which issuables are queried. Projects listed in this parameter are ignored when: - They don't exist. - The current user doesn't have sufficient permissions to read them. - They are outside the group. **Example**: ```yaml monthlyBugsCreated: title: "Monthly bugs created" description: "Open bugs created per month" type: bar query: data_source: issuables params: issuable_type: issue issuable_state: opened filter_labels: - bug projects: only: - 3 # You can use the project ID - groupA/projectA # Or full project path - groupA/subgroupB/projectC # Projects in subgroups can be included - groupB/project # Projects outside the group will be ignored ``` ### Configure insights You can configure insights for projects and groups. After you create a `.gitlab/insights.yml` file in a project, you can also use it for the project's group. {{< alert type="note" >}} A custom `.gitlab/insights.yml` file overrides the default configuration. To retain the original configuration, copy the content of the [default configuration file](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/fixtures/insights/default.yml) as a base. {{< /alert >}} #### For projects Prerequisites: - You must have at least the Developer role for the project. To configure project insights, create a file `.gitlab/insights.yml` either: - Locally, in the root directory of your project, and push your changes. - From the UI: 1. On the left sidebar, select **Search or go to** and find your project. 1. Above the file list, select the branch you want to commit to, select the plus icon, then select **New file**. 1. For the **Filename**, enter `.gitlab/insights.yml`. 1. In the file editor, enter the configuration. See a [configuration example](#example). 1. Select **Commit changes**. #### For groups Prerequisites: - A project in your group must have a `.gitlab/insights.yml` file. To configure group insights: 1. On the left sidebar, select **Search or go to** and find your group. 1. Select **Settings > Analytics**. 1. In the **Insights** section, select a project that contains the `.gitlab/insights.yml` configuration file. 1. Select **Save changes**.
--- stage: Plan group: Optimize info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments title: Insights breadcrumbs: - doc - user - project - insights --- {{< details >}} - Tier: Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} Insights are interactive bar charts that display the number of items (for example, bugs created) per month. Configure insights and create custom reports for your projects and groups to explore data such as: - Issues created and closed during a specified period. - Average time for merge requests to be merged. - Triage hygiene. ## View insights Prerequisites: - For project insights, you must have access to the project and permission to view information about its merge requests and issues. - For group insights, you must have permission to view the group. To view insights for a project or group: 1. On the left sidebar, select **Search or go to** and find your project or group. 1. Select **Analyze > Insights**. 1. To view a report, from the **Select report** dropdown list, select the report you want to view. To view annotations, hover over each bar in the chart. 1. Optional. Filter the results: - To display data only from a subset of the 90-day range, select the pause icons ({{< icon name="status-paused" >}}) and slide them along the horizontal axis. - To exclude a dimension from the chart, from the legend below the chart, select the name of the dimension. ### Drill down on charts {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/372215/) in GitLab 16.7. - [Changed](https://gitlab.com/gitlab-org/gitlab/-/issues/436704) to extend support to all `issuables` charts in GitLab 16.9. {{< /history >}} You can drill down into the data of all charts whose `query.data_source` is `issuables`. To view a drill-down report of the data for a specific priority or severity in a month: - On the chart, select the bar stack you want to drill down on. ### Create a report deep link You can direct users to a specific report in insights by using the deep-linked URL. To create a deep link, append the report key to the end of the insights report URL. For example, a GitLab report with the key `bugsCharts` has the deep link URL `https://gitlab.com/gitlab-org/gitlab/insights/#/bugsCharts`. ## Configuration ### Default file GitLab reads insights from the [default configuration file](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/fixtures/insights/default.yml). Project insights are configured with the [`.gitlab/insights.yml`](#configuration) file in the project. If a project doesn't have a configuration file, it uses the [group configuration](#for-groups). The `.gitlab/insights.yml` file is a YAML file where you define: - The structure and order of charts in a report. - The style of charts displayed in the report of your project or group. In the `.gitlab/insights.yml` file: - [Configuration parameters](#parameters) define the chart behavior. - Each report has a unique key and a collection of charts to fetch and display. - Each chart definition is made up of a hash composed of key-value pairs. #### Example The following example shows a single definition that displays a report with one chart: ```yaml bugsCharts: title: "Charts for bugs" charts: - title: "Monthly bugs created" description: "Open bugs created per month" type: bar query: data_source: issuables params: issuable_type: issue issuable_state: opened filter_labels: - bug group_by: month period_limit: 24 ``` The following example shows a complete configuration for a `.gitlab/insights.yml` file that displays three charts: ```yaml .projectsOnly: &projectsOnly projects: only: - 3 - groupA/projectA - groupA/subgroupB/projectC bugsCharts: title: "Charts for bugs" charts: - title: "Monthly bugs created" description: "Open bugs created per month" type: bar <<: *projectsOnly query: data_source: issuables params: issuable_type: issue issuable_state: opened filter_labels: - bug group_by: month period_limit: 24 - title: "Weekly bugs by severity" type: stacked-bar <<: *projectsOnly query: data_source: issuables params: issuable_type: issue issuable_state: opened filter_labels: - bug collection_labels: - S1 - S2 - S3 - S4 group_by: week period_limit: 104 - title: "Monthly bugs by team" type: line <<: *projectsOnly query: data_source: issuables params: issuable_type: merge_request issuable_state: opened filter_labels: - bug collection_labels: - Manage - Plan - Create group_by: month period_limit: 24 ``` ### Parameters The following table lists the chart parameters: | Keyword | Description | |:---------------------------------------------------|:------------| | [`title`](#title) | The title of the chart. This displays on the Insights page. | | [`description`](#description) | A description for the individual chart. This displays above the relevant chart. | | [`type`](#type) | The type of chart: `bar`, `line` or `stacked-bar`. | | [`query`](#query) | A hash that defines the data source and filtering conditions for the chart. | #### `title` Use `title` to update the chart title. The title displays on the insights report. **Example**: ```yaml monthlyBugsCreated: title: "Monthly bugs created" ``` #### `description` Use `description` to add a description of the chart. The description displays above the chart, below the title. **Example**: ```yaml monthlyBugsCreated: title: "Monthly bugs created" description: "Open bugs created per month" ``` #### `type` Use `type` to define the chart type. **Supported values**: | Name | Example: | | ----- | ------- | | `bar` | ![Insights example bar chart](img/insights_example_bar_chart_v11_10.png) | | `bar` (time series with `group_by`) | ![Insights example bar time series chart](img/insights_example_bar_time_series_chart_v11_10.png) | | `line` | ![Insights example stacked bar chart](img/insights_example_line_chart_v11_10.png) | | `stacked-bar` | ![Insights example stacked bar chart](img/insights_example_stacked_bar_chart_v11_10.png) | The `dora` data source supports the `bar` and `line` [chart types](#type). **Example**: ```yaml monthlyBugsCreated: title: "Monthly bugs created" type: bar ``` #### `query` Use `query` to define the data source and filtering conditions for the chart. **Example**: ```yaml monthlyBugsCreated: title: "Monthly bugs created" description: "Open bugs created per month" type: bar query: data_source: issuables params: issuable_type: issue issuable_state: opened filter_labels: - bug collection_labels: - S1 - S2 - S3 - S4 group_by: week period_limit: 104 ``` The legacy format without the `data_source` parameter is still supported: ```yaml monthlyBugsCreated: title: "Monthly bugs created" description: "Open bugs created per month" type: bar query: issuable_type: issue issuable_state: opened filter_labels: - bug collection_labels: - S1 - S2 - S3 - S4 group_by: week period_limit: 104 ``` ##### `query.data_source` Use `data_source` to define the data source that exposes the data. **Supported values**: - `issuables`: Exposes merge request or issue data. - `dora`: Exposes DORA metrics. ##### `issuable` query parameters ###### `query.params.issuable_type` Use `query.params.issuable_type` to define the type of issuable to create a chart for. **Supported values**: - `issue`: The chart displays issues' data. - `merge_request`: The chart displays merge requests' data. ###### `query.params.issuable_state` Use `query.params.issuable_state` to filter by the current state of the queried issuable. By default, the `opened` state filter is applied. **Supported values**: - `opened`: Open issues or merge requests. - `closed`: Closed issues or merge requests. - `locked`: Issues or merge requests that have their discussion locked. - `merged`: Merged merge requests. - `all`: Issues or merge requests in all states. ###### `query.params.filter_labels` Use `query.params.filter_labels` to filter by labels applied to the queried issuable. By default, no label filter is applied. All defined labels must be applied to the issuable for it to be selected. **Example**: ```yaml monthlyBugsCreated: title: "Monthly regressions created" type: bar query: data_source: issuables params: issuable_type: issue issuable_state: opened filter_labels: - bug - regression ``` ###### `query.params.collection_labels` Use `query.params.collection_labels` to group issuables by the configured labels. Grouping is not applied by default. **Example**: ```yaml weeklyBugsBySeverity: title: "Weekly bugs by severity" type: stacked-bar query: data_source: issuables params: issuable_type: issue issuable_state: opened filter_labels: - bug collection_labels: - S1 - S2 - S3 - S4 ``` ###### `query.group_by` Use `query.group_by` to define the X-axis of the chart. **Supported values**: - `day`: Group data per day. - `week`: Group data per week. - `month`: Group data per month. ###### `query.period_limit` Use `query.period_limit` to define how far back in time to query issuables (using the `query.period_field`). The unit is related to the value defined in `query.group_by`. For example, if you defined `query.group_by: 'day'`, and `query.period_limit: 365`, the chart displays data from the last 365 days. By default, default values are applied depending on the `query.group_by` you defined. | `query.group_by` | Default value | | ---------------- | ------------- | | `day` | 30 | | `week` | 4 | | `month` | 12 | ##### `query.period_field` Use `query.period_field` to define the timestamp field by which to group issuables. **Supported values**: - `created_at` (default): Group data using the `created_at` field. - `closed_at`: Group data using the `closed_at` field (for issues only). - `merged_at`: Group data using the `merged_at` field (for merge requests only). The `period_field` is automatically set to: - `closed_at` if `query.issuable_state` is `closed` - `merged_at` if `query.issuable_state` is `merged` - `created_at` otherwise {{< alert type="note" >}} Until [this bug](https://gitlab.com/gitlab-org/gitlab/-/issues/26911), is resolved, you may see `created_at` in place of `merged_at`. `created_at` is used instead. {{< /alert >}} ##### `DORA` query parameters Use DORA-specific queries with the `dora` data source to create a DORA chart definition. **Example**: ```yaml dora: title: "DORA charts" charts: - title: "DORA deployment frequency" type: bar # or line query: data_source: dora params: metric: deployment_frequency group_by: day period_limit: 10 projects: only: - 38 - title: "DORA lead time for changes" description: "DORA lead time for changes" type: bar query: data_source: dora params: metric: lead_time_for_changes group_by: day environment_tiers: - staging period_limit: 30 ``` ###### `query.metric` Use `query.metric` to define the [DORA metrics](../../../api/dora/metrics.md#the-value-field) to query. **Supported values**: - `deployment_frequency` (default) - `lead_time_for_changes` - `time_to_restore_service` - `change_failure_rate` ###### `query.group_by` Use `query.group_by` to define the X-axis of your chart. **Supported values**: - `day` (default): Group data per day. - `month`: Group data per month. ###### `query.period_limit` Use `query.period_limit` to define how far the metrics are queried in the past (default: 15). The maximum period is 180 days or 6 months. ###### `query.environment_tiers` Use `query.environment_tiers` to define an array of environments to include the calculation. **Supported values**: - `production`(default) - `staging` - `testing` - `development` - `other` #### `projects` Use `projects` to limit where issuables are queried from: - If `.gitlab/insights.yml` is used for a group's insights, use `projects` to define the projects from which to query issuables. By default, all projects under the group are used. - If `.gitlab/insights.yml` is used for a project's insights, specifying other projects does not yield results. By default, the project is used. ##### `projects.only` Use `projects.only` to specify the projects from which issuables are queried. Projects listed in this parameter are ignored when: - They don't exist. - The current user doesn't have sufficient permissions to read them. - They are outside the group. **Example**: ```yaml monthlyBugsCreated: title: "Monthly bugs created" description: "Open bugs created per month" type: bar query: data_source: issuables params: issuable_type: issue issuable_state: opened filter_labels: - bug projects: only: - 3 # You can use the project ID - groupA/projectA # Or full project path - groupA/subgroupB/projectC # Projects in subgroups can be included - groupB/project # Projects outside the group will be ignored ``` ### Configure insights You can configure insights for projects and groups. After you create a `.gitlab/insights.yml` file in a project, you can also use it for the project's group. {{< alert type="note" >}} A custom `.gitlab/insights.yml` file overrides the default configuration. To retain the original configuration, copy the content of the [default configuration file](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/fixtures/insights/default.yml) as a base. {{< /alert >}} #### For projects Prerequisites: - You must have at least the Developer role for the project. To configure project insights, create a file `.gitlab/insights.yml` either: - Locally, in the root directory of your project, and push your changes. - From the UI: 1. On the left sidebar, select **Search or go to** and find your project. 1. Above the file list, select the branch you want to commit to, select the plus icon, then select **New file**. 1. For the **Filename**, enter `.gitlab/insights.yml`. 1. In the file editor, enter the configuration. See a [configuration example](#example). 1. Select **Commit changes**. #### For groups Prerequisites: - A project in your group must have a `.gitlab/insights.yml` file. To configure group insights: 1. On the left sidebar, select **Search or go to** and find your group. 1. Select **Settings > Analytics**. 1. In the **Insights** section, select a project that contains the `.gitlab/insights.yml` configuration file. 1. Select **Save changes**.
https://docs.gitlab.com/user/project/troubleshooting
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/troubleshooting.md
2025-08-13
doc/user/project/codeowners
[ "doc", "user", "project", "codeowners" ]
troubleshooting.md
Create
Source Code
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Troubleshooting Code Owners
Use Code Owners to define experts for your codebase, and set review requirements based on file type or location.
{{< details >}} - Tier: Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} When working with Code Owners, you might encounter the following issues. For more information about how the Code Owners feature handles errors, see [Error handling](advanced.md#error-handling). ## Validate your CODEOWNERS file {{< history >}} - [Introduced](https://gitlab.com/groups/gitlab-org/-/epics/15598) in GitLab 17.11 [with a flag](../../../administration/feature_flags/_index.md) named `accessible_code_owners_validation`. Disabled by default. - [Enabled on GitLab.com](https://gitlab.com/gitlab-org/gitlab/-/issues/524437) in GitLab 18.1. - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/issues/549626) in GitLab 18.2. Feature flag `accessible_code_owners_validation` removed. {{< /history >}} {{< alert type="flag" >}} The availability of this feature is controlled by a feature flag. For more information, see the history. {{< /alert >}} When viewing a [`CODEOWNERS` file](_index.md#codeowners-file), GitLab runs validations to help you find syntax and permission issues. If no syntax issues are found, GitLab: - Does not run more validators against the file. - Runs more permissions validations against the first 200 unique user and group references found in the file. How this works: 1. Find all references that can access the project. If a user or group reference is added, but does not have project access, show an error. 1. For each valid user reference, check that the user has permission to approve merge requests in the project. If the user does not have that permission, show an error. 1. For each valid group reference, check that the maximum role value is Developer or higher. For each group reference that has a value lower than Developer, show an error. 1. For each valid group reference, check that they group contains at least one user with permission to approve merge requests. For any group reference containing zero users with permission to approve merge requests, show an error. ## Approvals do not show The [`CODEOWNERS` file](_index.md#codeowners-file) must be present in the target branch before the merge request is created. Code Owner approval rules only update when the merge request is created. If you update the `CODEOWNERS` file, close the merge request and create a new one. ## Approvals shown as optional A Code Owner approval rule is optional if any of these conditions are true: - The user or group is not a member of the project. Code Owners [cannot inherit members from parent groups](https://gitlab.com/gitlab-org/gitlab/-/issues/288851/). - The user or group is [malformed or inaccessible](advanced.md#malformed-owners). - [Code Owner approval on a protected branch](../repository/branches/protected.md#require-code-owner-approval) has not been set up. - The section is [marked as optional](reference.md#optional-sections). - No eligible code owners are available to approve the merge request due to conflicts with other [merge request approval settings](../merge_requests/approvals/settings.md). ## User not shown as possible approver A user might not show as an approver on the Code Owner merge request approval rules if any of these conditions are true: - A rule prevents the specific user from approving the merge request. Check the project [merge request approval](../merge_requests/approvals/settings.md#edit-merge-request-approval-settings) settings. - A Code Owner group has a visibility of private, and the current user is not a member of the Code Owner group. - The specific username is spelled incorrectly or [malformed in the `CODEOWNERS` file](advanced.md#malformed-owners). - Current user is an external user who does not have permission to the internal Code Owner group. ## User or group not visible when viewing directory Code Owners Code Owners might not show the intended user or group based on your configured rules when viewing a directory, but correctly show the Code Owners for files beneath the directory. For example: ```plaintext * @dev-team docs/ @tech-writer-team ``` All files beneath the `docs/` directory show `@tech-writer-team` as Code Owners, but the directory itself shows `@dev-team`. This behavior occurs when viewing a directory because the [syntax rule](reference.md#directory-paths) applies to all files beneath the directory, which does not include the directory itself. To resolve this, update the `CODEOWNERS` file to include the directory specifically along with all files beneath the directory. For example: ```plaintext * @dev-team docs @tech-writer-team docs/ @tech-writer-team ``` ## Approval rule is invalid You might get an error that states: ```plaintext Approval rule is invalid. GitLab has approved this rule automatically to unblock the merge request. ``` This issue occurs when an approval rule uses a Code Owner that is not a direct member of the project. The workaround is to check that the group or user has been invited to the project. ## `CODEOWNERS` not updated when user or group names change When a user or group change their names, the `CODEOWNERS` isn't automatically updated with the new names. To enter the new names, you must edit the file. Organizations using SAML SSO can [set usernames](../../../integration/saml.md#set-a-username) to prevent users from changing their usernames. ## Incompatibility with Global SAML group memberships lock The Code Owners feature requires direct group memberships to projects. When the [Global SAML group memberships lock](../../group/saml_sso/group_sync.md#global-saml-group-memberships-lock) is enabled, it prevents groups from being invited as direct members to projects. This creates an incompatibility between the two features. If you enabled Global SAML group memberships lock, you can't use groups or subgroups as Code Owners. In this case, you have the following options: - Use individual users as Code Owners instead of groups. - If using group-based Code Owners is a higher priority, disable the Global SAML group memberships lock.
--- stage: Create group: Source Code info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments description: Use Code Owners to define experts for your codebase, and set review requirements based on file type or location. title: Troubleshooting Code Owners breadcrumbs: - doc - user - project - codeowners --- {{< details >}} - Tier: Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} When working with Code Owners, you might encounter the following issues. For more information about how the Code Owners feature handles errors, see [Error handling](advanced.md#error-handling). ## Validate your CODEOWNERS file {{< history >}} - [Introduced](https://gitlab.com/groups/gitlab-org/-/epics/15598) in GitLab 17.11 [with a flag](../../../administration/feature_flags/_index.md) named `accessible_code_owners_validation`. Disabled by default. - [Enabled on GitLab.com](https://gitlab.com/gitlab-org/gitlab/-/issues/524437) in GitLab 18.1. - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/issues/549626) in GitLab 18.2. Feature flag `accessible_code_owners_validation` removed. {{< /history >}} {{< alert type="flag" >}} The availability of this feature is controlled by a feature flag. For more information, see the history. {{< /alert >}} When viewing a [`CODEOWNERS` file](_index.md#codeowners-file), GitLab runs validations to help you find syntax and permission issues. If no syntax issues are found, GitLab: - Does not run more validators against the file. - Runs more permissions validations against the first 200 unique user and group references found in the file. How this works: 1. Find all references that can access the project. If a user or group reference is added, but does not have project access, show an error. 1. For each valid user reference, check that the user has permission to approve merge requests in the project. If the user does not have that permission, show an error. 1. For each valid group reference, check that the maximum role value is Developer or higher. For each group reference that has a value lower than Developer, show an error. 1. For each valid group reference, check that they group contains at least one user with permission to approve merge requests. For any group reference containing zero users with permission to approve merge requests, show an error. ## Approvals do not show The [`CODEOWNERS` file](_index.md#codeowners-file) must be present in the target branch before the merge request is created. Code Owner approval rules only update when the merge request is created. If you update the `CODEOWNERS` file, close the merge request and create a new one. ## Approvals shown as optional A Code Owner approval rule is optional if any of these conditions are true: - The user or group is not a member of the project. Code Owners [cannot inherit members from parent groups](https://gitlab.com/gitlab-org/gitlab/-/issues/288851/). - The user or group is [malformed or inaccessible](advanced.md#malformed-owners). - [Code Owner approval on a protected branch](../repository/branches/protected.md#require-code-owner-approval) has not been set up. - The section is [marked as optional](reference.md#optional-sections). - No eligible code owners are available to approve the merge request due to conflicts with other [merge request approval settings](../merge_requests/approvals/settings.md). ## User not shown as possible approver A user might not show as an approver on the Code Owner merge request approval rules if any of these conditions are true: - A rule prevents the specific user from approving the merge request. Check the project [merge request approval](../merge_requests/approvals/settings.md#edit-merge-request-approval-settings) settings. - A Code Owner group has a visibility of private, and the current user is not a member of the Code Owner group. - The specific username is spelled incorrectly or [malformed in the `CODEOWNERS` file](advanced.md#malformed-owners). - Current user is an external user who does not have permission to the internal Code Owner group. ## User or group not visible when viewing directory Code Owners Code Owners might not show the intended user or group based on your configured rules when viewing a directory, but correctly show the Code Owners for files beneath the directory. For example: ```plaintext * @dev-team docs/ @tech-writer-team ``` All files beneath the `docs/` directory show `@tech-writer-team` as Code Owners, but the directory itself shows `@dev-team`. This behavior occurs when viewing a directory because the [syntax rule](reference.md#directory-paths) applies to all files beneath the directory, which does not include the directory itself. To resolve this, update the `CODEOWNERS` file to include the directory specifically along with all files beneath the directory. For example: ```plaintext * @dev-team docs @tech-writer-team docs/ @tech-writer-team ``` ## Approval rule is invalid You might get an error that states: ```plaintext Approval rule is invalid. GitLab has approved this rule automatically to unblock the merge request. ``` This issue occurs when an approval rule uses a Code Owner that is not a direct member of the project. The workaround is to check that the group or user has been invited to the project. ## `CODEOWNERS` not updated when user or group names change When a user or group change their names, the `CODEOWNERS` isn't automatically updated with the new names. To enter the new names, you must edit the file. Organizations using SAML SSO can [set usernames](../../../integration/saml.md#set-a-username) to prevent users from changing their usernames. ## Incompatibility with Global SAML group memberships lock The Code Owners feature requires direct group memberships to projects. When the [Global SAML group memberships lock](../../group/saml_sso/group_sync.md#global-saml-group-memberships-lock) is enabled, it prevents groups from being invited as direct members to projects. This creates an incompatibility between the two features. If you enabled Global SAML group memberships lock, you can't use groups or subgroups as Code Owners. In this case, you have the following options: - Use individual users as Code Owners instead of groups. - If using group-based Code Owners is a higher priority, disable the Global SAML group memberships lock.
https://docs.gitlab.com/user/project/reference
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/reference.md
2025-08-13
doc/user/project/codeowners
[ "doc", "user", "project", "codeowners" ]
reference.md
Create
Source Code
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Syntax of `CODEOWNERS` file
null
{{< details >}} - Tier: Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} The `CODEOWNERS` file uses a syntax to define ownership rules. Each line in the file represents a rule, and specifies a file path pattern and one or more owners. The key elements are: - File paths: Specific files, directories, or wildcards. - Code Owners: Use `@mentions` for users, groups, or roles. - Comments: Lines starting with `#` are ignored. Inline comments are unsupported. Any Code Owners listed in a comment are parsed. - Sections: Optional groupings of rules, defined using `[Section name]`. {{< alert type="note" >}} If an entry is duplicated in a section, [the last entry is used](advanced.md#define-code-owners-for-specific-files-or-directories). Rules defined later in the file take precedence over earlier rules. {{< /alert >}} Here are some examples: ```plaintext # Specify a default Code Owner for all files with a wildcard: * @default-owner # Specify multiple Code Owners to a specific file: README.md @doc-team @tech-lead # Specify a Code Owner to all files with a specific extension: *.rb @ruby-owner # Specify Code Owners with usernames or email addresses: LICENSE @legal janedoe@gitlab.com # Use group names to match groups and nested groups: README @group @group/with-nested/subgroup # Specify a Code Owner to a directory and all its contents: /docs/ @all-docs /docs/* @root-docs /docs/**/*.md @markdown-docs # Match specific file types in any subdirectory /db/**/index.md @index-docs # Match a specific file name in any subdirectory # Use a section to group related rules: [Documentation] ee/docs @docs docs @docs # Assign a role as a Code Owner: /config/ @@maintainer ``` ## Sections In a `CODEOWNERS` file, sections are named areas that are analyzed separately, and always enforced. Until you define a section, GitLab treats your entire `CODEOWNERS` file as a single section. Adding more sections changes how GitLab evaluates the file: - GitLab treats [entries without sections](advanced.md#regular-entries-and-sections), including rules defined before the first section header, as if they were another, unnamed section. - Each section enforces its rules separately. - Only one Code Owner pattern per section is matched to a file path. - Rules defined later in the file take precedence over earlier rules. For example, in a `CODEOWNERS` file with sections that define the Code Owners of a `README` file: ```plaintext * @admin [README Owners] README.md @user1 @user2 internal/README.md @user4 [README other owners] README.md @user3 ``` - The Code Owners for the `README.md` in the root directory are: - `@admin`, from the unnamed section. - `@user1` and `@user2`, from `[README Owners]`. - `@user3`, from `[README other owners]`. - The Code Owners for `internal/README.md` are: - `@admin`, from the unnamed section. - `@user4`, from the last entry in `[README Owners]`. - `@user3` from `[README other owners]`. (Both lines in `[README Owners]` match this file's name, but only the last line in the section is kept.) To add a section to the `CODEOWNERS` file, enter a section name in square brackets, followed by the files or directories, and users, groups, or subgroups: ```plaintext [README Owners] README.md @user1 @user2 internal/README.md @user2 ``` Each Code Owner in the merge request widget is listed under a label. The following image shows `Default`, `Frontend`, and `Technical Writing` sections: ![MR widget - Sectional Code Owners](img/sectional_code_owners_v17_4.png) For more section configuration options, see: - [Default Code Owners and optional sections](advanced.md#default-code-owners-and-optional-sections) - [Regular entries and sections](advanced.md#regular-entries-and-sections) - [Sections with duplicate names](advanced.md#sections-with-duplicate-names) ### Section headings and names Section headings must have a name. Section names are case-insensitive, and [sections with duplicate names](advanced.md#sections-with-duplicate-names) are combined. For protected branches only, they can: - Require approval (default). - Be optional (prefixed with `^`). - Require a specific number of approvals. For more information, see [Group inheritance and eligibility](advanced.md#group-inheritance-and-eligibility) and [Approvals shown as optional](troubleshooting.md#approvals-shown-as-optional). - Include default owners. Examples: ```plaintext # Required section [Section name] # Optional section ^[Section name] # Section requiring 5 approvals [Section name][5] # Section with @username as default owner [Section name] @username # Section with @group and @subgroup as default owners and requiring 2 approvals [Section name][2] @group @subgroup ``` ### Set default Code Owner for a section If multiple file paths inside a section share the same ownership, define default Code Owners for the section. All paths in that section inherit this default, unless you override the section default on a specific line. Default owners are applied when specific owners are not specified for file paths. Specific owners defined beside the file path override default owners. For example: ```plaintext [Documentation] @docs-team docs/ README.md [Database] @database-team @agarcia model/db/ config/db/database-setup.md @docs-team ``` In this example: - `@docs-team` owns all items in the `Documentation` section. - `@database-team` and `@agarcia` own all items in the `Database` section except `config/db/database-setup.md`, which has an override assigning it to `@docs-team`. Compare this behavior to when you use [regular entries and sections together](advanced.md#regular-entries-and-sections), when entries in sections don't override entries without sections. ### Optional sections You can designate optional sections in your Code Owners file. Optional sections enable you to designate responsible parties for various parts of your codebase, but not require approval from them. This approach provides a more relaxed policy for parts of your project that are frequently updated, but don't require stringent reviews. To treat the entire section as optional, prepend the section name with the caret `^` character. In this example, the `[Go]` section is optional: ```plaintext [Documentation] *.md @root [Ruby] *.rb @root ^[Go] *.go @root ``` The optional Code Owners section displays in merge requests under the description: ![MR widget - Optional Code Owners sections](img/optional_code_owners_sections_v17_4.png) If a section is duplicated in the file, and one of them is marked as optional and the other isn't, the section is required. Optional sections in the `CODEOWNERS` file are treated as optional only when changes are submitted by using merge requests. If a change is submitted directly to the protected branch, approval from Code Owners is still required, even if the section is marked as optional. ## Eligible code owners Eligibility rules determine who can be a valid code owner. Specific rules apply depending on the reference method in the `CODEOWNERS` file: username, group, or role. ### User eligibility To be eligible as code owners, users referenced by their username (`@username`) must be authorized for the project. The following rules apply: - Project and group visibility settings do not affect eligibility. - Users [banned from a group](../../group/moderate_users.md) cannot be Code Owners. - Eligible users include those with: - Direct membership in the project with Developer role or higher. - Membership in the project's group (direct or inherited). - Membership in any of the project's group's ancestors. - Direct or inherited membership in a group that has been invited to the project. - Direct membership (but not inherited) in a group that has been invited to the project's group. - Direct membership (but not inherited) in a group that has been invited to the project's group's ancestor. ### Group eligibility When referencing a group with group name (`@group_name`) or nested group name (`@nested/group/names`), the following rules apply: - Group visibility settings do not affect eligibility. - Only direct members of the referenced group are eligible. Inherited members are not included. - Eligible groups include: - The project's group. - The project's group's ancestors. - Groups that are invited to the project with Developer role or higher. ### Role eligibility When referencing a role (`@@role`), the following rules apply: - Only Developer, Maintainer, and Owner roles can be used as Code Owners. - Only direct project members with the specified role are eligible. - Roles are not inclusive of higher roles. For example, specifying `@@developer` does not include users with Maintainer or Owner roles. For more complex scenarios involving group inheritance and eligibility, see [Group inheritance and eligibility](advanced.md#group-inheritance-and-eligibility). ## Add a role as a Code Owner {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/282438) in GitLab 17.7 [with a flag](../../../administration/feature_flags/_index.md) named `codeowner_role_approvers`. - [Enabled on GitLab.com](https://gitlab.com/gitlab-org/gitlab/-/issues/497504) in GitLab 17.8. - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/issues/512623) in GitLab 17.9 Feature flag `codeowner_role_approvers` removed. {{< /history >}} You can add or set a role for direct project members as Code Owners: - Use the `@@` prefix to set a role. - Only Developer, Maintainer, and Owner roles are available. - Roles are not inclusive of higher roles. For example, specifying `@@developer` does not include users with Maintainer or Owner roles. - Only direct project members with the specified roles are eligible Code Owners. - It is possible to specify plural roles. For example, `@@developers` is accepted. The following example sets all direct project members with the Developer or Maintainer role as Code Owners for `file.md`: 1. Open the `CODEOWNERS` file. 1. Add a line using the following pattern: ```plaintext file.md @@developer @@maintainer ``` 1. Save the file. 1. Commit and merge the changes. ## Add a group as a Code Owner You can set direct members of a group or subgroup as a Code Owner. For more information about group membership, see [Membership types](../members/_index.md#membership-types). Prerequisites: - The group must be [invited to the project](../members/sharing_projects_groups.md#invite-a-group-to-a-project). To set direct members of a group or subgroup as a Code Owner: 1. Open the `CODEOWNERS` file. 1. Enter text that follows one of these patterns: ```plaintext # All direct group members as Code Owners for a file file.md @group-x # All direct subgroup members as Code Owners for a file file.md @group-x/subgroup-y # All direct group and direct subgroup members as Code Owners for a file file.md @group-x @group-x/subgroup-y ``` 1. Save the file. 1. Commit and merge the changes. ### Example configuration ```plaintext [Maintainers] * @gitlab-org/maintainers/group-name ``` In this example: - The group `group-name` is listed under the `[Maintainers]` section. - The `group-name` contains the following direct members: ![List of group members.](img/direct_group_members_v17_9.png) - In the merge request approval widget, the same direct members are listed as `Maintainers`: ![Merge request maintainers.](img/merge_request_maintainers_v17_9.png) {{< alert type="note" >}} When [Global SAML group memberships lock](../../group/saml_sso/group_sync.md#global-saml-group-memberships-lock) is enabled, you cannot set a group or subgroup as a Code Owner. For more information, see [Incompatibility with Global SAML group memberships lock](troubleshooting.md#incompatibility-with-global-saml-group-memberships-lock). {{< /alert >}} If you encounter issues, refer to [User not shown as possible approver](troubleshooting.md#user-not-shown-as-possible-approver). ## Path matching Paths can be absolute, relative, directory, wildcard, or globstar, and are matched against the repository root. ### Absolute paths Paths starting with `/` match from the repository root: ```plaintext # Matches only README.md in the root. /README.md # Matches only README.md inside the /docs directory. /docs/README.md ``` ### Relative paths Paths without a leading `/` are treated as [globstar paths](#globstar-paths): ```plaintext # Matches /README.md, /internal/README.md, /app/lib/README.md README.md @username # Matches /internal/README.md, /docs/internal/README.md, /docs/api/internal/README.md internal/README.md ``` {{< alert type="note" >}} When using globstar paths, be cautious of unintended matches. For example, `README.md` without a leading `/` matches any `README.md` file in any directory or subdirectory of the repository. {{< /alert >}} ### Directory paths End a path with `/` to match all files in the directory and its subdirectories: ```plaintext # Matches all files in /docs/ and its subdirectories /docs/ ``` ### Wildcard paths Use `*` to match multiple characters: ```plaintext # Any markdown files in the docs directory /docs/*.md @username # /docs/index file of any filetype # For example: /docs/index.md, /docs/index.html, /docs/index.xml /docs/index.* @username # Any file in the docs directory with 'spec' in the name. # For example: /docs/qa_specs.rb, /docs/spec_helpers.rb, /docs/runtime.spec /docs/*spec* @username # README.md files one level deep within the docs directory # For example: /docs/api/README.md /docs/*/README.md @username ``` ### Globstar paths Use `**` to match files or patterns across multiple directory levels: ```plaintext # For example: /docs/index.md, /docs/api/index.md, and /docs/api/graphql/index.md. /docs/**/index.md ``` To match all files in a directory, use [directory paths](#directory-paths) with a trailing slash (`/`). ### Exclusion patterns {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/180162) in GitLab 17.10 [with a flag](../../../administration/feature_flags/_index.md) named `codeowners_file_exclusions`. - [Enabled on GitLab.com](https://gitlab.com/gitlab-org/gitlab/-/issues/517075) in GitLab 17.10. - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/issues/517309) in GitLab 17.11. Feature flag `codeowners_file_exclusions` removed. {{< /history >}} Prefix files or paths with `!` to exempt or exclude them from requiring code owner approval. Exclusions apply in their section. In the following example: - The `pom.xml` exclusion applies to the default section. - The `/config/**/*.rb` exclusion only affects Ruby files in the Ruby section. ```plaintext # All files require approval from @username * @username # Except pom.xml which needs no approval !pom.xml [Ruby] # All ruby files require approval from @ruby-team *.rb @ruby-team # Except Ruby files in the config directory !/config/**/*.rb ``` The following guidelines explain how exclusion patterns behave: - Exclusions are evaluated in order in their section. For example: ```plaintext * @default-owner !*.rb # Excludes all Ruby files. /special/*.rb @ruby-owner # This won't take effect as *.rb is already excluded. ``` - After a pattern is excluded, it cannot be included again in the same section: ```plaintext [Ruby] *.rb @ruby-team # All Ruby files need Ruby team approval. !/config/**/*.rb # Ruby files in config don't need Ruby team approval. /config/routes.rb @ops # This won't take effect as config Ruby files are excluded. ``` - Files matching an exclusion pattern do not require code owner approval for that section. If you need different exclusions for different owners, use multiple sections: ```plaintext [Ruby] *.rb @ruby-team !/config/**/*.rb # Config Ruby files don't need Ruby team approval. [Config] /config/ @ops-team # Config files still require ops-team approval. ``` - Use exclusions for files that are automatically updated: ```plaintext * @default-owner # Files updated by automation don't need approval. !package-lock.json !yarn.lock !**/generated/ # Any files in generated directories. !.gitlab-ci.yml ``` ## Entry owners Entries must have one or more owners These can be groups, subgroups, and users. ```plaintext /path/to/entry.rb @group /path/to/entry.rb @group/subgroup /path/to/entry.rb @user /path/to/entry.rb @group @group/subgroup @user ``` For more information on adding groups as Code Owners, see [Add a group as a Code Owner](#add-a-group-as-a-code-owner). ## Related topics - [Code Owners](_index.md) - [Advanced `CODEOWNERS` configuration](advanced.md) - [Merge request approvals](../merge_requests/approvals/_index.md) - [Protected branches](../repository/branches/protected.md) - [Troubleshooting Code Owners](troubleshooting.md)
--- stage: Create group: Source Code info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments title: Syntax of `CODEOWNERS` file breadcrumbs: - doc - user - project - codeowners --- {{< details >}} - Tier: Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} The `CODEOWNERS` file uses a syntax to define ownership rules. Each line in the file represents a rule, and specifies a file path pattern and one or more owners. The key elements are: - File paths: Specific files, directories, or wildcards. - Code Owners: Use `@mentions` for users, groups, or roles. - Comments: Lines starting with `#` are ignored. Inline comments are unsupported. Any Code Owners listed in a comment are parsed. - Sections: Optional groupings of rules, defined using `[Section name]`. {{< alert type="note" >}} If an entry is duplicated in a section, [the last entry is used](advanced.md#define-code-owners-for-specific-files-or-directories). Rules defined later in the file take precedence over earlier rules. {{< /alert >}} Here are some examples: ```plaintext # Specify a default Code Owner for all files with a wildcard: * @default-owner # Specify multiple Code Owners to a specific file: README.md @doc-team @tech-lead # Specify a Code Owner to all files with a specific extension: *.rb @ruby-owner # Specify Code Owners with usernames or email addresses: LICENSE @legal janedoe@gitlab.com # Use group names to match groups and nested groups: README @group @group/with-nested/subgroup # Specify a Code Owner to a directory and all its contents: /docs/ @all-docs /docs/* @root-docs /docs/**/*.md @markdown-docs # Match specific file types in any subdirectory /db/**/index.md @index-docs # Match a specific file name in any subdirectory # Use a section to group related rules: [Documentation] ee/docs @docs docs @docs # Assign a role as a Code Owner: /config/ @@maintainer ``` ## Sections In a `CODEOWNERS` file, sections are named areas that are analyzed separately, and always enforced. Until you define a section, GitLab treats your entire `CODEOWNERS` file as a single section. Adding more sections changes how GitLab evaluates the file: - GitLab treats [entries without sections](advanced.md#regular-entries-and-sections), including rules defined before the first section header, as if they were another, unnamed section. - Each section enforces its rules separately. - Only one Code Owner pattern per section is matched to a file path. - Rules defined later in the file take precedence over earlier rules. For example, in a `CODEOWNERS` file with sections that define the Code Owners of a `README` file: ```plaintext * @admin [README Owners] README.md @user1 @user2 internal/README.md @user4 [README other owners] README.md @user3 ``` - The Code Owners for the `README.md` in the root directory are: - `@admin`, from the unnamed section. - `@user1` and `@user2`, from `[README Owners]`. - `@user3`, from `[README other owners]`. - The Code Owners for `internal/README.md` are: - `@admin`, from the unnamed section. - `@user4`, from the last entry in `[README Owners]`. - `@user3` from `[README other owners]`. (Both lines in `[README Owners]` match this file's name, but only the last line in the section is kept.) To add a section to the `CODEOWNERS` file, enter a section name in square brackets, followed by the files or directories, and users, groups, or subgroups: ```plaintext [README Owners] README.md @user1 @user2 internal/README.md @user2 ``` Each Code Owner in the merge request widget is listed under a label. The following image shows `Default`, `Frontend`, and `Technical Writing` sections: ![MR widget - Sectional Code Owners](img/sectional_code_owners_v17_4.png) For more section configuration options, see: - [Default Code Owners and optional sections](advanced.md#default-code-owners-and-optional-sections) - [Regular entries and sections](advanced.md#regular-entries-and-sections) - [Sections with duplicate names](advanced.md#sections-with-duplicate-names) ### Section headings and names Section headings must have a name. Section names are case-insensitive, and [sections with duplicate names](advanced.md#sections-with-duplicate-names) are combined. For protected branches only, they can: - Require approval (default). - Be optional (prefixed with `^`). - Require a specific number of approvals. For more information, see [Group inheritance and eligibility](advanced.md#group-inheritance-and-eligibility) and [Approvals shown as optional](troubleshooting.md#approvals-shown-as-optional). - Include default owners. Examples: ```plaintext # Required section [Section name] # Optional section ^[Section name] # Section requiring 5 approvals [Section name][5] # Section with @username as default owner [Section name] @username # Section with @group and @subgroup as default owners and requiring 2 approvals [Section name][2] @group @subgroup ``` ### Set default Code Owner for a section If multiple file paths inside a section share the same ownership, define default Code Owners for the section. All paths in that section inherit this default, unless you override the section default on a specific line. Default owners are applied when specific owners are not specified for file paths. Specific owners defined beside the file path override default owners. For example: ```plaintext [Documentation] @docs-team docs/ README.md [Database] @database-team @agarcia model/db/ config/db/database-setup.md @docs-team ``` In this example: - `@docs-team` owns all items in the `Documentation` section. - `@database-team` and `@agarcia` own all items in the `Database` section except `config/db/database-setup.md`, which has an override assigning it to `@docs-team`. Compare this behavior to when you use [regular entries and sections together](advanced.md#regular-entries-and-sections), when entries in sections don't override entries without sections. ### Optional sections You can designate optional sections in your Code Owners file. Optional sections enable you to designate responsible parties for various parts of your codebase, but not require approval from them. This approach provides a more relaxed policy for parts of your project that are frequently updated, but don't require stringent reviews. To treat the entire section as optional, prepend the section name with the caret `^` character. In this example, the `[Go]` section is optional: ```plaintext [Documentation] *.md @root [Ruby] *.rb @root ^[Go] *.go @root ``` The optional Code Owners section displays in merge requests under the description: ![MR widget - Optional Code Owners sections](img/optional_code_owners_sections_v17_4.png) If a section is duplicated in the file, and one of them is marked as optional and the other isn't, the section is required. Optional sections in the `CODEOWNERS` file are treated as optional only when changes are submitted by using merge requests. If a change is submitted directly to the protected branch, approval from Code Owners is still required, even if the section is marked as optional. ## Eligible code owners Eligibility rules determine who can be a valid code owner. Specific rules apply depending on the reference method in the `CODEOWNERS` file: username, group, or role. ### User eligibility To be eligible as code owners, users referenced by their username (`@username`) must be authorized for the project. The following rules apply: - Project and group visibility settings do not affect eligibility. - Users [banned from a group](../../group/moderate_users.md) cannot be Code Owners. - Eligible users include those with: - Direct membership in the project with Developer role or higher. - Membership in the project's group (direct or inherited). - Membership in any of the project's group's ancestors. - Direct or inherited membership in a group that has been invited to the project. - Direct membership (but not inherited) in a group that has been invited to the project's group. - Direct membership (but not inherited) in a group that has been invited to the project's group's ancestor. ### Group eligibility When referencing a group with group name (`@group_name`) or nested group name (`@nested/group/names`), the following rules apply: - Group visibility settings do not affect eligibility. - Only direct members of the referenced group are eligible. Inherited members are not included. - Eligible groups include: - The project's group. - The project's group's ancestors. - Groups that are invited to the project with Developer role or higher. ### Role eligibility When referencing a role (`@@role`), the following rules apply: - Only Developer, Maintainer, and Owner roles can be used as Code Owners. - Only direct project members with the specified role are eligible. - Roles are not inclusive of higher roles. For example, specifying `@@developer` does not include users with Maintainer or Owner roles. For more complex scenarios involving group inheritance and eligibility, see [Group inheritance and eligibility](advanced.md#group-inheritance-and-eligibility). ## Add a role as a Code Owner {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/282438) in GitLab 17.7 [with a flag](../../../administration/feature_flags/_index.md) named `codeowner_role_approvers`. - [Enabled on GitLab.com](https://gitlab.com/gitlab-org/gitlab/-/issues/497504) in GitLab 17.8. - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/issues/512623) in GitLab 17.9 Feature flag `codeowner_role_approvers` removed. {{< /history >}} You can add or set a role for direct project members as Code Owners: - Use the `@@` prefix to set a role. - Only Developer, Maintainer, and Owner roles are available. - Roles are not inclusive of higher roles. For example, specifying `@@developer` does not include users with Maintainer or Owner roles. - Only direct project members with the specified roles are eligible Code Owners. - It is possible to specify plural roles. For example, `@@developers` is accepted. The following example sets all direct project members with the Developer or Maintainer role as Code Owners for `file.md`: 1. Open the `CODEOWNERS` file. 1. Add a line using the following pattern: ```plaintext file.md @@developer @@maintainer ``` 1. Save the file. 1. Commit and merge the changes. ## Add a group as a Code Owner You can set direct members of a group or subgroup as a Code Owner. For more information about group membership, see [Membership types](../members/_index.md#membership-types). Prerequisites: - The group must be [invited to the project](../members/sharing_projects_groups.md#invite-a-group-to-a-project). To set direct members of a group or subgroup as a Code Owner: 1. Open the `CODEOWNERS` file. 1. Enter text that follows one of these patterns: ```plaintext # All direct group members as Code Owners for a file file.md @group-x # All direct subgroup members as Code Owners for a file file.md @group-x/subgroup-y # All direct group and direct subgroup members as Code Owners for a file file.md @group-x @group-x/subgroup-y ``` 1. Save the file. 1. Commit and merge the changes. ### Example configuration ```plaintext [Maintainers] * @gitlab-org/maintainers/group-name ``` In this example: - The group `group-name` is listed under the `[Maintainers]` section. - The `group-name` contains the following direct members: ![List of group members.](img/direct_group_members_v17_9.png) - In the merge request approval widget, the same direct members are listed as `Maintainers`: ![Merge request maintainers.](img/merge_request_maintainers_v17_9.png) {{< alert type="note" >}} When [Global SAML group memberships lock](../../group/saml_sso/group_sync.md#global-saml-group-memberships-lock) is enabled, you cannot set a group or subgroup as a Code Owner. For more information, see [Incompatibility with Global SAML group memberships lock](troubleshooting.md#incompatibility-with-global-saml-group-memberships-lock). {{< /alert >}} If you encounter issues, refer to [User not shown as possible approver](troubleshooting.md#user-not-shown-as-possible-approver). ## Path matching Paths can be absolute, relative, directory, wildcard, or globstar, and are matched against the repository root. ### Absolute paths Paths starting with `/` match from the repository root: ```plaintext # Matches only README.md in the root. /README.md # Matches only README.md inside the /docs directory. /docs/README.md ``` ### Relative paths Paths without a leading `/` are treated as [globstar paths](#globstar-paths): ```plaintext # Matches /README.md, /internal/README.md, /app/lib/README.md README.md @username # Matches /internal/README.md, /docs/internal/README.md, /docs/api/internal/README.md internal/README.md ``` {{< alert type="note" >}} When using globstar paths, be cautious of unintended matches. For example, `README.md` without a leading `/` matches any `README.md` file in any directory or subdirectory of the repository. {{< /alert >}} ### Directory paths End a path with `/` to match all files in the directory and its subdirectories: ```plaintext # Matches all files in /docs/ and its subdirectories /docs/ ``` ### Wildcard paths Use `*` to match multiple characters: ```plaintext # Any markdown files in the docs directory /docs/*.md @username # /docs/index file of any filetype # For example: /docs/index.md, /docs/index.html, /docs/index.xml /docs/index.* @username # Any file in the docs directory with 'spec' in the name. # For example: /docs/qa_specs.rb, /docs/spec_helpers.rb, /docs/runtime.spec /docs/*spec* @username # README.md files one level deep within the docs directory # For example: /docs/api/README.md /docs/*/README.md @username ``` ### Globstar paths Use `**` to match files or patterns across multiple directory levels: ```plaintext # For example: /docs/index.md, /docs/api/index.md, and /docs/api/graphql/index.md. /docs/**/index.md ``` To match all files in a directory, use [directory paths](#directory-paths) with a trailing slash (`/`). ### Exclusion patterns {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/180162) in GitLab 17.10 [with a flag](../../../administration/feature_flags/_index.md) named `codeowners_file_exclusions`. - [Enabled on GitLab.com](https://gitlab.com/gitlab-org/gitlab/-/issues/517075) in GitLab 17.10. - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/issues/517309) in GitLab 17.11. Feature flag `codeowners_file_exclusions` removed. {{< /history >}} Prefix files or paths with `!` to exempt or exclude them from requiring code owner approval. Exclusions apply in their section. In the following example: - The `pom.xml` exclusion applies to the default section. - The `/config/**/*.rb` exclusion only affects Ruby files in the Ruby section. ```plaintext # All files require approval from @username * @username # Except pom.xml which needs no approval !pom.xml [Ruby] # All ruby files require approval from @ruby-team *.rb @ruby-team # Except Ruby files in the config directory !/config/**/*.rb ``` The following guidelines explain how exclusion patterns behave: - Exclusions are evaluated in order in their section. For example: ```plaintext * @default-owner !*.rb # Excludes all Ruby files. /special/*.rb @ruby-owner # This won't take effect as *.rb is already excluded. ``` - After a pattern is excluded, it cannot be included again in the same section: ```plaintext [Ruby] *.rb @ruby-team # All Ruby files need Ruby team approval. !/config/**/*.rb # Ruby files in config don't need Ruby team approval. /config/routes.rb @ops # This won't take effect as config Ruby files are excluded. ``` - Files matching an exclusion pattern do not require code owner approval for that section. If you need different exclusions for different owners, use multiple sections: ```plaintext [Ruby] *.rb @ruby-team !/config/**/*.rb # Config Ruby files don't need Ruby team approval. [Config] /config/ @ops-team # Config files still require ops-team approval. ``` - Use exclusions for files that are automatically updated: ```plaintext * @default-owner # Files updated by automation don't need approval. !package-lock.json !yarn.lock !**/generated/ # Any files in generated directories. !.gitlab-ci.yml ``` ## Entry owners Entries must have one or more owners These can be groups, subgroups, and users. ```plaintext /path/to/entry.rb @group /path/to/entry.rb @group/subgroup /path/to/entry.rb @user /path/to/entry.rb @group @group/subgroup @user ``` For more information on adding groups as Code Owners, see [Add a group as a Code Owner](#add-a-group-as-a-code-owner). ## Related topics - [Code Owners](_index.md) - [Advanced `CODEOWNERS` configuration](advanced.md) - [Merge request approvals](../merge_requests/approvals/_index.md) - [Protected branches](../repository/branches/protected.md) - [Troubleshooting Code Owners](troubleshooting.md)
https://docs.gitlab.com/user/project/advanced
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/advanced.md
2025-08-13
doc/user/project/codeowners
[ "doc", "user", "project", "codeowners" ]
advanced.md
Create
Source Code
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Advanced `CODEOWNERS` configuration
Use Code Owners to define experts for your codebase, and set review requirements based on file type or location.
The `CODEOWNERS` file helps you define who is responsible for specific files and directories. You can use pattern matching, sections, and inheritance rules to assign reviewers to merge requests and require their approval before merging. ## Pattern matching GitLab uses `File::fnmatch` with the `File::FNM_DOTMATCH` and `File::FNM_PATHNAME` flags set for pattern matching: - The repository structure is treated like an isolated file system. - The patterns follow a subset of shell filename globbing rules, and are not regular expressions. - The `File::FNM_DOTMATCH` flag allows `*` to match dotfiles like `.gitignore`. - The `File::FNM_PATHNAME` flag prevents `*` from matching the `/` path separator. - `**` matches directories recursively. For example, `**/*.rb` matches `config/database.rb` and `app/controllers/users/stars_controller.rb`. ## Default Code Owners and optional sections To combine the syntax for default owners with [optional sections](reference.md#optional-sections) and required approvals, place default owners at the end: ```plaintext [Documentation][2] @docs-team docs/ README.md ^[Database] @database-team model/db/ config/db/database-setup.md @docs-team ``` ## Regular entries and sections If you set a default Code Owner for a path outside a section, their approval is always required. Such entries aren't overridden by sections. Entries without sections are treated as if they were another, unnamed section: ```plaintext # Required for all files * @general-approvers [Documentation] @docs-team docs/ README.md *.txt [Database] @database-team model/db/ config/db/database-setup.md @docs-team ``` In this example: - `@general-approvers` owns all items everywhere, without overrides. - `@docs-team` owns all items in the `Documentation` section. - `@database-team` owns all items in the `Database` section except `config/db/database-setup.md`, which has an override assigning it to `@docs-team`. - A merge request that modifies `model/db/CHANGELOG.txt` would require three approvals: one from each of the `@general-approvers`,`@docs-team`, and `@database-team` groups. Compare this behavior to when you use only [default owners for sections](reference.md#set-default-code-owner-for-a-section), when specific entries in a section override the section default. ## Sections with duplicate names If multiple sections have the same name, they are combined. Also, section headings are not case-sensitive. For example: ```plaintext [Documentation] ee/docs/ @docs docs/ @docs [Database] README.md @database model/db/ @database [DOCUMENTATION] README.md @docs ``` This code results in three entries under the `Documentation` section header, and two entries under `Database`. The entries defined under the sections `Documentation` and `DOCUMENTATION` are combined, using the case of the first section. ## Define Code Owners for specific files or directories When a file or directory matches multiple entries in the `CODEOWNERS` file, the users from last pattern matching the file or directory are used. This enables you to define more specific owners for more specifically defined files or directories, when you order the entries in a sensible way. For example, in the following `CODEOWNERS` file: ```plaintext # This line would match the file terms.md *.md @doc-team # This line would also match the file terms.md terms.md @legal-team ``` The Code Owner for `terms.md` would be `@legal-team`. ## Require multiple approvals from Code Owners You can require multiple approvals for the Code Owners sections in the Approvals area in merge requests. Append the section name with a number `n` in brackets, for example, `[2]` or `[3]`. This requires `n` approvals from the Code Owners in this section. Valid entries for `n` are integers `≥ 1`. `[1]` is optional because it is the default. Invalid values for `n` are treated as `1`. {{< alert type="warning" >}} [Issue 384881](https://gitlab.com/gitlab-org/gitlab/-/issues/385881) proposes changes to the behavior of this setting. Do not intentionally set invalid values. They may become valid in the future and cause unexpected behavior. {{< /alert >}} To require multiple approvals from Code Owners: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Repository**. 1. Expand **Protected branches**. 1. Next to the default branch, turn on the toggle under **Code owner approval**. 1. Edit the `CODEOWNERS` file to add a rule for multiple approvals. For example, to require two approvals for the `[Documentation]` section: ```plaintext [Documentation][2] *.md @tech-writer-team [Ruby] *.rb @dev-team ``` The `Documentation` Code Owners section in the Approvals area displays two approvals are required: ![MR widget - Multiple Approval Code Owners sections](img/multi_approvals_code_owners_sections_v15_9.png) ## Group inheritance and eligibility ```mermaid %%{init: { "fontFamily": "GitLab Sans" }}%% graph TD accTitle: Diagram of group inheritance accDescr: If a subgroup owns a project, the parent group inherits ownership. A[Parent group X] -->|owns| B[Project A] A -->|contains| C[Subgroup Y] C -->|owns| D[Project B] A-. inherits ownership .-> D ``` In this example: - Parent group X (`group-x`) owns Project A. - Parent group X also contains a subgroup, Subgroup Y. (`group-x/subgroup-y`) - Subgroup Y owns Project B. The eligible Code Owners are: - Project A: the members of Group X only, because Project A doesn't belong to Subgroup Y. - Project B: the members of both Group X and Subgroup Y. ### Invite subgroups to parent groups Inviting Subgroup Y to a parent group of Project A [is not supported](https://gitlab.com/gitlab-org/gitlab/-/issues/288851). To set Subgroup Y as Code Owners, [invite this group directly to the project](#invite-subgroups-to-projects-in-parent-groups) itself. {{< alert type="note" >}} For approval to be required, groups as Code Owners must have a direct membership (not inherited membership) in the project. Approval can only be optional for groups that inherit membership. Members in the Code Owners group also must be direct members, and not inherit membership from any parent groups. {{< /alert >}} ### Invite subgroups to projects in parent groups You can [invite](../members/sharing_projects_groups.md) Subgroup Y to Project A so that their members also become eligible Code Owners. ```mermaid %%{init: { "fontFamily": "GitLab Sans" }}%% graph LR accTitle: Diagram of subgroup inheritance accDescr: Inviting a subgroup directly to a project affects whether their approvals can be made required. A[Parent group X] -->|owns| B[Project A] A -->|also contains| C[Subgroup Y] C -.->D{Invite Subgroup Y<br/>to Project A?} -.->|yes| E[Members of Subgroup Y<br/>can submit Approvals] D{Invite Subgroup Y<br/>to Project A?} -.->|no| F[Members of Subgroup Y<br />cannot submit Approvals] E -.->|Add Subgroup Y<br/> as Code Owner to Project A| I[Approvals can be<br/>required] -.-> B F -.-> |Add Subgroup Y<br/> as Code Owners to Project A| J[Approvals can only<br/>be optional] -.-> B ``` If you do not invite Subgroup Y to Project A, but make them Code Owners, their approval of the merge request becomes optional. ## Error handling {{< history >}} - Error validation [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/216066) in GitLab 16.3. {{< /history >}} ### Entries with spaces Escape whitespace in paths with backslashes: ```plaintext path\ with\ spaces/*.md @owner ``` Without escaping, GitLab parses `folder with spaces/*.md @group` as: `path: "folder", owners: " with spaces/*.md @group"`. ### Unparsable sections If a section heading cannot be parsed, the section is: 1. Parsed as an entry. 1. Added to the previous section. 1. If no previous section exists, the section is added to the default section. #### After the default section ```plaintext * @group [Section name docs/ @docs_group ``` GitLab recognizes the heading `[Section name` as an entry. The default section includes 3 rules: - Default section - `*` owned by `@group` - `[Section` owned by `name` - `docs/` owned by `@docs_group` #### After a named section ```plaintext [Docs] docs/**/* @group [Section name docs/ @docs_group ``` GitLab recognizes the heading `[Section name` as an entry. The `[Docs]` section includes 3 rules: - `docs/**/*` owned by `@group` - `[Section` owned by `name` - `docs/` owned by `@docs_group` ### Malformed owners Each entry must contain one or more owners. Malformed owners are invalid and ignored: ```plaintext /path/* @group user_without_at_symbol @user_with_at_symbol ``` This entry is owned by `@group` and `@user_with_at_symbol`. ### Inaccessible or incorrect owners GitLab ignores inaccessible or incorrect owners. For example: ```plaintext * @group @grou @username @i_left @i_dont_exist example@gitlab.com invalid@gitlab.com ``` If only `@group`, `@username`, and `example@gitlab.com` are accessible, GitLab ignores the others. ### Zero owners If an entry includes no owners, or zero [accessible owners](#inaccessible-or-incorrect-owners) exist, the entry is invalid. Because this rule can never be satisfied, GitLab auto-approves it in merge requests. {{< alert type="note" >}} When a protected branch has `Require code owner approval` enabled, rules with zero owners are still honored. {{< /alert >}} ### Minimum approvals When [defining the number of approvals](advanced.md#require-multiple-approvals-from-code-owners) for a section, the minimum number of approvals is `1`. Setting the number of approvals to `0` results in GitLab requiring one approval.
--- stage: Create group: Source Code info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments description: Use Code Owners to define experts for your codebase, and set review requirements based on file type or location. title: Advanced `CODEOWNERS` configuration breadcrumbs: - doc - user - project - codeowners --- The `CODEOWNERS` file helps you define who is responsible for specific files and directories. You can use pattern matching, sections, and inheritance rules to assign reviewers to merge requests and require their approval before merging. ## Pattern matching GitLab uses `File::fnmatch` with the `File::FNM_DOTMATCH` and `File::FNM_PATHNAME` flags set for pattern matching: - The repository structure is treated like an isolated file system. - The patterns follow a subset of shell filename globbing rules, and are not regular expressions. - The `File::FNM_DOTMATCH` flag allows `*` to match dotfiles like `.gitignore`. - The `File::FNM_PATHNAME` flag prevents `*` from matching the `/` path separator. - `**` matches directories recursively. For example, `**/*.rb` matches `config/database.rb` and `app/controllers/users/stars_controller.rb`. ## Default Code Owners and optional sections To combine the syntax for default owners with [optional sections](reference.md#optional-sections) and required approvals, place default owners at the end: ```plaintext [Documentation][2] @docs-team docs/ README.md ^[Database] @database-team model/db/ config/db/database-setup.md @docs-team ``` ## Regular entries and sections If you set a default Code Owner for a path outside a section, their approval is always required. Such entries aren't overridden by sections. Entries without sections are treated as if they were another, unnamed section: ```plaintext # Required for all files * @general-approvers [Documentation] @docs-team docs/ README.md *.txt [Database] @database-team model/db/ config/db/database-setup.md @docs-team ``` In this example: - `@general-approvers` owns all items everywhere, without overrides. - `@docs-team` owns all items in the `Documentation` section. - `@database-team` owns all items in the `Database` section except `config/db/database-setup.md`, which has an override assigning it to `@docs-team`. - A merge request that modifies `model/db/CHANGELOG.txt` would require three approvals: one from each of the `@general-approvers`,`@docs-team`, and `@database-team` groups. Compare this behavior to when you use only [default owners for sections](reference.md#set-default-code-owner-for-a-section), when specific entries in a section override the section default. ## Sections with duplicate names If multiple sections have the same name, they are combined. Also, section headings are not case-sensitive. For example: ```plaintext [Documentation] ee/docs/ @docs docs/ @docs [Database] README.md @database model/db/ @database [DOCUMENTATION] README.md @docs ``` This code results in three entries under the `Documentation` section header, and two entries under `Database`. The entries defined under the sections `Documentation` and `DOCUMENTATION` are combined, using the case of the first section. ## Define Code Owners for specific files or directories When a file or directory matches multiple entries in the `CODEOWNERS` file, the users from last pattern matching the file or directory are used. This enables you to define more specific owners for more specifically defined files or directories, when you order the entries in a sensible way. For example, in the following `CODEOWNERS` file: ```plaintext # This line would match the file terms.md *.md @doc-team # This line would also match the file terms.md terms.md @legal-team ``` The Code Owner for `terms.md` would be `@legal-team`. ## Require multiple approvals from Code Owners You can require multiple approvals for the Code Owners sections in the Approvals area in merge requests. Append the section name with a number `n` in brackets, for example, `[2]` or `[3]`. This requires `n` approvals from the Code Owners in this section. Valid entries for `n` are integers `≥ 1`. `[1]` is optional because it is the default. Invalid values for `n` are treated as `1`. {{< alert type="warning" >}} [Issue 384881](https://gitlab.com/gitlab-org/gitlab/-/issues/385881) proposes changes to the behavior of this setting. Do not intentionally set invalid values. They may become valid in the future and cause unexpected behavior. {{< /alert >}} To require multiple approvals from Code Owners: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Repository**. 1. Expand **Protected branches**. 1. Next to the default branch, turn on the toggle under **Code owner approval**. 1. Edit the `CODEOWNERS` file to add a rule for multiple approvals. For example, to require two approvals for the `[Documentation]` section: ```plaintext [Documentation][2] *.md @tech-writer-team [Ruby] *.rb @dev-team ``` The `Documentation` Code Owners section in the Approvals area displays two approvals are required: ![MR widget - Multiple Approval Code Owners sections](img/multi_approvals_code_owners_sections_v15_9.png) ## Group inheritance and eligibility ```mermaid %%{init: { "fontFamily": "GitLab Sans" }}%% graph TD accTitle: Diagram of group inheritance accDescr: If a subgroup owns a project, the parent group inherits ownership. A[Parent group X] -->|owns| B[Project A] A -->|contains| C[Subgroup Y] C -->|owns| D[Project B] A-. inherits ownership .-> D ``` In this example: - Parent group X (`group-x`) owns Project A. - Parent group X also contains a subgroup, Subgroup Y. (`group-x/subgroup-y`) - Subgroup Y owns Project B. The eligible Code Owners are: - Project A: the members of Group X only, because Project A doesn't belong to Subgroup Y. - Project B: the members of both Group X and Subgroup Y. ### Invite subgroups to parent groups Inviting Subgroup Y to a parent group of Project A [is not supported](https://gitlab.com/gitlab-org/gitlab/-/issues/288851). To set Subgroup Y as Code Owners, [invite this group directly to the project](#invite-subgroups-to-projects-in-parent-groups) itself. {{< alert type="note" >}} For approval to be required, groups as Code Owners must have a direct membership (not inherited membership) in the project. Approval can only be optional for groups that inherit membership. Members in the Code Owners group also must be direct members, and not inherit membership from any parent groups. {{< /alert >}} ### Invite subgroups to projects in parent groups You can [invite](../members/sharing_projects_groups.md) Subgroup Y to Project A so that their members also become eligible Code Owners. ```mermaid %%{init: { "fontFamily": "GitLab Sans" }}%% graph LR accTitle: Diagram of subgroup inheritance accDescr: Inviting a subgroup directly to a project affects whether their approvals can be made required. A[Parent group X] -->|owns| B[Project A] A -->|also contains| C[Subgroup Y] C -.->D{Invite Subgroup Y<br/>to Project A?} -.->|yes| E[Members of Subgroup Y<br/>can submit Approvals] D{Invite Subgroup Y<br/>to Project A?} -.->|no| F[Members of Subgroup Y<br />cannot submit Approvals] E -.->|Add Subgroup Y<br/> as Code Owner to Project A| I[Approvals can be<br/>required] -.-> B F -.-> |Add Subgroup Y<br/> as Code Owners to Project A| J[Approvals can only<br/>be optional] -.-> B ``` If you do not invite Subgroup Y to Project A, but make them Code Owners, their approval of the merge request becomes optional. ## Error handling {{< history >}} - Error validation [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/216066) in GitLab 16.3. {{< /history >}} ### Entries with spaces Escape whitespace in paths with backslashes: ```plaintext path\ with\ spaces/*.md @owner ``` Without escaping, GitLab parses `folder with spaces/*.md @group` as: `path: "folder", owners: " with spaces/*.md @group"`. ### Unparsable sections If a section heading cannot be parsed, the section is: 1. Parsed as an entry. 1. Added to the previous section. 1. If no previous section exists, the section is added to the default section. #### After the default section ```plaintext * @group [Section name docs/ @docs_group ``` GitLab recognizes the heading `[Section name` as an entry. The default section includes 3 rules: - Default section - `*` owned by `@group` - `[Section` owned by `name` - `docs/` owned by `@docs_group` #### After a named section ```plaintext [Docs] docs/**/* @group [Section name docs/ @docs_group ``` GitLab recognizes the heading `[Section name` as an entry. The `[Docs]` section includes 3 rules: - `docs/**/*` owned by `@group` - `[Section` owned by `name` - `docs/` owned by `@docs_group` ### Malformed owners Each entry must contain one or more owners. Malformed owners are invalid and ignored: ```plaintext /path/* @group user_without_at_symbol @user_with_at_symbol ``` This entry is owned by `@group` and `@user_with_at_symbol`. ### Inaccessible or incorrect owners GitLab ignores inaccessible or incorrect owners. For example: ```plaintext * @group @grou @username @i_left @i_dont_exist example@gitlab.com invalid@gitlab.com ``` If only `@group`, `@username`, and `example@gitlab.com` are accessible, GitLab ignores the others. ### Zero owners If an entry includes no owners, or zero [accessible owners](#inaccessible-or-incorrect-owners) exist, the entry is invalid. Because this rule can never be satisfied, GitLab auto-approves it in merge requests. {{< alert type="note" >}} When a protected branch has `Require code owner approval` enabled, rules with zero owners are still honored. {{< /alert >}} ### Minimum approvals When [defining the number of approvals](advanced.md#require-multiple-approvals-from-code-owners) for a section, the minimum number of approvals is `1`. Setting the number of approvals to `0` results in GitLab requiring one approval.
https://docs.gitlab.com/user/project/codeowners
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/_index.md
2025-08-13
doc/user/project/codeowners
[ "doc", "user", "project", "codeowners" ]
_index.md
Create
Source Code
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Code Owners
Use Code Owners to define experts for your codebase, and set review requirements based on file type or location.
{{< details >}} - Tier: Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} Use the Code Owners feature to define who has expertise for specific parts of your project's codebase. Define the owners of files and directories in a repository to: - Require owners to approve changes. Combine protected branches with Code Owners to require experts to approve merge requests before they merge into a protected branch. For more information, see [Code Owners and protected branches](#code-owners-and-protected-branches). - Identify owners. Code Owner names are displayed on the files and directories they own: ![Code Owners displayed in UI](img/codeowners_in_UI_v15_10.png) ## Code Owners and approval rules Combine Code Owners with merge request [approval rules](../merge_requests/approvals/rules.md) (either optional or required) to build a flexible approval workflow: - Use Code Owners to ensure quality. Define the users who have domain expertise for specific paths in your repository. - Use approval rules to define areas of expertise that don't correspond to specific file paths in your repository. Approval rules help guide merge request creators to the correct set of reviewers, such as frontend developers or a security team. For example: | Type | Name | Scope | Comment | |------|------|--------|------------| | Approval rule | UX | All files | A user experience (UX) team member reviews the user experience of all changes made in your project. | | Approval rule | Security | All files | A security team member reviews all changes for vulnerabilities. | | Code Owner approval rule | Frontend: Code Style | `*.css` files | A frontend engineer reviews CSS file changes for adherence to project style standards. | | Code Owner approval rule | Backend: Code Review | `*.rb` files | A backend engineer reviews the logic and code style of Ruby files. | <div class="video-fallback"> Video introduction: <a href="https://www.youtube.com/watch?v=RoyBySTUSB0">Code Owners</a>. </div> <figure class="video-container"> <iframe src="https://www.youtube-nocookie.com/embed/RoyBySTUSB0" frameborder="0" allowfullscreen> </iframe> </figure> For information about who is eligible to approve merge requests as either an approver or Code Owner, see [Approver by membership type](../merge_requests/approvals/rules.md#approver-by-membership-type). ## Code Owners and protected branches To ensure merge request changes are reviewed and approved by Code Owners, specified in the [`CODEOWNERS` file](#codeowners-file), the merge request's target branch must be [protected](../repository/branches/protected.md) and [Code Owner approval](../repository/branches/protected.md#require-code-owner-approval) must be enabled. The following features are available when you enable Code Owner approvals on protected branches: - [Require approvals from Code Owners](../repository/branches/protected.md#require-code-owner-approval). - [Require multiple approvals from Code Owners](advanced.md#require-multiple-approvals-from-code-owners). - [Optional approvals from Code Owners](reference.md#optional-sections). ### Practical example Your project contains sensitive and important information in a `config/` directory. You can: 1. Assign ownership of the directory. To do this, set up a `CODEOWNERS` file. 1. Create a protected branch for your default branch. For example, `main`. 1. Enable **Required approval from code owners** on the protected branch. 1. Optional. Edit the `CODEOWNERS` file to add a rule for multiple approvals. With this configuration, merge requests that change files in the `config/`directory and target the `main` branch require approval from the designated Code Owners before merging. ### Allowed to push and merge to a protected branch Users who are **Allowed to push and merge** can choose to create a merge request for their changes, or push the changes directly to a branch. If the user skips the merge request process, the protected branch features and Code Owner approvals built into merge requests are also skipped. This permission is often granted to accounts associated with automation ([internal users](../../../administration/internal_users.md)) and release tooling. All changes from users without the **Allowed to push** permission must be routed through a merge request. ## View Code Owners of a file or directory To view the Code Owners of a file or directory: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Code > Repository**. 1. Go to the file or directory you want to see the Code Owners for. 1. Optional. Select a branch or tag. GitLab shows the Code Owners at the top of the page. ## Set up Code Owners Prerequisites: - You must have permissions to push to the default branch or to create a merge request. 1. Create a `CODEOWNERS` file in your [preferred location](#codeowners-file). 1. Define some rules in the file following the [`CODEOWNERS` syntax](reference.md). Some suggestions: - Configure [All eligible approvers](../merge_requests/approvals/rules.md#code-owners-as-approvers) approval rule. - [Require Code Owner approval](../repository/branches/protected.md#require-code-owner-approval) on a protected branch. 1. Commit your changes, and push them up to GitLab. ## `CODEOWNERS` file The `CODEOWNERS` file defines who is responsible for code in a GitLab project. Its purpose is to: - Define Code Owners for specific files and directories. - Enforce approval requirements for protected branches. - Communicate code ownership in a project. This file determines who should review and approve changes and ensures the right experts are involved in code changes. Each repository uses a single `CODEOWNERS` file. GitLab checks these locations in your repository in this order. The first `CODEOWNERS` file found is used, and all others are ignored: 1. In the root directory: `./CODEOWNERS`. 1. In the `docs` directory: `./docs/CODEOWNERS`. 1. In the `.gitlab` directory: `./.gitlab/CODEOWNERS`. For more information, see [`CODEOWNERS` syntax](reference.md) and [Advanced `CODEOWNERS` configuration](advanced.md). ## Related topics - [`CODEOWNERS` syntax](reference.md) - [Advanced `CODEOWNERS` configuration](advanced.md) - [Protected branches](../repository/branches/protected.md) - [Troubleshooting Code Owners](troubleshooting.md)
--- stage: Create group: Source Code info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments description: Use Code Owners to define experts for your codebase, and set review requirements based on file type or location. title: Code Owners breadcrumbs: - doc - user - project - codeowners --- {{< details >}} - Tier: Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} Use the Code Owners feature to define who has expertise for specific parts of your project's codebase. Define the owners of files and directories in a repository to: - Require owners to approve changes. Combine protected branches with Code Owners to require experts to approve merge requests before they merge into a protected branch. For more information, see [Code Owners and protected branches](#code-owners-and-protected-branches). - Identify owners. Code Owner names are displayed on the files and directories they own: ![Code Owners displayed in UI](img/codeowners_in_UI_v15_10.png) ## Code Owners and approval rules Combine Code Owners with merge request [approval rules](../merge_requests/approvals/rules.md) (either optional or required) to build a flexible approval workflow: - Use Code Owners to ensure quality. Define the users who have domain expertise for specific paths in your repository. - Use approval rules to define areas of expertise that don't correspond to specific file paths in your repository. Approval rules help guide merge request creators to the correct set of reviewers, such as frontend developers or a security team. For example: | Type | Name | Scope | Comment | |------|------|--------|------------| | Approval rule | UX | All files | A user experience (UX) team member reviews the user experience of all changes made in your project. | | Approval rule | Security | All files | A security team member reviews all changes for vulnerabilities. | | Code Owner approval rule | Frontend: Code Style | `*.css` files | A frontend engineer reviews CSS file changes for adherence to project style standards. | | Code Owner approval rule | Backend: Code Review | `*.rb` files | A backend engineer reviews the logic and code style of Ruby files. | <div class="video-fallback"> Video introduction: <a href="https://www.youtube.com/watch?v=RoyBySTUSB0">Code Owners</a>. </div> <figure class="video-container"> <iframe src="https://www.youtube-nocookie.com/embed/RoyBySTUSB0" frameborder="0" allowfullscreen> </iframe> </figure> For information about who is eligible to approve merge requests as either an approver or Code Owner, see [Approver by membership type](../merge_requests/approvals/rules.md#approver-by-membership-type). ## Code Owners and protected branches To ensure merge request changes are reviewed and approved by Code Owners, specified in the [`CODEOWNERS` file](#codeowners-file), the merge request's target branch must be [protected](../repository/branches/protected.md) and [Code Owner approval](../repository/branches/protected.md#require-code-owner-approval) must be enabled. The following features are available when you enable Code Owner approvals on protected branches: - [Require approvals from Code Owners](../repository/branches/protected.md#require-code-owner-approval). - [Require multiple approvals from Code Owners](advanced.md#require-multiple-approvals-from-code-owners). - [Optional approvals from Code Owners](reference.md#optional-sections). ### Practical example Your project contains sensitive and important information in a `config/` directory. You can: 1. Assign ownership of the directory. To do this, set up a `CODEOWNERS` file. 1. Create a protected branch for your default branch. For example, `main`. 1. Enable **Required approval from code owners** on the protected branch. 1. Optional. Edit the `CODEOWNERS` file to add a rule for multiple approvals. With this configuration, merge requests that change files in the `config/`directory and target the `main` branch require approval from the designated Code Owners before merging. ### Allowed to push and merge to a protected branch Users who are **Allowed to push and merge** can choose to create a merge request for their changes, or push the changes directly to a branch. If the user skips the merge request process, the protected branch features and Code Owner approvals built into merge requests are also skipped. This permission is often granted to accounts associated with automation ([internal users](../../../administration/internal_users.md)) and release tooling. All changes from users without the **Allowed to push** permission must be routed through a merge request. ## View Code Owners of a file or directory To view the Code Owners of a file or directory: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Code > Repository**. 1. Go to the file or directory you want to see the Code Owners for. 1. Optional. Select a branch or tag. GitLab shows the Code Owners at the top of the page. ## Set up Code Owners Prerequisites: - You must have permissions to push to the default branch or to create a merge request. 1. Create a `CODEOWNERS` file in your [preferred location](#codeowners-file). 1. Define some rules in the file following the [`CODEOWNERS` syntax](reference.md). Some suggestions: - Configure [All eligible approvers](../merge_requests/approvals/rules.md#code-owners-as-approvers) approval rule. - [Require Code Owner approval](../repository/branches/protected.md#require-code-owner-approval) on a protected branch. 1. Commit your changes, and push them up to GitLab. ## `CODEOWNERS` file The `CODEOWNERS` file defines who is responsible for code in a GitLab project. Its purpose is to: - Define Code Owners for specific files and directories. - Enforce approval requirements for protected branches. - Communicate code ownership in a project. This file determines who should review and approve changes and ensures the right experts are involved in code changes. Each repository uses a single `CODEOWNERS` file. GitLab checks these locations in your repository in this order. The first `CODEOWNERS` file found is used, and all others are ignored: 1. In the root directory: `./CODEOWNERS`. 1. In the `docs` directory: `./docs/CODEOWNERS`. 1. In the `.gitlab` directory: `./.gitlab/CODEOWNERS`. For more information, see [`CODEOWNERS` syntax](reference.md) and [Advanced `CODEOWNERS` configuration](advanced.md). ## Related topics - [`CODEOWNERS` syntax](reference.md) - [Advanced `CODEOWNERS` configuration](advanced.md) - [Protected branches](../repository/branches/protected.md) - [Troubleshooting Code Owners](troubleshooting.md)
https://docs.gitlab.com/user/project/clusters
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/_index.md
2025-08-13
doc/user/project/clusters
[ "doc", "user", "project", "clusters" ]
_index.md
Deploy
Environments
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Project-level Kubernetes clusters (certificate-based) (deprecated)
null
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed {{< /details >}} {{< alert type="warning" >}} This feature was [deprecated](https://gitlab.com/groups/gitlab-org/configure/-/epics/8) in GitLab 14.5. To connect clusters to GitLab, use the [GitLab agent for Kubernetes](../../clusters/agent/_index.md). {{< /alert >}} [Project-level](../../infrastructure/clusters/connect/_index.md#cluster-levels-deprecated) Kubernetes clusters allow you to connect a Kubernetes cluster to a project in GitLab. You can also [connect multiple clusters](multiple_kubernetes_clusters.md) to a single project. ## View your project-level clusters To view project-level Kubernetes clusters: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Operate > Kubernetes clusters**.
--- stage: Deploy group: Environments info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments title: Project-level Kubernetes clusters (certificate-based) (deprecated) breadcrumbs: - doc - user - project - clusters --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed {{< /details >}} {{< alert type="warning" >}} This feature was [deprecated](https://gitlab.com/groups/gitlab-org/configure/-/epics/8) in GitLab 14.5. To connect clusters to GitLab, use the [GitLab agent for Kubernetes](../../clusters/agent/_index.md). {{< /alert >}} [Project-level](../../infrastructure/clusters/connect/_index.md#cluster-levels-deprecated) Kubernetes clusters allow you to connect a Kubernetes cluster to a project in GitLab. You can also [connect multiple clusters](multiple_kubernetes_clusters.md) to a single project. ## View your project-level clusters To view project-level Kubernetes clusters: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Operate > Kubernetes clusters**.
https://docs.gitlab.com/user/project/add_remove_clusters
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/add_remove_clusters.md
2025-08-13
doc/user/project/clusters
[ "doc", "user", "project", "clusters" ]
add_remove_clusters.md
Deploy
Environments
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Add a cluster using cluster certificates (deprecated)
null
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed {{< /details >}} {{< history >}} - [Deprecated](https://gitlab.com/gitlab-org/gitlab/-/issues/327908) in GitLab 14.0. {{< /history >}} {{< alert type="warning" >}} This feature was [deprecated](https://gitlab.com/gitlab-org/gitlab/-/issues/327908) in GitLab 14.0. To create and manage a new cluster use [Infrastructure as Code](../../infrastructure/iac/_index.md). {{< /alert >}} ## Disable a cluster When you successfully connect an existing cluster using cluster certificates, the cluster connection to GitLab becomes enabled. To disable it: 1. Go to your: - Project's {{< icon name="cloud-gear" >}} **Operate > Kubernetes clusters** page, for a project-level cluster. - Group's {{< icon name="cloud-gear" >}} **Kubernetes** page, for a group-level cluster. - The **Admin** area's **Kubernetes** page, for an instance-level cluster. 1. Select the name of the cluster you want to disable. 1. Toggle **GitLab Integration** off (in gray). 1. Select **Save changes**. ## Remove a cluster When you remove a cluster integration, you only remove the cluster relationship to GitLab, not the cluster. To remove the cluster itself, go to your cluster's GKE or EKS dashboard to do it from their UI or use `kubectl`. You need at least Maintainer [permissions](../../permissions.md) to your project or group to remove the integration with GitLab. When removing a cluster integration, you have two options: - **Remove integration**: remove only the Kubernetes integration. - **Remove integration and resources**: remove the cluster integration and all GitLab cluster-related resources such as namespaces, roles, and bindings. To remove the Kubernetes cluster integration: 1. Go to your cluster details page. 1. Select the **Advanced Settings** tab. 1. Select either **Remove integration** or **Remove integration and resources**. ### Remove clusters by using the Rails console {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab Self-Managed, GitLab Dedicated {{< /details >}} [Start a Rails console session](../../../administration/operations/rails_console.md#starting-a-rails-console-session). To find a cluster: ``` ruby cluster = Clusters::Cluster.find(1) cluster = Clusters::Cluster.find_by(name: 'cluster_name') ``` To delete a cluster but not the associated resources: ```ruby # Find users who have administrator access user = User.find_by(username: 'admin_user') # Find the cluster with the ID cluster = Clusters::Cluster.find(1) # Delete the cluster Clusters::DestroyService.new(user).execute(cluster) ```
--- stage: Deploy group: Environments info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments title: Add a cluster using cluster certificates (deprecated) breadcrumbs: - doc - user - project - clusters --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed {{< /details >}} {{< history >}} - [Deprecated](https://gitlab.com/gitlab-org/gitlab/-/issues/327908) in GitLab 14.0. {{< /history >}} {{< alert type="warning" >}} This feature was [deprecated](https://gitlab.com/gitlab-org/gitlab/-/issues/327908) in GitLab 14.0. To create and manage a new cluster use [Infrastructure as Code](../../infrastructure/iac/_index.md). {{< /alert >}} ## Disable a cluster When you successfully connect an existing cluster using cluster certificates, the cluster connection to GitLab becomes enabled. To disable it: 1. Go to your: - Project's {{< icon name="cloud-gear" >}} **Operate > Kubernetes clusters** page, for a project-level cluster. - Group's {{< icon name="cloud-gear" >}} **Kubernetes** page, for a group-level cluster. - The **Admin** area's **Kubernetes** page, for an instance-level cluster. 1. Select the name of the cluster you want to disable. 1. Toggle **GitLab Integration** off (in gray). 1. Select **Save changes**. ## Remove a cluster When you remove a cluster integration, you only remove the cluster relationship to GitLab, not the cluster. To remove the cluster itself, go to your cluster's GKE or EKS dashboard to do it from their UI or use `kubectl`. You need at least Maintainer [permissions](../../permissions.md) to your project or group to remove the integration with GitLab. When removing a cluster integration, you have two options: - **Remove integration**: remove only the Kubernetes integration. - **Remove integration and resources**: remove the cluster integration and all GitLab cluster-related resources such as namespaces, roles, and bindings. To remove the Kubernetes cluster integration: 1. Go to your cluster details page. 1. Select the **Advanced Settings** tab. 1. Select either **Remove integration** or **Remove integration and resources**. ### Remove clusters by using the Rails console {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab Self-Managed, GitLab Dedicated {{< /details >}} [Start a Rails console session](../../../administration/operations/rails_console.md#starting-a-rails-console-session). To find a cluster: ``` ruby cluster = Clusters::Cluster.find(1) cluster = Clusters::Cluster.find_by(name: 'cluster_name') ``` To delete a cluster but not the associated resources: ```ruby # Find users who have administrator access user = User.find_by(username: 'admin_user') # Find the cluster with the ID cluster = Clusters::Cluster.find(1) # Delete the cluster Clusters::DestroyService.new(user).execute(cluster) ```
https://docs.gitlab.com/user/project/gitlab_managed_clusters
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/gitlab_managed_clusters.md
2025-08-13
doc/user/project/clusters
[ "doc", "user", "project", "clusters" ]
gitlab_managed_clusters.md
Deploy
Environments
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
GitLab-managed clusters (deprecated)
null
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed {{< /details >}} {{< history >}} - [Disabled on GitLab Self-Managed](https://gitlab.com/gitlab-org/gitlab/-/issues/353410) in GitLab 15.0. {{< /history >}} {{< alert type="warning" >}} This feature was [deprecated](https://gitlab.com/groups/gitlab-org/configure/-/epics/8) in GitLab 14.5. To connect your cluster to GitLab, use the [GitLab agent for Kubernetes](../../clusters/agent/_index.md). To manage applications, use the [Cluster Project Management Template](../../clusters/management_project_template.md). {{< /alert >}} {{< alert type="flag" >}} On GitLab Self-Managed, by default this feature is not available. To make it available, an administrator can [enable the feature flag](../../../administration/feature_flags/_index.md) named `certificate_based_clusters`. {{< /alert >}} You can choose to allow GitLab to manage your cluster for you. If your cluster is managed by GitLab, resources for your projects are automatically created. See the [Access controls](cluster_access.md) section for details about the created resources. If you choose to manage your own cluster, project-specific resources aren't created automatically. If you are using [Auto DevOps](../../../topics/autodevops/_index.md), you must explicitly provide the `KUBE_NAMESPACE` [deployment variable](deploy_to_cluster.md#deployment-variables) for your deployment jobs to use. Otherwise, a namespace is created for you. {{< alert type="warning" >}} Be aware that manually managing resources that have been created by GitLab, like namespaces and service accounts, can cause unexpected errors. If this occurs, try [clearing the cluster cache](#clearing-the-cluster-cache). {{< /alert >}} ## Clearing the cluster cache If you allow GitLab to manage your cluster, GitLab stores a cached version of the namespaces and service accounts it creates for your projects. If you modify these resources in your cluster manually, this cache can fall out of sync with your cluster. This can cause deployment jobs to fail. To clear the cache: 1. Go to your project's **Operate > Kubernetes clusters** page, and select your cluster. 1. Expand the **Advanced settings** section. 1. Select **Clear cluster cache**. ## Base domain Specifying a base domain automatically sets `KUBE_INGRESS_BASE_DOMAIN` as a deployment variable. If you are using [Auto DevOps](../../../topics/autodevops/_index.md), this domain is used for the different stages. For example, Auto Review Apps and Auto Deploy. The domain should have a wildcard DNS configured to the Ingress IP address. You can either: - Create an `A` record that points to the Ingress IP address with your domain provider. - Enter a wildcard DNS address using a service such as `nip.io` or `xip.io`. For example, `192.168.1.1.xip.io`. To determine the external Ingress IP address, or external Ingress hostname: - If the cluster is on GKE: 1. Select the **Google Kubernetes Engine** link in the **Advanced settings**, or go directly to the [Google Kubernetes Engine dashboard](https://console.cloud.google.com/kubernetes/). 1. Select the proper project and cluster. 1. Select **Connect**. 1. Execute the `gcloud` command in a local terminal or using the **Cloud Shell**. - If the cluster is not on GKE: Follow the specific instructions for your Kubernetes provider to configure `kubectl` with the right credentials. The output of the following examples show the external endpoint of your cluster. This information can then be used to set up DNS entries and forwarding rules that allow external access to your deployed applications. Depending on your Ingress, the external IP address can be retrieved in various ways. This list provides a generic solution, and some GitLab-specific approaches: - In general, you can list the IP addresses of all load balancers by running: ```shell kubectl get svc --all-namespaces -o jsonpath='{range.items[?(@.status.loadBalancer.ingress)]}{.status.loadBalancer.ingress[*].ip} ' ``` - If you installed Ingress using the **Applications**, run: ```shell kubectl get service --namespace=gitlab-managed-apps ingress-nginx-ingress-controller -o jsonpath='{.status.loadBalancer.ingress[0].ip}' ``` - Some Kubernetes clusters return a hostname instead, like [Amazon EKS](https://aws.amazon.com/eks/). For these platforms, run: ```shell kubectl get service --namespace=gitlab-managed-apps ingress-nginx-ingress-controller -o jsonpath='{.status.loadBalancer.ingress[0].hostname}' ``` If you use EKS, an [Elastic Load Balancer](https://docs.aws.amazon.com/elasticloadbalancing/) is also created, which incurs additional AWS costs. - Istio/Knative uses a different command. Run: ```shell kubectl get svc --namespace=istio-system istio-ingressgateway -o jsonpath='{.status.loadBalancer.ingress[0].ip} ' ``` If you see a trailing `%` on some Kubernetes versions, do not include it.
--- stage: Deploy group: Environments info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments title: GitLab-managed clusters (deprecated) breadcrumbs: - doc - user - project - clusters --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed {{< /details >}} {{< history >}} - [Disabled on GitLab Self-Managed](https://gitlab.com/gitlab-org/gitlab/-/issues/353410) in GitLab 15.0. {{< /history >}} {{< alert type="warning" >}} This feature was [deprecated](https://gitlab.com/groups/gitlab-org/configure/-/epics/8) in GitLab 14.5. To connect your cluster to GitLab, use the [GitLab agent for Kubernetes](../../clusters/agent/_index.md). To manage applications, use the [Cluster Project Management Template](../../clusters/management_project_template.md). {{< /alert >}} {{< alert type="flag" >}} On GitLab Self-Managed, by default this feature is not available. To make it available, an administrator can [enable the feature flag](../../../administration/feature_flags/_index.md) named `certificate_based_clusters`. {{< /alert >}} You can choose to allow GitLab to manage your cluster for you. If your cluster is managed by GitLab, resources for your projects are automatically created. See the [Access controls](cluster_access.md) section for details about the created resources. If you choose to manage your own cluster, project-specific resources aren't created automatically. If you are using [Auto DevOps](../../../topics/autodevops/_index.md), you must explicitly provide the `KUBE_NAMESPACE` [deployment variable](deploy_to_cluster.md#deployment-variables) for your deployment jobs to use. Otherwise, a namespace is created for you. {{< alert type="warning" >}} Be aware that manually managing resources that have been created by GitLab, like namespaces and service accounts, can cause unexpected errors. If this occurs, try [clearing the cluster cache](#clearing-the-cluster-cache). {{< /alert >}} ## Clearing the cluster cache If you allow GitLab to manage your cluster, GitLab stores a cached version of the namespaces and service accounts it creates for your projects. If you modify these resources in your cluster manually, this cache can fall out of sync with your cluster. This can cause deployment jobs to fail. To clear the cache: 1. Go to your project's **Operate > Kubernetes clusters** page, and select your cluster. 1. Expand the **Advanced settings** section. 1. Select **Clear cluster cache**. ## Base domain Specifying a base domain automatically sets `KUBE_INGRESS_BASE_DOMAIN` as a deployment variable. If you are using [Auto DevOps](../../../topics/autodevops/_index.md), this domain is used for the different stages. For example, Auto Review Apps and Auto Deploy. The domain should have a wildcard DNS configured to the Ingress IP address. You can either: - Create an `A` record that points to the Ingress IP address with your domain provider. - Enter a wildcard DNS address using a service such as `nip.io` or `xip.io`. For example, `192.168.1.1.xip.io`. To determine the external Ingress IP address, or external Ingress hostname: - If the cluster is on GKE: 1. Select the **Google Kubernetes Engine** link in the **Advanced settings**, or go directly to the [Google Kubernetes Engine dashboard](https://console.cloud.google.com/kubernetes/). 1. Select the proper project and cluster. 1. Select **Connect**. 1. Execute the `gcloud` command in a local terminal or using the **Cloud Shell**. - If the cluster is not on GKE: Follow the specific instructions for your Kubernetes provider to configure `kubectl` with the right credentials. The output of the following examples show the external endpoint of your cluster. This information can then be used to set up DNS entries and forwarding rules that allow external access to your deployed applications. Depending on your Ingress, the external IP address can be retrieved in various ways. This list provides a generic solution, and some GitLab-specific approaches: - In general, you can list the IP addresses of all load balancers by running: ```shell kubectl get svc --all-namespaces -o jsonpath='{range.items[?(@.status.loadBalancer.ingress)]}{.status.loadBalancer.ingress[*].ip} ' ``` - If you installed Ingress using the **Applications**, run: ```shell kubectl get service --namespace=gitlab-managed-apps ingress-nginx-ingress-controller -o jsonpath='{.status.loadBalancer.ingress[0].ip}' ``` - Some Kubernetes clusters return a hostname instead, like [Amazon EKS](https://aws.amazon.com/eks/). For these platforms, run: ```shell kubectl get service --namespace=gitlab-managed-apps ingress-nginx-ingress-controller -o jsonpath='{.status.loadBalancer.ingress[0].hostname}' ``` If you use EKS, an [Elastic Load Balancer](https://docs.aws.amazon.com/elasticloadbalancing/) is also created, which incurs additional AWS costs. - Istio/Knative uses a different command. Run: ```shell kubectl get svc --namespace=istio-system istio-ingressgateway -o jsonpath='{.status.loadBalancer.ingress[0].ip} ' ``` If you see a trailing `%` on some Kubernetes versions, do not include it.
https://docs.gitlab.com/user/project/cluster_access
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/cluster_access.md
2025-08-13
doc/user/project/clusters
[ "doc", "user", "project", "clusters" ]
cluster_access.md
Deploy
Environments
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Access controls with cluster certificates (RBAC or ABAC) (deprecated)
null
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed {{< /details >}} {{< alert type="warning" >}} This feature was [deprecated](https://gitlab.com/groups/gitlab-org/configure/-/epics/8) in GitLab 14.5. To connect your cluster to GitLab, use the [GitLab agent for Kubernetes](../../clusters/agent/_index.md) instead. {{< /alert >}} When creating a cluster in GitLab, you are asked if you would like to create either: - A [Role-based access control (RBAC)](https://kubernetes.io/docs/reference/access-authn-authz/rbac/) cluster, which is the GitLab default and recommended option. - An [Attribute-based access control (ABAC)](https://kubernetes.io/docs/reference/access-authn-authz/abac/) cluster. When GitLab creates the cluster, a `gitlab` service account with `cluster-admin` privileges is created in the `default` namespace to manage the newly created cluster. Helm also creates additional service accounts and other resources for each installed application. Consult the documentation of the Helm charts for each application for details. If you are [adding an existing Kubernetes cluster](add_existing_cluster.md), ensure the token of the account has administrator privileges for the cluster. The resources created by GitLab differ depending on the type of cluster. ## Important notes Note the following about access controls: - Environment-specific resources are only created if your cluster is [managed by GitLab](gitlab_managed_clusters.md). - If your cluster was created before GitLab 12.2, it uses a single namespace for all project environments. ## RBAC cluster resources GitLab creates the following resources for RBAC clusters. | Name | Type | Details | Created when | |:----------------------|:---------------------|:-----------------------------------------------------------------------------------------------------------|:-----------------------| | `gitlab` | `ServiceAccount` | `default` namespace | Creating a new cluster | | `gitlab-admin` | `ClusterRoleBinding` | [`cluster-admin`](https://kubernetes.io/docs/reference/access-authn-authz/rbac/#user-facing-roles) role | Creating a new cluster | | `gitlab-token` | `Secret` | Token for `gitlab` ServiceAccount | Creating a new cluster | | Environment namespace | `Namespace` | Contains all environment-specific resources | Deploying to a cluster | | Environment namespace | `ServiceAccount` | Uses namespace of environment | Deploying to a cluster | | Environment namespace | `Secret` | Token for environment ServiceAccount | Deploying to a cluster | | Environment namespace | `RoleBinding` | [`admin`](https://kubernetes.io/docs/reference/access-authn-authz/rbac/#user-facing-roles) role | Deploying to a cluster | ## ABAC cluster resources GitLab creates the following resources for ABAC clusters. | Name | Type | Details | Created when | |:----------------------|:---------------------|:-------------------------------------|:---------------------------| | `gitlab` | `ServiceAccount` | `default` namespace | Creating a new cluster | | `gitlab-token` | `Secret` | Token for `gitlab` ServiceAccount | Creating a new cluster | | Environment namespace | `Namespace` | Contains all environment-specific resources | Deploying to a cluster | | Environment namespace | `ServiceAccount` | Uses namespace of environment | Deploying to a cluster | | Environment namespace | `Secret` | Token for environment ServiceAccount | Deploying to a cluster | ## Security of runners Runners have the [privileged mode](https://docs.gitlab.com/runner/executors/docker.html#the-privileged-mode) enabled by default, which allows them to execute special commands and run Docker in Docker. This functionality is needed to run some of the [Auto DevOps](../../../topics/autodevops/_index.md) jobs. This implies the containers are running in privileged mode and you should, therefore, be aware of some important details. The privileged flag gives all capabilities to the running container, which in turn can do almost everything that the host can do. Be aware of the inherent security risk associated with performing `docker run` operations on arbitrary images as they effectively have root access. If you don't want to use a runner in privileged mode, either: - Use instance runners on GitLab.com. They don't have this security issue. - Set up your own runners that use [`docker+machine`](https://docs.gitlab.com/runner/executors/docker_machine.html).
--- stage: Deploy group: Environments info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments title: Access controls with cluster certificates (RBAC or ABAC) (deprecated) breadcrumbs: - doc - user - project - clusters --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed {{< /details >}} {{< alert type="warning" >}} This feature was [deprecated](https://gitlab.com/groups/gitlab-org/configure/-/epics/8) in GitLab 14.5. To connect your cluster to GitLab, use the [GitLab agent for Kubernetes](../../clusters/agent/_index.md) instead. {{< /alert >}} When creating a cluster in GitLab, you are asked if you would like to create either: - A [Role-based access control (RBAC)](https://kubernetes.io/docs/reference/access-authn-authz/rbac/) cluster, which is the GitLab default and recommended option. - An [Attribute-based access control (ABAC)](https://kubernetes.io/docs/reference/access-authn-authz/abac/) cluster. When GitLab creates the cluster, a `gitlab` service account with `cluster-admin` privileges is created in the `default` namespace to manage the newly created cluster. Helm also creates additional service accounts and other resources for each installed application. Consult the documentation of the Helm charts for each application for details. If you are [adding an existing Kubernetes cluster](add_existing_cluster.md), ensure the token of the account has administrator privileges for the cluster. The resources created by GitLab differ depending on the type of cluster. ## Important notes Note the following about access controls: - Environment-specific resources are only created if your cluster is [managed by GitLab](gitlab_managed_clusters.md). - If your cluster was created before GitLab 12.2, it uses a single namespace for all project environments. ## RBAC cluster resources GitLab creates the following resources for RBAC clusters. | Name | Type | Details | Created when | |:----------------------|:---------------------|:-----------------------------------------------------------------------------------------------------------|:-----------------------| | `gitlab` | `ServiceAccount` | `default` namespace | Creating a new cluster | | `gitlab-admin` | `ClusterRoleBinding` | [`cluster-admin`](https://kubernetes.io/docs/reference/access-authn-authz/rbac/#user-facing-roles) role | Creating a new cluster | | `gitlab-token` | `Secret` | Token for `gitlab` ServiceAccount | Creating a new cluster | | Environment namespace | `Namespace` | Contains all environment-specific resources | Deploying to a cluster | | Environment namespace | `ServiceAccount` | Uses namespace of environment | Deploying to a cluster | | Environment namespace | `Secret` | Token for environment ServiceAccount | Deploying to a cluster | | Environment namespace | `RoleBinding` | [`admin`](https://kubernetes.io/docs/reference/access-authn-authz/rbac/#user-facing-roles) role | Deploying to a cluster | ## ABAC cluster resources GitLab creates the following resources for ABAC clusters. | Name | Type | Details | Created when | |:----------------------|:---------------------|:-------------------------------------|:---------------------------| | `gitlab` | `ServiceAccount` | `default` namespace | Creating a new cluster | | `gitlab-token` | `Secret` | Token for `gitlab` ServiceAccount | Creating a new cluster | | Environment namespace | `Namespace` | Contains all environment-specific resources | Deploying to a cluster | | Environment namespace | `ServiceAccount` | Uses namespace of environment | Deploying to a cluster | | Environment namespace | `Secret` | Token for environment ServiceAccount | Deploying to a cluster | ## Security of runners Runners have the [privileged mode](https://docs.gitlab.com/runner/executors/docker.html#the-privileged-mode) enabled by default, which allows them to execute special commands and run Docker in Docker. This functionality is needed to run some of the [Auto DevOps](../../../topics/autodevops/_index.md) jobs. This implies the containers are running in privileged mode and you should, therefore, be aware of some important details. The privileged flag gives all capabilities to the running container, which in turn can do almost everything that the host can do. Be aware of the inherent security risk associated with performing `docker run` operations on arbitrary images as they effectively have root access. If you don't want to use a runner in privileged mode, either: - Use instance runners on GitLab.com. They don't have this security issue. - Set up your own runners that use [`docker+machine`](https://docs.gitlab.com/runner/executors/docker_machine.html).
https://docs.gitlab.com/user/project/add_existing_cluster
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/add_existing_cluster.md
2025-08-13
doc/user/project/clusters
[ "doc", "user", "project", "clusters" ]
add_existing_cluster.md
Deploy
Environments
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Connect existing clusters through cluster certificates (deprecated)
null
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed {{< /details >}} {{< history >}} - [Deprecated](https://gitlab.com/groups/gitlab-org/configure/-/epics/8) in GitLab 14.5. {{< /history >}} {{< alert type="warning" >}} This feature was [deprecated](https://gitlab.com/groups/gitlab-org/configure/-/epics/8) in GitLab 14.5. To connect your cluster to GitLab, use the [GitLab agent for Kubernetes](../../clusters/agent/_index.md) instead. {{< /alert >}} If you have an existing Kubernetes cluster, you can add it to a project, group, or instance and benefit from the integration with GitLab. ## Prerequisites See the prerequisites below to add existing clusters to GitLab. ### All clusters To add any cluster to GitLab, you need: - An account on a GitLab.com or GitLab Self-Managed instance. - The Maintainer role for group-level and project-level clusters. - Access to the **Admin** area for instance-level clusters. - A Kubernetes cluster. - Cluster administration access to the cluster with `kubectl`. You can host your cluster in [EKS](#eks-clusters), [GKE](#gke-clusters), on premises, and with other providers. To host them on premises and with other providers, use either the EKS or GKE method to guide you through and enter your cluster's settings manually. {{< alert type="warning" >}} GitLab doesn't support `arm64` clusters. See the issue [Helm Tiller fails to install on `arm64` cluster](https://gitlab.com/gitlab-org/gitlab/-/issues/29838) for details. {{< /alert >}} ### EKS clusters To add an existing **EKS** cluster, you need: - An Amazon EKS cluster with worker nodes properly configured. - `kubectl` [installed and configured](https://docs.aws.amazon.com/eks/latest/userguide/getting-started.html#get-started-kubectl) for access to the EKS cluster. - Ensure the token of the account has administrator privileges for the cluster. ### GKE clusters To add an existing **GKE** cluster, you need: - The `container.clusterRoleBindings.create` permission to create a cluster role binding. You can follow the [Google Cloud documentation](https://cloud.google.com/iam/docs/granting-changing-revoking-access) to grant access. ## How to add an existing cluster <!-- (REVISE - BREAK INTO SMALLER STEPS) --> To add a Kubernetes cluster to your project, group, or instance: 1. Go to your: 1. Project's {{< icon name="cloud-gear" >}} **Operate > Kubernetes clusters** page, for a project-level cluster. 1. Group's {{< icon name="cloud-gear" >}} **Kubernetes** page, for a group-level cluster. 1. The **Admin** area's **Kubernetes** page, for an instance-level cluster. 1. On the **Kubernetes clusters** page, select the **Connect with a certificate** option from the **Actions** dropdown list. 1. On the **Connect a cluster** page, fill in the details: 1. **Kubernetes cluster name** (required) - The name you wish to give the cluster. 1. **Environment scope** (required) - The [associated environment](multiple_kubernetes_clusters.md#setting-the-environment-scope) to this cluster. 1. **API URL** (required) - It's the URL that GitLab uses to access the Kubernetes API. Kubernetes exposes several APIs, we want the "base" URL that is common to all of them. For example, `https://kubernetes.example.com` rather than `https://kubernetes.example.com/api/v1`. Get the API URL by running this command: ```shell kubectl cluster-info | grep -E 'Kubernetes master|Kubernetes control plane' | awk '/http/ {print $NF}' ``` 1. **CA certificate** (required) - A valid Kubernetes certificate is needed to authenticate to the cluster. We use the certificate created by default. 1. List the secrets with `kubectl get secrets`, and one should be named similar to `default-token-xxxxx`. Copy that token name for use below. 1. Get the certificate by running this command: ```shell kubectl get secret <secret name> -o jsonpath="{['data']['ca\.crt']}" | base64 --decode ``` If the command returns the entire certificate chain, you must copy the Root CA certificate and any intermediate certificates at the bottom of the chain. A chain file has following structure: ```plaintext -----BEGIN MY CERTIFICATE----- -----END MY CERTIFICATE----- -----BEGIN INTERMEDIATE CERTIFICATE----- -----END INTERMEDIATE CERTIFICATE----- -----BEGIN INTERMEDIATE CERTIFICATE----- -----END INTERMEDIATE CERTIFICATE----- -----BEGIN ROOT CERTIFICATE----- -----END ROOT CERTIFICATE----- ``` 1. **Token** - GitLab authenticates against Kubernetes using service tokens, which are scoped to a particular `namespace`. **The token used should belong to a service account with [`cluster-admin`](https://kubernetes.io/docs/reference/access-authn-authz/rbac/#user-facing-roles) privileges**. To create this service account: 1. Create a file called `gitlab-admin-service-account.yaml` with contents: ```yaml apiVersion: v1 kind: ServiceAccount metadata: name: gitlab namespace: kube-system --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: name: gitlab-admin roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole name: cluster-admin subjects: - kind: ServiceAccount name: gitlab namespace: kube-system ``` 1. Apply the service account and cluster role binding to your cluster: ```shell kubectl apply -f gitlab-admin-service-account.yaml ``` You need the `container.clusterRoleBindings.create` permission to create cluster-level roles. If you do not have this permission, you can alternatively enable Basic Authentication and then run the `kubectl apply` command as an administrator: ```shell kubectl apply -f gitlab-admin-service-account.yaml --username=admin --password=<password> ``` {{< alert type="note" >}} Basic Authentication can be turned on and the password credentials can be obtained using the Google Cloud Console. {{< /alert >}} Output: ```shell serviceaccount "gitlab" created clusterrolebinding "gitlab-admin" created ``` 1. Retrieve the token for the `gitlab` service account: ```shell kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep gitlab | awk '{print $1}') ``` Copy the `<authentication_token>` value from the output: ```plaintext Name: gitlab-token-b5zv4 Namespace: kube-system Labels: <none> Annotations: kubernetes.io/service-account.name=gitlab kubernetes.io/service-account.uid=bcfe66ac-39be-11e8-97e8-026dce96b6e8 Type: kubernetes.io/service-account-token Data ==== ca.crt: 1025 bytes namespace: 11 bytes token: <authentication_token> ``` 1. **GitLab-managed cluster** - Leave this checked if you want GitLab to manage namespaces and service accounts for this cluster. See the [Managed clusters section](gitlab_managed_clusters.md) for more information. 1. **Project namespace** (optional) - You don't have to fill this in. By leaving it blank, GitLab creates one for you. Also: - Each project should have a unique namespace. - The project namespace is not necessarily the namespace of the secret, if you're using a secret with broader permissions, like the secret from `default`. - You should **not** use `default` as the project namespace. - If you or someone created a secret specifically for the project, usually with limited permissions, the secret's namespace and project namespace may be the same. 1. Select the **Add Kubernetes cluster** button. After about 10 minutes, your cluster is ready. ## Disable Role-Based Access Control (RBAC) (optional) When connecting a cluster through GitLab integration, you may specify whether the cluster is RBAC-enabled or not. This affects how GitLab interacts with the cluster for certain operations. If you did not check the **RBAC-enabled cluster** checkbox at creation time, GitLab assumes RBAC is disabled for your cluster when interacting with it. If so, you must disable RBAC on your cluster for the integration to work properly. ![RBAC](img/rbac_v13_1.png) {{< alert type="warning" >}} Disabling RBAC means that any application running in the cluster, or user who can authenticate to the cluster, has full API access. This is a [security concern](../../infrastructure/clusters/connect/_index.md#security-implications-for-clusters-connected-with-certificates), and may not be desirable. {{< /alert >}} To effectively disable RBAC, global permissions can be applied granting full access: ```shell kubectl create clusterrolebinding permissive-binding \ --clusterrole=cluster-admin \ --user=admin \ --user=kubelet \ --group=system:serviceaccounts ``` ## Troubleshooting ### CA certificate and token errors during authentication If you encounter this error while connecting a Kubernetes cluster: ```plaintext There was a problem authenticating with your cluster. Please ensure your CA Certificate and Token are valid ``` Ensure you're properly pasting the service token. Some shells may add a line break to the service token, making it invalid. Ensure that there are no line breaks by pasting your token into an editor and removing any additional spaces. You may also experience this error if your certificate is not valid. To check that your certificate's subject alternative names contain the correct domain for your cluster's API, run this command: ```shell echo | openssl s_client -showcerts -connect kubernetes.example.com:443 -servername kubernetes.example.com 2>/dev/null | openssl x509 -inform pem -noout -text ``` The `-connect` argument expects a `host:port` combination. For example, `https://kubernetes.example.com` would be `kubernetes.example.com:443`. The `-servername` argument expects a domain without any URI, for example `kubernetes.example.com`.
--- stage: Deploy group: Environments info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments title: Connect existing clusters through cluster certificates (deprecated) breadcrumbs: - doc - user - project - clusters --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed {{< /details >}} {{< history >}} - [Deprecated](https://gitlab.com/groups/gitlab-org/configure/-/epics/8) in GitLab 14.5. {{< /history >}} {{< alert type="warning" >}} This feature was [deprecated](https://gitlab.com/groups/gitlab-org/configure/-/epics/8) in GitLab 14.5. To connect your cluster to GitLab, use the [GitLab agent for Kubernetes](../../clusters/agent/_index.md) instead. {{< /alert >}} If you have an existing Kubernetes cluster, you can add it to a project, group, or instance and benefit from the integration with GitLab. ## Prerequisites See the prerequisites below to add existing clusters to GitLab. ### All clusters To add any cluster to GitLab, you need: - An account on a GitLab.com or GitLab Self-Managed instance. - The Maintainer role for group-level and project-level clusters. - Access to the **Admin** area for instance-level clusters. - A Kubernetes cluster. - Cluster administration access to the cluster with `kubectl`. You can host your cluster in [EKS](#eks-clusters), [GKE](#gke-clusters), on premises, and with other providers. To host them on premises and with other providers, use either the EKS or GKE method to guide you through and enter your cluster's settings manually. {{< alert type="warning" >}} GitLab doesn't support `arm64` clusters. See the issue [Helm Tiller fails to install on `arm64` cluster](https://gitlab.com/gitlab-org/gitlab/-/issues/29838) for details. {{< /alert >}} ### EKS clusters To add an existing **EKS** cluster, you need: - An Amazon EKS cluster with worker nodes properly configured. - `kubectl` [installed and configured](https://docs.aws.amazon.com/eks/latest/userguide/getting-started.html#get-started-kubectl) for access to the EKS cluster. - Ensure the token of the account has administrator privileges for the cluster. ### GKE clusters To add an existing **GKE** cluster, you need: - The `container.clusterRoleBindings.create` permission to create a cluster role binding. You can follow the [Google Cloud documentation](https://cloud.google.com/iam/docs/granting-changing-revoking-access) to grant access. ## How to add an existing cluster <!-- (REVISE - BREAK INTO SMALLER STEPS) --> To add a Kubernetes cluster to your project, group, or instance: 1. Go to your: 1. Project's {{< icon name="cloud-gear" >}} **Operate > Kubernetes clusters** page, for a project-level cluster. 1. Group's {{< icon name="cloud-gear" >}} **Kubernetes** page, for a group-level cluster. 1. The **Admin** area's **Kubernetes** page, for an instance-level cluster. 1. On the **Kubernetes clusters** page, select the **Connect with a certificate** option from the **Actions** dropdown list. 1. On the **Connect a cluster** page, fill in the details: 1. **Kubernetes cluster name** (required) - The name you wish to give the cluster. 1. **Environment scope** (required) - The [associated environment](multiple_kubernetes_clusters.md#setting-the-environment-scope) to this cluster. 1. **API URL** (required) - It's the URL that GitLab uses to access the Kubernetes API. Kubernetes exposes several APIs, we want the "base" URL that is common to all of them. For example, `https://kubernetes.example.com` rather than `https://kubernetes.example.com/api/v1`. Get the API URL by running this command: ```shell kubectl cluster-info | grep -E 'Kubernetes master|Kubernetes control plane' | awk '/http/ {print $NF}' ``` 1. **CA certificate** (required) - A valid Kubernetes certificate is needed to authenticate to the cluster. We use the certificate created by default. 1. List the secrets with `kubectl get secrets`, and one should be named similar to `default-token-xxxxx`. Copy that token name for use below. 1. Get the certificate by running this command: ```shell kubectl get secret <secret name> -o jsonpath="{['data']['ca\.crt']}" | base64 --decode ``` If the command returns the entire certificate chain, you must copy the Root CA certificate and any intermediate certificates at the bottom of the chain. A chain file has following structure: ```plaintext -----BEGIN MY CERTIFICATE----- -----END MY CERTIFICATE----- -----BEGIN INTERMEDIATE CERTIFICATE----- -----END INTERMEDIATE CERTIFICATE----- -----BEGIN INTERMEDIATE CERTIFICATE----- -----END INTERMEDIATE CERTIFICATE----- -----BEGIN ROOT CERTIFICATE----- -----END ROOT CERTIFICATE----- ``` 1. **Token** - GitLab authenticates against Kubernetes using service tokens, which are scoped to a particular `namespace`. **The token used should belong to a service account with [`cluster-admin`](https://kubernetes.io/docs/reference/access-authn-authz/rbac/#user-facing-roles) privileges**. To create this service account: 1. Create a file called `gitlab-admin-service-account.yaml` with contents: ```yaml apiVersion: v1 kind: ServiceAccount metadata: name: gitlab namespace: kube-system --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: name: gitlab-admin roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole name: cluster-admin subjects: - kind: ServiceAccount name: gitlab namespace: kube-system ``` 1. Apply the service account and cluster role binding to your cluster: ```shell kubectl apply -f gitlab-admin-service-account.yaml ``` You need the `container.clusterRoleBindings.create` permission to create cluster-level roles. If you do not have this permission, you can alternatively enable Basic Authentication and then run the `kubectl apply` command as an administrator: ```shell kubectl apply -f gitlab-admin-service-account.yaml --username=admin --password=<password> ``` {{< alert type="note" >}} Basic Authentication can be turned on and the password credentials can be obtained using the Google Cloud Console. {{< /alert >}} Output: ```shell serviceaccount "gitlab" created clusterrolebinding "gitlab-admin" created ``` 1. Retrieve the token for the `gitlab` service account: ```shell kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep gitlab | awk '{print $1}') ``` Copy the `<authentication_token>` value from the output: ```plaintext Name: gitlab-token-b5zv4 Namespace: kube-system Labels: <none> Annotations: kubernetes.io/service-account.name=gitlab kubernetes.io/service-account.uid=bcfe66ac-39be-11e8-97e8-026dce96b6e8 Type: kubernetes.io/service-account-token Data ==== ca.crt: 1025 bytes namespace: 11 bytes token: <authentication_token> ``` 1. **GitLab-managed cluster** - Leave this checked if you want GitLab to manage namespaces and service accounts for this cluster. See the [Managed clusters section](gitlab_managed_clusters.md) for more information. 1. **Project namespace** (optional) - You don't have to fill this in. By leaving it blank, GitLab creates one for you. Also: - Each project should have a unique namespace. - The project namespace is not necessarily the namespace of the secret, if you're using a secret with broader permissions, like the secret from `default`. - You should **not** use `default` as the project namespace. - If you or someone created a secret specifically for the project, usually with limited permissions, the secret's namespace and project namespace may be the same. 1. Select the **Add Kubernetes cluster** button. After about 10 minutes, your cluster is ready. ## Disable Role-Based Access Control (RBAC) (optional) When connecting a cluster through GitLab integration, you may specify whether the cluster is RBAC-enabled or not. This affects how GitLab interacts with the cluster for certain operations. If you did not check the **RBAC-enabled cluster** checkbox at creation time, GitLab assumes RBAC is disabled for your cluster when interacting with it. If so, you must disable RBAC on your cluster for the integration to work properly. ![RBAC](img/rbac_v13_1.png) {{< alert type="warning" >}} Disabling RBAC means that any application running in the cluster, or user who can authenticate to the cluster, has full API access. This is a [security concern](../../infrastructure/clusters/connect/_index.md#security-implications-for-clusters-connected-with-certificates), and may not be desirable. {{< /alert >}} To effectively disable RBAC, global permissions can be applied granting full access: ```shell kubectl create clusterrolebinding permissive-binding \ --clusterrole=cluster-admin \ --user=admin \ --user=kubelet \ --group=system:serviceaccounts ``` ## Troubleshooting ### CA certificate and token errors during authentication If you encounter this error while connecting a Kubernetes cluster: ```plaintext There was a problem authenticating with your cluster. Please ensure your CA Certificate and Token are valid ``` Ensure you're properly pasting the service token. Some shells may add a line break to the service token, making it invalid. Ensure that there are no line breaks by pasting your token into an editor and removing any additional spaces. You may also experience this error if your certificate is not valid. To check that your certificate's subject alternative names contain the correct domain for your cluster's API, run this command: ```shell echo | openssl s_client -showcerts -connect kubernetes.example.com:443 -servername kubernetes.example.com 2>/dev/null | openssl x509 -inform pem -noout -text ``` The `-connect` argument expects a `host:port` combination. For example, `https://kubernetes.example.com` would be `kubernetes.example.com:443`. The `-servername` argument expects a domain without any URI, for example `kubernetes.example.com`.
https://docs.gitlab.com/user/project/multiple_kubernetes_clusters
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/multiple_kubernetes_clusters.md
2025-08-13
doc/user/project/clusters
[ "doc", "user", "project", "clusters" ]
multiple_kubernetes_clusters.md
Deploy
Environments
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Multiple clusters per project with cluster certificates (deprecated)
null
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed {{< /details >}} {{< alert type="warning" >}} Using multiple Kubernetes clusters for a single project **with cluster certificates** was [deprecated](https://gitlab.com/groups/gitlab-org/configure/-/epics/8) in GitLab 14.5. To connect clusters to GitLab, use the [GitLab agent for Kubernetes](../../clusters/agent/_index.md). {{< /alert >}} You can associate more than one Kubernetes cluster to your project. That way you can have different clusters for different environments, like development, staging, production, and so on. Add another cluster, like you did the first time, and make sure to [set an environment scope](#setting-the-environment-scope) that differentiates the new cluster from the rest. ## Setting the environment scope When adding more than one Kubernetes cluster to your project, you need to differentiate them with an environment scope. The environment scope associates clusters with [environments](../../../ci/environments/_index.md) similar to how the [environment-specific CI/CD variables](../../../ci/environments/_index.md#limit-the-environment-scope-of-a-cicd-variable) work. The default environment scope is `*`, which means all jobs, regardless of their environment, use that cluster. Each scope can be used only by a single cluster in a project, and a validation error occurs if otherwise. Also, jobs that don't have an environment keyword set can't access any cluster. For example, a project might have the following Kubernetes clusters: | Cluster | Environment scope | | ----------- | ----------------- | | Development | `*` | | Production | `production` | And the following environments are set in the `.gitlab-ci.yml` file: ```yaml stages: - test - deploy test: stage: test script: sh test deploy to staging: stage: deploy script: make deploy environment: name: staging url: https://staging.example.com/ deploy to production: stage: deploy script: make deploy environment: name: production url: https://example.com/ ``` The results: - The Development cluster details are available in the `deploy to staging` job. - The production cluster details are available in the `deploy to production` job. - No cluster details are available in the `test` job because it doesn't define any environment.
--- stage: Deploy group: Environments info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments title: Multiple clusters per project with cluster certificates (deprecated) breadcrumbs: - doc - user - project - clusters --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed {{< /details >}} {{< alert type="warning" >}} Using multiple Kubernetes clusters for a single project **with cluster certificates** was [deprecated](https://gitlab.com/groups/gitlab-org/configure/-/epics/8) in GitLab 14.5. To connect clusters to GitLab, use the [GitLab agent for Kubernetes](../../clusters/agent/_index.md). {{< /alert >}} You can associate more than one Kubernetes cluster to your project. That way you can have different clusters for different environments, like development, staging, production, and so on. Add another cluster, like you did the first time, and make sure to [set an environment scope](#setting-the-environment-scope) that differentiates the new cluster from the rest. ## Setting the environment scope When adding more than one Kubernetes cluster to your project, you need to differentiate them with an environment scope. The environment scope associates clusters with [environments](../../../ci/environments/_index.md) similar to how the [environment-specific CI/CD variables](../../../ci/environments/_index.md#limit-the-environment-scope-of-a-cicd-variable) work. The default environment scope is `*`, which means all jobs, regardless of their environment, use that cluster. Each scope can be used only by a single cluster in a project, and a validation error occurs if otherwise. Also, jobs that don't have an environment keyword set can't access any cluster. For example, a project might have the following Kubernetes clusters: | Cluster | Environment scope | | ----------- | ----------------- | | Development | `*` | | Production | `production` | And the following environments are set in the `.gitlab-ci.yml` file: ```yaml stages: - test - deploy test: stage: test script: sh test deploy to staging: stage: deploy script: make deploy environment: name: staging url: https://staging.example.com/ deploy to production: stage: deploy script: make deploy environment: name: production url: https://example.com/ ``` The results: - The Development cluster details are available in the `deploy to staging` job. - The production cluster details are available in the `deploy to production` job. - No cluster details are available in the `test` job because it doesn't define any environment.
https://docs.gitlab.com/user/project/add_eks_clusters
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/add_eks_clusters.md
2025-08-13
doc/user/project/clusters
[ "doc", "user", "project", "clusters" ]
add_eks_clusters.md
Deploy
Environments
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Connect EKS clusters through cluster certificates (deprecated)
null
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed {{< /details >}} {{< alert type="warning" >}} This feature was deprecated in GitLab 14.5. Use [Infrastructure as Code](../../infrastructure/iac/_index.md) to create new clusters. {{< /alert >}} Through GitLab, you can create new clusters and add existing clusters hosted on Amazon Elastic Kubernetes Service (EKS). ## Connect an existing EKS cluster If you already have an EKS cluster and want to connect it to GitLab, use the [GitLab agent for Kubernetes](../../clusters/agent/_index.md). ## Create a new EKS cluster To create a new cluster from GitLab, use [Infrastructure as Code](../../infrastructure/iac/_index.md). ### How to create a new cluster on EKS through cluster certificates (deprecated) {{< history >}} - [Deprecated](https://gitlab.com/gitlab-org/gitlab/-/issues/327908) in GitLab 14.0. {{< /history >}} Prerequisites: - An [Amazon Web Services](https://aws.amazon.com/) account. - Permissions to manage IAM resources. For instance-level clusters, see [additional requirements for GitLab Self-Managed instances](#additional-requirements-for-gitlab-self-managed-instances). To create new Kubernetes clusters for your project, group, or instance through the certificate-based method: 1. [Define the access control (RBAC or ABAC) for your cluster](cluster_access.md). 1. [Create a cluster in GitLab](#create-a-new-eks-cluster-in-gitlab). 1. [Prepare the cluster in Amazon](#prepare-the-cluster-in-amazon). 1. [Configure your cluster's data in GitLab](#configure-your-clusters-data-in-gitlab). Further steps: 1. [Create a default Storage Class](#create-a-default-storage-class). 1. [Deploy the app to EKS](#deploy-the-app-to-eks). #### Create a new EKS cluster in GitLab To create new a EKS cluster for your project, group, or instance, through cluster certificates: 1. Go to your: - Project's **Operate > Kubernetes clusters** page, for a project-level cluster. - Group's **Kubernetes** page, for a group-level cluster. - The **Admin** area's **Kubernetes** page, for an instance-level cluster. 1. Select **Integrate with a cluster certificate**. 1. Under the **Create new cluster** tab, select **Amazon EKS** to display an `Account ID` and `External ID` needed for later steps. 1. In the [IAM Management Console](https://console.aws.amazon.com/iam/home), create an IAM policy: 1. From the left panel, select **Policies**. 1. Select **Create Policy**, which opens a new window. 1. Select the **JSON** tab, and paste the following snippet in place of the existing content. These permissions give GitLab the ability to create resources, but not delete them: ```json { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "autoscaling:CreateAutoScalingGroup", "autoscaling:DescribeAutoScalingGroups", "autoscaling:DescribeScalingActivities", "autoscaling:UpdateAutoScalingGroup", "autoscaling:CreateLaunchConfiguration", "autoscaling:DescribeLaunchConfigurations", "cloudformation:CreateStack", "cloudformation:DescribeStacks", "ec2:AuthorizeSecurityGroupEgress", "ec2:AuthorizeSecurityGroupIngress", "ec2:RevokeSecurityGroupEgress", "ec2:RevokeSecurityGroupIngress", "ec2:CreateSecurityGroup", "ec2:createTags", "ec2:DescribeImages", "ec2:DescribeKeyPairs", "ec2:DescribeRegions", "ec2:DescribeSecurityGroups", "ec2:DescribeSubnets", "ec2:DescribeVpcs", "eks:CreateCluster", "eks:DescribeCluster", "iam:AddRoleToInstanceProfile", "iam:AttachRolePolicy", "iam:CreateRole", "iam:CreateInstanceProfile", "iam:CreateServiceLinkedRole", "iam:GetRole", "iam:listAttachedRolePolicies", "iam:ListRoles", "iam:PassRole", "ssm:GetParameters" ], "Resource": "*" } ] } ``` If you get an error during this process, GitLab does not roll back the changes. You must remove resources manually. You can do this by deleting the relevant [CloudFormation stack](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cfn-console-delete-stack.html). 1. Select **Review policy**. 1. Enter a suitable name for this policy, and select **Create Policy**. You can now close this window. ### Prepare the cluster in Amazon 1. [Create an **EKS IAM role** for your cluster](#create-an-eks-iam-role-for-your-cluster) (**role A**). 1. [Create **another EKS IAM role** for GitLab authentication with Amazon](#create-another-eks-iam-role-for-gitlab-authentication-with-amazon) (**role B**). #### Create an EKS IAM role for your cluster In the [IAM Management Console](https://console.aws.amazon.com/iam/home), create an **EKS IAM role** (**role A**) following the [Amazon EKS cluster IAM role instructions](https://docs.aws.amazon.com/eks/latest/userguide/service_IAM_role.html). This role is necessary so that Kubernetes clusters managed by Amazon EKS can make calls to other AWS services on your behalf to manage the resources that you use with the service. For GitLab to manage the EKS cluster correctly, you must include `AmazonEKSClusterPolicy` in addition to the policies the guide suggests. #### Create another EKS IAM role for GitLab authentication with Amazon In the [IAM Management Console](https://console.aws.amazon.com/iam/home), create another IAM role (**role B**) for GitLab authentication with AWS: 1. On the AWS IAM console, select **Roles** from the left panel. 1. Select **Create role**. 1. Under **Select type of trusted entity**, select **Another AWS account**. 1. Enter the Account ID from GitLab into the **Account ID** field. 1. Check **Require external ID**. 1. Enter the External ID from GitLab into the **External ID** field. 1. Select **Next: Permissions**, and select the policy you just created. 1. Select **Next: Tags**, and optionally enter any tags you wish to associate with this role. 1. Select **Next: Review**. 1. Enter a role name and optional description into the fields provided. 1. Select **Create role**. The new role name displays at the top. Select its name and copy the `Role ARN` from the newly created role. ### Configure your cluster's data in GitLab 1. Back in GitLab, enter the copied role ARN into the **Role ARN** field. 1. In the **Cluster Region** field, enter the [region](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html) you plan to use for your new cluster. GitLab confirms you have access to this region when authenticating your role. 1. Select **Authenticate with AWS**. 1. Adjust your [cluster's settings](#cluster-settings). 1. Select the **Create Kubernetes cluster** button. After about 10 minutes, your cluster is ready to go. {{< alert type="note" >}} If you have [installed and configured](https://docs.aws.amazon.com/eks/latest/userguide/getting-started.html#get-started-kubectl) `kubectl` and you would like to manage your cluster with it, you must add your AWS external ID in the AWS configuration. For more information on how to configure AWS CLI, see [using an IAM role in the AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-role.html#cli-configure-role-xaccount). {{< /alert >}} #### Cluster settings When you create a new cluster, you have the following settings: | Setting | Description | | ----------------------- |------------ | | Kubernetes cluster name | Your cluster's name. | | Environment scope | The [associated environment](multiple_kubernetes_clusters.md#setting-the-environment-scope). | | Service role | The **EKS IAM role** (**role A**). | | Kubernetes version | The [Kubernetes version](../../clusters/agent/_index.md#supported-kubernetes-versions-for-gitlab-features) for your cluster. | | Key pair name | The [key pair](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html) that you can use to connect to your worker nodes. | | VPC | The [VPC](https://docs.aws.amazon.com/vpc/latest/userguide/what-is-amazon-vpc.html) to use for your EKS Cluster resources. | | Subnets | The [subnets](https://docs.aws.amazon.com/vpc/latest/userguide/VPC_Subnets.html) in your VPC where your worker nodes run. Two are required. | | Security group | The [security group](https://docs.aws.amazon.com/vpc/latest/userguide/vpc-security-groups.html) to apply to the EKS-managed Elastic Network Interfaces that are created in your worker node subnets. | | Instance type | The [instance type](https://aws.amazon.com/ec2/instance-types/) of your worker nodes. | | Node count | The number of worker nodes. | | GitLab-managed cluster | Check if you want GitLab to manage namespaces and service accounts for this cluster. | ## Create a default Storage Class Amazon EKS doesn't have a default Storage Class out of the box, which means requests for persistent volumes are not automatically fulfilled. As part of Auto DevOps, the deployed PostgreSQL instance requests persistent storage, and without a default storage class it cannot start. To create a default storage class if one doesn't already exist, see [Storage Classes](https://docs.aws.amazon.com/eks/latest/userguide/storage.html#storage-classes). Alternatively, disable PostgreSQL by setting the project variable [`POSTGRES_ENABLED`](../../../topics/autodevops/cicd_variables.md) to `false`. ## Deploy the app to EKS With RBAC disabled and services deployed, [Auto DevOps](../../../topics/autodevops/_index.md) can now be leveraged to build, test, and deploy the app. [Enable Auto DevOps](../../../topics/autodevops/_index.md#per-project) if not already enabled. If a wildcard DNS entry was created resolving to the Load Balancer, enter it in the `domain` field under the Auto DevOps settings. Otherwise, the deployed app isn't externally available outside of the cluster. ![A pipeline deploying the application to EKS.](img/pipeline_v11_0.png) GitLab creates a new pipeline, which begins to build, test, and deploy the app. After the pipeline has finished, your app runs in EKS, and is available to users. Select **Operate > Environments**. ![The deployed environment status and access options.](img/environment_v11_0.png) GitLab displays a list of the environments and their deploy status, as well as options to browse to the app, view monitoring metrics, and even access a shell on the running pod. ## Additional requirements for GitLab Self-Managed instances {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab Self-Managed, GitLab Dedicated {{< /details >}} If you are using GitLab Self-Managed, you need to configure Amazon credentials. GitLab uses these credentials to assume an Amazon IAM role to create your cluster. Create an IAM user and ensure it has permissions to assume the roles that your users need to create EKS clusters. For example, the following policy document allows assuming a role whose name starts with `gitlab-eks-` in account `123456789012`: ```json { "Version": "2012-10-17", "Statement": { "Effect": "Allow", "Action": "sts:AssumeRole", "Resource": "arn:aws:iam::123456789012:role/gitlab-eks-*" } } ``` ### Configure Amazon authentication To configure Amazon authentication in GitLab, generate an access key for the IAM user in the Amazon AWS console, and follow these steps: 1. On the left sidebar, at the bottom, select **Admin**. 1. Select **Settings > General**. 1. Expand **Amazon EKS**. 1. Check **Enable Amazon EKS integration**. 1. Enter your **Account ID**. 1. Enter your [access key and ID](#eks-access-key-and-id). 1. Select **Save changes**. #### EKS access key and ID You can use instance profiles to dynamically retrieve temporary credentials from AWS when needed. In this case, leave the `Access key ID` and `Secret access key` fields blank and [pass an IAM role to an EC2 instance](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use_switch-role-ec2_instance-profiles.html). Otherwise, enter your access key credentials into **Access key ID** and **Secret access key**. ## Troubleshooting The following errors are commonly encountered when creating a new cluster. ### Validation failed: Role ARN must be a valid Amazon Resource Name Check that the `Provision Role ARN` is correct. An example of a valid ARN: ```plaintext arn:aws:iam::123456789012:role/gitlab-eks-provision' ``` ### Access denied: User is not authorized to perform: `sts:AssumeRole` on resource: `arn:aws:iam::y` This error occurs when the credentials defined in the [Configure Amazon authentication](#configure-amazon-authentication) cannot assume the role defined by the Provision Role ARN: ```plaintext User `arn:aws:iam::x` is not authorized to perform: `sts:AssumeRole` on resource: `arn:aws:iam::y` ``` Check that: 1. The initial set of AWS credentials [has the AssumeRole policy](#additional-requirements-for-gitlab-self-managed-instances). 1. The Provision Role has access to create clusters in the given region. 1. The account ID and [external ID](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_create_for-user_externalid.html) match the value defined in the **Trust relationships** tab in AWS: ![Trust relationship settings for the AWS IAM role used for EKS cluster creation.](img/aws_iam_role_trust_v13_7.png) ### Could not load Security Groups for this VPC When populating options in the configuration form, GitLab returns this error because GitLab has successfully assumed your provided role, but the role has insufficient permissions to retrieve the resources needed for the form. Make sure you've assigned the role the correct permissions. ### Key Pairs are not loaded GitLab loads the key pairs from the **Cluster Region** specified. Ensure that key pair exists in that region. #### `ROLLBACK_FAILED` during cluster creation The creation process halted because GitLab encountered an error when creating one or more resources. You can inspect the associated [CloudFormation stack](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cfn-console-view-stack-data-resources.html) to find the specific resources that failed to create. If the `Cluster` resource failed with the error `The provided role doesn't have the Amazon EKS Managed Policies associated with it.`, the role specified in **Role name** is not configured correctly. {{< alert type="note" >}} This role should be the role you created by following the [EKS cluster IAM role](https://docs.aws.amazon.com/eks/latest/userguide/service_IAM_role.html) guide. In addition to the policies that guide suggests, you must also include the `AmazonEKSClusterPolicy` policy for this role in order for GitLab to manage the EKS cluster correctly. {{< /alert >}}
--- stage: Deploy group: Environments info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments title: Connect EKS clusters through cluster certificates (deprecated) breadcrumbs: - doc - user - project - clusters --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed {{< /details >}} {{< alert type="warning" >}} This feature was deprecated in GitLab 14.5. Use [Infrastructure as Code](../../infrastructure/iac/_index.md) to create new clusters. {{< /alert >}} Through GitLab, you can create new clusters and add existing clusters hosted on Amazon Elastic Kubernetes Service (EKS). ## Connect an existing EKS cluster If you already have an EKS cluster and want to connect it to GitLab, use the [GitLab agent for Kubernetes](../../clusters/agent/_index.md). ## Create a new EKS cluster To create a new cluster from GitLab, use [Infrastructure as Code](../../infrastructure/iac/_index.md). ### How to create a new cluster on EKS through cluster certificates (deprecated) {{< history >}} - [Deprecated](https://gitlab.com/gitlab-org/gitlab/-/issues/327908) in GitLab 14.0. {{< /history >}} Prerequisites: - An [Amazon Web Services](https://aws.amazon.com/) account. - Permissions to manage IAM resources. For instance-level clusters, see [additional requirements for GitLab Self-Managed instances](#additional-requirements-for-gitlab-self-managed-instances). To create new Kubernetes clusters for your project, group, or instance through the certificate-based method: 1. [Define the access control (RBAC or ABAC) for your cluster](cluster_access.md). 1. [Create a cluster in GitLab](#create-a-new-eks-cluster-in-gitlab). 1. [Prepare the cluster in Amazon](#prepare-the-cluster-in-amazon). 1. [Configure your cluster's data in GitLab](#configure-your-clusters-data-in-gitlab). Further steps: 1. [Create a default Storage Class](#create-a-default-storage-class). 1. [Deploy the app to EKS](#deploy-the-app-to-eks). #### Create a new EKS cluster in GitLab To create new a EKS cluster for your project, group, or instance, through cluster certificates: 1. Go to your: - Project's **Operate > Kubernetes clusters** page, for a project-level cluster. - Group's **Kubernetes** page, for a group-level cluster. - The **Admin** area's **Kubernetes** page, for an instance-level cluster. 1. Select **Integrate with a cluster certificate**. 1. Under the **Create new cluster** tab, select **Amazon EKS** to display an `Account ID` and `External ID` needed for later steps. 1. In the [IAM Management Console](https://console.aws.amazon.com/iam/home), create an IAM policy: 1. From the left panel, select **Policies**. 1. Select **Create Policy**, which opens a new window. 1. Select the **JSON** tab, and paste the following snippet in place of the existing content. These permissions give GitLab the ability to create resources, but not delete them: ```json { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "autoscaling:CreateAutoScalingGroup", "autoscaling:DescribeAutoScalingGroups", "autoscaling:DescribeScalingActivities", "autoscaling:UpdateAutoScalingGroup", "autoscaling:CreateLaunchConfiguration", "autoscaling:DescribeLaunchConfigurations", "cloudformation:CreateStack", "cloudformation:DescribeStacks", "ec2:AuthorizeSecurityGroupEgress", "ec2:AuthorizeSecurityGroupIngress", "ec2:RevokeSecurityGroupEgress", "ec2:RevokeSecurityGroupIngress", "ec2:CreateSecurityGroup", "ec2:createTags", "ec2:DescribeImages", "ec2:DescribeKeyPairs", "ec2:DescribeRegions", "ec2:DescribeSecurityGroups", "ec2:DescribeSubnets", "ec2:DescribeVpcs", "eks:CreateCluster", "eks:DescribeCluster", "iam:AddRoleToInstanceProfile", "iam:AttachRolePolicy", "iam:CreateRole", "iam:CreateInstanceProfile", "iam:CreateServiceLinkedRole", "iam:GetRole", "iam:listAttachedRolePolicies", "iam:ListRoles", "iam:PassRole", "ssm:GetParameters" ], "Resource": "*" } ] } ``` If you get an error during this process, GitLab does not roll back the changes. You must remove resources manually. You can do this by deleting the relevant [CloudFormation stack](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cfn-console-delete-stack.html). 1. Select **Review policy**. 1. Enter a suitable name for this policy, and select **Create Policy**. You can now close this window. ### Prepare the cluster in Amazon 1. [Create an **EKS IAM role** for your cluster](#create-an-eks-iam-role-for-your-cluster) (**role A**). 1. [Create **another EKS IAM role** for GitLab authentication with Amazon](#create-another-eks-iam-role-for-gitlab-authentication-with-amazon) (**role B**). #### Create an EKS IAM role for your cluster In the [IAM Management Console](https://console.aws.amazon.com/iam/home), create an **EKS IAM role** (**role A**) following the [Amazon EKS cluster IAM role instructions](https://docs.aws.amazon.com/eks/latest/userguide/service_IAM_role.html). This role is necessary so that Kubernetes clusters managed by Amazon EKS can make calls to other AWS services on your behalf to manage the resources that you use with the service. For GitLab to manage the EKS cluster correctly, you must include `AmazonEKSClusterPolicy` in addition to the policies the guide suggests. #### Create another EKS IAM role for GitLab authentication with Amazon In the [IAM Management Console](https://console.aws.amazon.com/iam/home), create another IAM role (**role B**) for GitLab authentication with AWS: 1. On the AWS IAM console, select **Roles** from the left panel. 1. Select **Create role**. 1. Under **Select type of trusted entity**, select **Another AWS account**. 1. Enter the Account ID from GitLab into the **Account ID** field. 1. Check **Require external ID**. 1. Enter the External ID from GitLab into the **External ID** field. 1. Select **Next: Permissions**, and select the policy you just created. 1. Select **Next: Tags**, and optionally enter any tags you wish to associate with this role. 1. Select **Next: Review**. 1. Enter a role name and optional description into the fields provided. 1. Select **Create role**. The new role name displays at the top. Select its name and copy the `Role ARN` from the newly created role. ### Configure your cluster's data in GitLab 1. Back in GitLab, enter the copied role ARN into the **Role ARN** field. 1. In the **Cluster Region** field, enter the [region](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html) you plan to use for your new cluster. GitLab confirms you have access to this region when authenticating your role. 1. Select **Authenticate with AWS**. 1. Adjust your [cluster's settings](#cluster-settings). 1. Select the **Create Kubernetes cluster** button. After about 10 minutes, your cluster is ready to go. {{< alert type="note" >}} If you have [installed and configured](https://docs.aws.amazon.com/eks/latest/userguide/getting-started.html#get-started-kubectl) `kubectl` and you would like to manage your cluster with it, you must add your AWS external ID in the AWS configuration. For more information on how to configure AWS CLI, see [using an IAM role in the AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-role.html#cli-configure-role-xaccount). {{< /alert >}} #### Cluster settings When you create a new cluster, you have the following settings: | Setting | Description | | ----------------------- |------------ | | Kubernetes cluster name | Your cluster's name. | | Environment scope | The [associated environment](multiple_kubernetes_clusters.md#setting-the-environment-scope). | | Service role | The **EKS IAM role** (**role A**). | | Kubernetes version | The [Kubernetes version](../../clusters/agent/_index.md#supported-kubernetes-versions-for-gitlab-features) for your cluster. | | Key pair name | The [key pair](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html) that you can use to connect to your worker nodes. | | VPC | The [VPC](https://docs.aws.amazon.com/vpc/latest/userguide/what-is-amazon-vpc.html) to use for your EKS Cluster resources. | | Subnets | The [subnets](https://docs.aws.amazon.com/vpc/latest/userguide/VPC_Subnets.html) in your VPC where your worker nodes run. Two are required. | | Security group | The [security group](https://docs.aws.amazon.com/vpc/latest/userguide/vpc-security-groups.html) to apply to the EKS-managed Elastic Network Interfaces that are created in your worker node subnets. | | Instance type | The [instance type](https://aws.amazon.com/ec2/instance-types/) of your worker nodes. | | Node count | The number of worker nodes. | | GitLab-managed cluster | Check if you want GitLab to manage namespaces and service accounts for this cluster. | ## Create a default Storage Class Amazon EKS doesn't have a default Storage Class out of the box, which means requests for persistent volumes are not automatically fulfilled. As part of Auto DevOps, the deployed PostgreSQL instance requests persistent storage, and without a default storage class it cannot start. To create a default storage class if one doesn't already exist, see [Storage Classes](https://docs.aws.amazon.com/eks/latest/userguide/storage.html#storage-classes). Alternatively, disable PostgreSQL by setting the project variable [`POSTGRES_ENABLED`](../../../topics/autodevops/cicd_variables.md) to `false`. ## Deploy the app to EKS With RBAC disabled and services deployed, [Auto DevOps](../../../topics/autodevops/_index.md) can now be leveraged to build, test, and deploy the app. [Enable Auto DevOps](../../../topics/autodevops/_index.md#per-project) if not already enabled. If a wildcard DNS entry was created resolving to the Load Balancer, enter it in the `domain` field under the Auto DevOps settings. Otherwise, the deployed app isn't externally available outside of the cluster. ![A pipeline deploying the application to EKS.](img/pipeline_v11_0.png) GitLab creates a new pipeline, which begins to build, test, and deploy the app. After the pipeline has finished, your app runs in EKS, and is available to users. Select **Operate > Environments**. ![The deployed environment status and access options.](img/environment_v11_0.png) GitLab displays a list of the environments and their deploy status, as well as options to browse to the app, view monitoring metrics, and even access a shell on the running pod. ## Additional requirements for GitLab Self-Managed instances {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab Self-Managed, GitLab Dedicated {{< /details >}} If you are using GitLab Self-Managed, you need to configure Amazon credentials. GitLab uses these credentials to assume an Amazon IAM role to create your cluster. Create an IAM user and ensure it has permissions to assume the roles that your users need to create EKS clusters. For example, the following policy document allows assuming a role whose name starts with `gitlab-eks-` in account `123456789012`: ```json { "Version": "2012-10-17", "Statement": { "Effect": "Allow", "Action": "sts:AssumeRole", "Resource": "arn:aws:iam::123456789012:role/gitlab-eks-*" } } ``` ### Configure Amazon authentication To configure Amazon authentication in GitLab, generate an access key for the IAM user in the Amazon AWS console, and follow these steps: 1. On the left sidebar, at the bottom, select **Admin**. 1. Select **Settings > General**. 1. Expand **Amazon EKS**. 1. Check **Enable Amazon EKS integration**. 1. Enter your **Account ID**. 1. Enter your [access key and ID](#eks-access-key-and-id). 1. Select **Save changes**. #### EKS access key and ID You can use instance profiles to dynamically retrieve temporary credentials from AWS when needed. In this case, leave the `Access key ID` and `Secret access key` fields blank and [pass an IAM role to an EC2 instance](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use_switch-role-ec2_instance-profiles.html). Otherwise, enter your access key credentials into **Access key ID** and **Secret access key**. ## Troubleshooting The following errors are commonly encountered when creating a new cluster. ### Validation failed: Role ARN must be a valid Amazon Resource Name Check that the `Provision Role ARN` is correct. An example of a valid ARN: ```plaintext arn:aws:iam::123456789012:role/gitlab-eks-provision' ``` ### Access denied: User is not authorized to perform: `sts:AssumeRole` on resource: `arn:aws:iam::y` This error occurs when the credentials defined in the [Configure Amazon authentication](#configure-amazon-authentication) cannot assume the role defined by the Provision Role ARN: ```plaintext User `arn:aws:iam::x` is not authorized to perform: `sts:AssumeRole` on resource: `arn:aws:iam::y` ``` Check that: 1. The initial set of AWS credentials [has the AssumeRole policy](#additional-requirements-for-gitlab-self-managed-instances). 1. The Provision Role has access to create clusters in the given region. 1. The account ID and [external ID](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_create_for-user_externalid.html) match the value defined in the **Trust relationships** tab in AWS: ![Trust relationship settings for the AWS IAM role used for EKS cluster creation.](img/aws_iam_role_trust_v13_7.png) ### Could not load Security Groups for this VPC When populating options in the configuration form, GitLab returns this error because GitLab has successfully assumed your provided role, but the role has insufficient permissions to retrieve the resources needed for the form. Make sure you've assigned the role the correct permissions. ### Key Pairs are not loaded GitLab loads the key pairs from the **Cluster Region** specified. Ensure that key pair exists in that region. #### `ROLLBACK_FAILED` during cluster creation The creation process halted because GitLab encountered an error when creating one or more resources. You can inspect the associated [CloudFormation stack](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cfn-console-view-stack-data-resources.html) to find the specific resources that failed to create. If the `Cluster` resource failed with the error `The provided role doesn't have the Amazon EKS Managed Policies associated with it.`, the role specified in **Role name** is not configured correctly. {{< alert type="note" >}} This role should be the role you created by following the [EKS cluster IAM role](https://docs.aws.amazon.com/eks/latest/userguide/service_IAM_role.html) guide. In addition to the policies that guide suggests, you must also include the `AmazonEKSClusterPolicy` policy for this role in order for GitLab to manage the EKS cluster correctly. {{< /alert >}}
https://docs.gitlab.com/user/project/deploy_to_cluster
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/deploy_to_cluster.md
2025-08-13
doc/user/project/clusters
[ "doc", "user", "project", "clusters" ]
deploy_to_cluster.md
Deploy
Environments
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Deploy to a Kubernetes cluster with cluster certificates (deprecated)
null
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed {{< /details >}} {{< history >}} - [Deprecated](https://gitlab.com/groups/gitlab-org/configure/-/epics/8) in GitLab 14.5. {{< /history >}} {{< alert type="warning" >}} This feature was [deprecated](https://gitlab.com/groups/gitlab-org/configure/-/epics/8) in GitLab 14.5. To connect your cluster to GitLab, use the [GitLab agent for Kubernetes](../../clusters/agent/_index.md). To deploy with the agent, use the [CI/CD workflow](../../clusters/agent/ci_cd_workflow.md). {{< /alert >}} A Kubernetes cluster can be the destination for a deployment job. If - The cluster is integrated with GitLab, special [deployment variables](#deployment-variables) are made available to your job and configuration is not required. You can immediately begin interacting with the cluster from your jobs using tools such as `kubectl` or `helm`. - You don't use the GitLab cluster integration, you can still deploy to your cluster. However, you must configure Kubernetes tools yourself using [CI/CD variables](../../../ci/variables/_index.md#for-a-project) before you can interact with the cluster from your jobs. ## Deployment variables Deployment variables require a valid [Deploy Token](../deploy_tokens/_index.md) named [`gitlab-deploy-token`](../deploy_tokens/_index.md#gitlab-deploy-token), and the following command in your deployment job script, for Kubernetes to access the registry: - Using Kubernetes 1.18+: ```shell kubectl create secret docker-registry gitlab-registry --docker-server="$CI_REGISTRY" --docker-username="$CI_DEPLOY_USER" --docker-password="$CI_DEPLOY_PASSWORD" --docker-email="$GITLAB_USER_EMAIL" -o yaml --dry-run=client | kubectl apply -f - ``` - Using Kubernetes <1.18: ```shell kubectl create secret docker-registry gitlab-registry --docker-server="$CI_REGISTRY" --docker-username="$CI_DEPLOY_USER" --docker-password="$CI_DEPLOY_PASSWORD" --docker-email="$GITLAB_USER_EMAIL" -o yaml --dry-run | kubectl apply -f - ``` The Kubernetes cluster integration exposes these [deployment variables](../../../ci/variables/predefined_variables.md#deployment-variables) in the GitLab CI/CD build environment to deployment jobs. Deployment jobs have [defined a target environment](../../../ci/environments/_index.md). | Deployment Variable | Description | |----------------------------|-------------| | `KUBE_URL` | Equal to the API URL. | | `KUBE_TOKEN` | The Kubernetes token of the [environment service account](cluster_access.md). | | `KUBE_NAMESPACE` | The namespace associated with the project's deployment service account. In the format `<project_name>-<project_id>-<environment>`. For GitLab-managed clusters, a matching namespace is automatically created by GitLab in the cluster. If your cluster was created before GitLab 12.2, the default `KUBE_NAMESPACE` is set to `<project_name>-<project_id>`. | | `KUBE_CA_PEM_FILE` | Path to a file containing PEM data. Only present if a custom CA bundle was specified. | | `KUBE_CA_PEM` | (**deprecated**) Raw PEM data. Only if a custom CA bundle was specified. | | `KUBECONFIG` | Path to a file containing `kubeconfig` for this deployment. CA bundle would be embedded if specified. This configuration also embeds the same token defined in `KUBE_TOKEN` so you likely need only this variable. This variable name is also automatically picked up by `kubectl` so you don't need to reference it explicitly if using `kubectl`. | | `KUBE_INGRESS_BASE_DOMAIN` | This variable can be used to set a domain per cluster. See [cluster domains](gitlab_managed_clusters.md#base-domain) for more information. | ## Custom namespace The Kubernetes integration provides a `KUBECONFIG` with an auto-generated namespace to deployment jobs. It defaults to using project-environment specific namespaces of the form `<prefix>-<environment>`, where `<prefix>` is of the form `<project_name>-<project_id>`. For more information, see [Deployment variables](#deployment-variables). You can customize the deployment namespace in a few ways: - You can choose between a **namespace per [environment](../../../ci/environments/_index.md)** or a **namespace per project**. A namespace per environment is the default and recommended setting, as it prevents the mixing of resources between production and non-production environments. - When using a project-level cluster, you can additionally customize the namespace prefix. When using namespace-per-environment, the deployment namespace is `<prefix>-<environment>`, but otherwise just `<prefix>`. - For **non-managed** clusters, the auto-generated namespace is set in the `KUBECONFIG`, but the user is responsible for ensuring its existence. You can fully customize this value using [`environment:kubernetes:namespace`](../../../ci/environments/configure_kubernetes_deployments.md) in `.gitlab-ci.yml`. When you customize the namespace, existing environments remain linked to their current namespaces until you [clear the cluster cache](gitlab_managed_clusters.md#clearing-the-cluster-cache). ### Protecting credentials By default, anyone who can create a deployment job can access any CI/CD variable in an environment's deployment job. This includes `KUBECONFIG`, which gives access to any secret available to the associated service account in your cluster. To keep your production credentials safe, consider using [protected environments](../../../ci/environments/protected_environments.md), combined with one of the following: - A GitLab-managed cluster and namespace per environment. - An environment-scoped cluster per protected environment. The same cluster can be added multiple times with multiple restricted service accounts. ## Web terminals for Kubernetes clusters The Kubernetes integration adds [web terminal](../../../ci/environments/_index.md#web-terminals-deprecated) support to your [environments](../../../ci/environments/_index.md). This is based on the `exec` functionality found in Docker and Kubernetes, so you get a new shell session in your existing containers. To use this integration, you should deploy to Kubernetes using the deployment variables on this page, ensuring any deployments, replica sets, and pods are annotated with: - `app.gitlab.com/env: $CI_ENVIRONMENT_SLUG` - `app.gitlab.com/app: $CI_PROJECT_PATH_SLUG` `$CI_ENVIRONMENT_SLUG` and `$CI_PROJECT_PATH_SLUG` are the values of the CI/CD variables. You must be the project owner or have `maintainer` permissions to use terminals. Support is limited to the first container in the first pod of your environment. ## Troubleshooting Before the deployment jobs starts, GitLab creates the following specifically for the deployment job: - A namespace. - A service account. However, sometimes GitLab cannot create them. In such instances, your job can fail with the message: ```plaintext This job failed because the necessary resources were not successfully created. ``` To find the cause of this error when creating a namespace and service account, check the [logs](../../../administration/logs/_index.md#kuberneteslog-deprecated). Reasons for failure include: - The token you gave GitLab does not have [`cluster-admin`](https://kubernetes.io/docs/reference/access-authn-authz/rbac/#user-facing-roles) privileges required by GitLab. - Missing `KUBECONFIG` or `KUBE_TOKEN` deployment variables. To be passed to your job, they must have a matching [`environment:name`](../../../ci/environments/_index.md). If your job has no `environment:name` set, the Kubernetes credentials are not passed to it. {{< alert type="note" >}} Project-level clusters upgraded from GitLab 12.0 or older may be configured in a way that causes this error. Ensure you clear the [GitLab-managed cluster](gitlab_managed_clusters.md) option if you want to manage namespaces and service accounts yourself. {{< /alert >}}
--- stage: Deploy group: Environments info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments title: Deploy to a Kubernetes cluster with cluster certificates (deprecated) breadcrumbs: - doc - user - project - clusters --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed {{< /details >}} {{< history >}} - [Deprecated](https://gitlab.com/groups/gitlab-org/configure/-/epics/8) in GitLab 14.5. {{< /history >}} {{< alert type="warning" >}} This feature was [deprecated](https://gitlab.com/groups/gitlab-org/configure/-/epics/8) in GitLab 14.5. To connect your cluster to GitLab, use the [GitLab agent for Kubernetes](../../clusters/agent/_index.md). To deploy with the agent, use the [CI/CD workflow](../../clusters/agent/ci_cd_workflow.md). {{< /alert >}} A Kubernetes cluster can be the destination for a deployment job. If - The cluster is integrated with GitLab, special [deployment variables](#deployment-variables) are made available to your job and configuration is not required. You can immediately begin interacting with the cluster from your jobs using tools such as `kubectl` or `helm`. - You don't use the GitLab cluster integration, you can still deploy to your cluster. However, you must configure Kubernetes tools yourself using [CI/CD variables](../../../ci/variables/_index.md#for-a-project) before you can interact with the cluster from your jobs. ## Deployment variables Deployment variables require a valid [Deploy Token](../deploy_tokens/_index.md) named [`gitlab-deploy-token`](../deploy_tokens/_index.md#gitlab-deploy-token), and the following command in your deployment job script, for Kubernetes to access the registry: - Using Kubernetes 1.18+: ```shell kubectl create secret docker-registry gitlab-registry --docker-server="$CI_REGISTRY" --docker-username="$CI_DEPLOY_USER" --docker-password="$CI_DEPLOY_PASSWORD" --docker-email="$GITLAB_USER_EMAIL" -o yaml --dry-run=client | kubectl apply -f - ``` - Using Kubernetes <1.18: ```shell kubectl create secret docker-registry gitlab-registry --docker-server="$CI_REGISTRY" --docker-username="$CI_DEPLOY_USER" --docker-password="$CI_DEPLOY_PASSWORD" --docker-email="$GITLAB_USER_EMAIL" -o yaml --dry-run | kubectl apply -f - ``` The Kubernetes cluster integration exposes these [deployment variables](../../../ci/variables/predefined_variables.md#deployment-variables) in the GitLab CI/CD build environment to deployment jobs. Deployment jobs have [defined a target environment](../../../ci/environments/_index.md). | Deployment Variable | Description | |----------------------------|-------------| | `KUBE_URL` | Equal to the API URL. | | `KUBE_TOKEN` | The Kubernetes token of the [environment service account](cluster_access.md). | | `KUBE_NAMESPACE` | The namespace associated with the project's deployment service account. In the format `<project_name>-<project_id>-<environment>`. For GitLab-managed clusters, a matching namespace is automatically created by GitLab in the cluster. If your cluster was created before GitLab 12.2, the default `KUBE_NAMESPACE` is set to `<project_name>-<project_id>`. | | `KUBE_CA_PEM_FILE` | Path to a file containing PEM data. Only present if a custom CA bundle was specified. | | `KUBE_CA_PEM` | (**deprecated**) Raw PEM data. Only if a custom CA bundle was specified. | | `KUBECONFIG` | Path to a file containing `kubeconfig` for this deployment. CA bundle would be embedded if specified. This configuration also embeds the same token defined in `KUBE_TOKEN` so you likely need only this variable. This variable name is also automatically picked up by `kubectl` so you don't need to reference it explicitly if using `kubectl`. | | `KUBE_INGRESS_BASE_DOMAIN` | This variable can be used to set a domain per cluster. See [cluster domains](gitlab_managed_clusters.md#base-domain) for more information. | ## Custom namespace The Kubernetes integration provides a `KUBECONFIG` with an auto-generated namespace to deployment jobs. It defaults to using project-environment specific namespaces of the form `<prefix>-<environment>`, where `<prefix>` is of the form `<project_name>-<project_id>`. For more information, see [Deployment variables](#deployment-variables). You can customize the deployment namespace in a few ways: - You can choose between a **namespace per [environment](../../../ci/environments/_index.md)** or a **namespace per project**. A namespace per environment is the default and recommended setting, as it prevents the mixing of resources between production and non-production environments. - When using a project-level cluster, you can additionally customize the namespace prefix. When using namespace-per-environment, the deployment namespace is `<prefix>-<environment>`, but otherwise just `<prefix>`. - For **non-managed** clusters, the auto-generated namespace is set in the `KUBECONFIG`, but the user is responsible for ensuring its existence. You can fully customize this value using [`environment:kubernetes:namespace`](../../../ci/environments/configure_kubernetes_deployments.md) in `.gitlab-ci.yml`. When you customize the namespace, existing environments remain linked to their current namespaces until you [clear the cluster cache](gitlab_managed_clusters.md#clearing-the-cluster-cache). ### Protecting credentials By default, anyone who can create a deployment job can access any CI/CD variable in an environment's deployment job. This includes `KUBECONFIG`, which gives access to any secret available to the associated service account in your cluster. To keep your production credentials safe, consider using [protected environments](../../../ci/environments/protected_environments.md), combined with one of the following: - A GitLab-managed cluster and namespace per environment. - An environment-scoped cluster per protected environment. The same cluster can be added multiple times with multiple restricted service accounts. ## Web terminals for Kubernetes clusters The Kubernetes integration adds [web terminal](../../../ci/environments/_index.md#web-terminals-deprecated) support to your [environments](../../../ci/environments/_index.md). This is based on the `exec` functionality found in Docker and Kubernetes, so you get a new shell session in your existing containers. To use this integration, you should deploy to Kubernetes using the deployment variables on this page, ensuring any deployments, replica sets, and pods are annotated with: - `app.gitlab.com/env: $CI_ENVIRONMENT_SLUG` - `app.gitlab.com/app: $CI_PROJECT_PATH_SLUG` `$CI_ENVIRONMENT_SLUG` and `$CI_PROJECT_PATH_SLUG` are the values of the CI/CD variables. You must be the project owner or have `maintainer` permissions to use terminals. Support is limited to the first container in the first pod of your environment. ## Troubleshooting Before the deployment jobs starts, GitLab creates the following specifically for the deployment job: - A namespace. - A service account. However, sometimes GitLab cannot create them. In such instances, your job can fail with the message: ```plaintext This job failed because the necessary resources were not successfully created. ``` To find the cause of this error when creating a namespace and service account, check the [logs](../../../administration/logs/_index.md#kuberneteslog-deprecated). Reasons for failure include: - The token you gave GitLab does not have [`cluster-admin`](https://kubernetes.io/docs/reference/access-authn-authz/rbac/#user-facing-roles) privileges required by GitLab. - Missing `KUBECONFIG` or `KUBE_TOKEN` deployment variables. To be passed to your job, they must have a matching [`environment:name`](../../../ci/environments/_index.md). If your job has no `environment:name` set, the Kubernetes credentials are not passed to it. {{< alert type="note" >}} Project-level clusters upgraded from GitLab 12.0 or older may be configured in a way that causes this error. Ensure you clear the [GitLab-managed cluster](gitlab_managed_clusters.md) option if you want to manage namespaces and service accounts yourself. {{< /alert >}}
https://docs.gitlab.com/user/project/add_gke_clusters
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/add_gke_clusters.md
2025-08-13
doc/user/project/clusters
[ "doc", "user", "project", "clusters" ]
add_gke_clusters.md
Deploy
Environments
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Connect GKE clusters through cluster certificates (deprecated)
null
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed {{< /details >}} {{< history >}} - [Deprecated](https://gitlab.com/groups/gitlab-org/configure/-/epics/8) in GitLab 14.5. {{< /history >}} {{< alert type="warning" >}} This feature was [deprecated](https://gitlab.com/groups/gitlab-org/configure/-/epics/8) in GitLab 14.5. Use [Infrastructure as Code](../../infrastructure/clusters/connect/new_gke_cluster.md) to create a cluster hosted on Google Kubernetes Engine (GKE). {{< /alert >}} Through GitLab, you can create new and connect existing clusters hosted on Google Kubernetes Engine (GKE). ## Connect an existing GKE cluster If you already have a GKE cluster and want to connect it to GitLab, use the [GitLab agent for Kubernetes](../../clusters/agent/_index.md). ## Create a new GKE cluster from GitLab All GKE clusters provisioned by GitLab are [VPC-native](https://cloud.google.com/kubernetes-engine/docs/how-to/alias-ips). To create a new GKE cluster from GitLab, use [Infrastructure as Code](../../infrastructure/clusters/connect/new_gke_cluster.md). ## Create a new cluster on GKE through cluster certificates {{< history >}} - [Deprecated](https://gitlab.com/groups/gitlab-org/-/epics/6049) in GitLab 14.0. {{< /history >}} Prerequisites: - A [Google Cloud billing account](https://cloud.google.com/billing/docs/how-to/manage-billing-account) set up with access. - Kubernetes Engine API and related services enabled. It should work immediately but may take up to 10 minutes after you create a project. For more information see the ["Before you begin" section of the Kubernetes Engine docs](https://cloud.google.com/kubernetes-engine/docs/deploy-app-cluster#before-you-begin). Note the following: - The [Google authentication integration](../../../integration/google.md) must be enabled in GitLab at the instance level. If that's not the case, ask your GitLab administrator to enable it. On GitLab.com, this is enabled. - All GKE clusters created by GitLab are RBAC-enabled. Take a look at the [RBAC section](cluster_access.md#rbac-cluster-resources) for more information. - The cluster's pod address IP range is set to `/16` instead of the regular `/14`. `/16` is a CIDR notation. - GitLab requires basic authentication enabled and a client certificate issued for the cluster to set up an [initial service account](cluster_access.md). In [GitLab versions 11.10 and later](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/58208), the cluster creation process explicitly requests GKE to create clusters with basic authentication enabled and a client certificate. To create new Kubernetes clusters to your project, group, or instance, through cluster certificates: 1. Go to your: - Project's {{< icon name="cloud-gear" >}} **Operate > Kubernetes clusters** page, for a project-level cluster. - Group's {{< icon name="cloud-gear" >}} **Kubernetes** page, for a group-level cluster. - The **Admin** area's **Kubernetes** page, for an instance-level cluster. 1. Select **Integrate with a cluster certificate**. 1. Under the **Create new cluster** tab, select **Google GKE**. 1. Connect your Google account if you haven't done already by selecting the **Sign in with Google** button. 1. Choose your cluster's settings: - **Kubernetes cluster name** - The name you wish to give the cluster. - **Environment scope** - The [associated environment](multiple_kubernetes_clusters.md#setting-the-environment-scope) to this cluster. - **Google Cloud Platform project** - Choose the project you created in your GCP console to host the Kubernetes cluster. For more information, see [Creating and managing projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - **Zone** - Choose the [region zone](https://cloud.google.com/compute/docs/regions-zones/) under which to create the cluster. - **Number of nodes** - Enter the number of nodes you wish the cluster to have. - **Machine type** - The [machine type](https://cloud.google.com/compute/docs/machine-resource) of the Virtual Machine instance to base the cluster on. - **Enable Cloud Run for Anthos** - Check this if you want to use Cloud Run for Anthos for this cluster. See the [Cloud Run for Anthos section](#cloud-run-for-anthos) for more information. - **GitLab-managed cluster** - Leave this checked if you want GitLab to manage namespaces and service accounts for this cluster. See the [Managed clusters section](gitlab_managed_clusters.md) for more information. 1. Finally, select the **Create Kubernetes cluster** button. After a couple of minutes, your cluster is ready. ### Cloud Run for Anthos You can choose to use Cloud Run for Anthos in place of installing Knative and Istio separately after the cluster has been created. This means that Cloud Run (Knative), Istio, and HTTP Load Balancing are enabled on the cluster from the start, and cannot be installed or uninstalled.
--- stage: Deploy group: Environments info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments title: Connect GKE clusters through cluster certificates (deprecated) breadcrumbs: - doc - user - project - clusters --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed {{< /details >}} {{< history >}} - [Deprecated](https://gitlab.com/groups/gitlab-org/configure/-/epics/8) in GitLab 14.5. {{< /history >}} {{< alert type="warning" >}} This feature was [deprecated](https://gitlab.com/groups/gitlab-org/configure/-/epics/8) in GitLab 14.5. Use [Infrastructure as Code](../../infrastructure/clusters/connect/new_gke_cluster.md) to create a cluster hosted on Google Kubernetes Engine (GKE). {{< /alert >}} Through GitLab, you can create new and connect existing clusters hosted on Google Kubernetes Engine (GKE). ## Connect an existing GKE cluster If you already have a GKE cluster and want to connect it to GitLab, use the [GitLab agent for Kubernetes](../../clusters/agent/_index.md). ## Create a new GKE cluster from GitLab All GKE clusters provisioned by GitLab are [VPC-native](https://cloud.google.com/kubernetes-engine/docs/how-to/alias-ips). To create a new GKE cluster from GitLab, use [Infrastructure as Code](../../infrastructure/clusters/connect/new_gke_cluster.md). ## Create a new cluster on GKE through cluster certificates {{< history >}} - [Deprecated](https://gitlab.com/groups/gitlab-org/-/epics/6049) in GitLab 14.0. {{< /history >}} Prerequisites: - A [Google Cloud billing account](https://cloud.google.com/billing/docs/how-to/manage-billing-account) set up with access. - Kubernetes Engine API and related services enabled. It should work immediately but may take up to 10 minutes after you create a project. For more information see the ["Before you begin" section of the Kubernetes Engine docs](https://cloud.google.com/kubernetes-engine/docs/deploy-app-cluster#before-you-begin). Note the following: - The [Google authentication integration](../../../integration/google.md) must be enabled in GitLab at the instance level. If that's not the case, ask your GitLab administrator to enable it. On GitLab.com, this is enabled. - All GKE clusters created by GitLab are RBAC-enabled. Take a look at the [RBAC section](cluster_access.md#rbac-cluster-resources) for more information. - The cluster's pod address IP range is set to `/16` instead of the regular `/14`. `/16` is a CIDR notation. - GitLab requires basic authentication enabled and a client certificate issued for the cluster to set up an [initial service account](cluster_access.md). In [GitLab versions 11.10 and later](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/58208), the cluster creation process explicitly requests GKE to create clusters with basic authentication enabled and a client certificate. To create new Kubernetes clusters to your project, group, or instance, through cluster certificates: 1. Go to your: - Project's {{< icon name="cloud-gear" >}} **Operate > Kubernetes clusters** page, for a project-level cluster. - Group's {{< icon name="cloud-gear" >}} **Kubernetes** page, for a group-level cluster. - The **Admin** area's **Kubernetes** page, for an instance-level cluster. 1. Select **Integrate with a cluster certificate**. 1. Under the **Create new cluster** tab, select **Google GKE**. 1. Connect your Google account if you haven't done already by selecting the **Sign in with Google** button. 1. Choose your cluster's settings: - **Kubernetes cluster name** - The name you wish to give the cluster. - **Environment scope** - The [associated environment](multiple_kubernetes_clusters.md#setting-the-environment-scope) to this cluster. - **Google Cloud Platform project** - Choose the project you created in your GCP console to host the Kubernetes cluster. For more information, see [Creating and managing projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - **Zone** - Choose the [region zone](https://cloud.google.com/compute/docs/regions-zones/) under which to create the cluster. - **Number of nodes** - Enter the number of nodes you wish the cluster to have. - **Machine type** - The [machine type](https://cloud.google.com/compute/docs/machine-resource) of the Virtual Machine instance to base the cluster on. - **Enable Cloud Run for Anthos** - Check this if you want to use Cloud Run for Anthos for this cluster. See the [Cloud Run for Anthos section](#cloud-run-for-anthos) for more information. - **GitLab-managed cluster** - Leave this checked if you want GitLab to manage namespaces and service accounts for this cluster. See the [Managed clusters section](gitlab_managed_clusters.md) for more information. 1. Finally, select the **Create Kubernetes cluster** button. After a couple of minutes, your cluster is ready. ### Cloud Run for Anthos You can choose to use Cloud Run for Anthos in place of installing Knative and Istio separately after the cluster has been created. This means that Cloud Run (Knative), Istio, and HTTP Load Balancing are enabled on the cluster from the start, and cannot be installed or uninstalled.
https://docs.gitlab.com/user/project/clusters/runbooks
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/clusters/_index.md
2025-08-13
doc/user/project/clusters/runbooks
[ "doc", "user", "project", "clusters", "runbooks" ]
_index.md
Deploy
Environments
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Runbooks
Executable runbooks, automation, troubleshooting, and operations.
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} Runbooks are a collection of documented procedures that explain how to carry out a particular process, be it starting, stopping, debugging, or troubleshooting a particular system. Using [Jupyter Notebooks](https://jupyter.org/) and the [Rubix library](https://github.com/Nurtch/rubix), users can get started writing their own executable runbooks. Historically, runbooks took the form of a decision tree or a detailed step-by-step guide depending on the condition or system. Modern implementations have introduced the concept of an "executable runbooks", where, along with a well-defined process, operators can execute pre-written code blocks or database queries against a given environment. ## Executable Runbooks The JupyterHub app offered with the GitLab Kubernetes integration now ships with Nurtch's Rubix library, providing a simple way to create DevOps runbooks. A sample runbook is provided, showcasing common operations. While Rubix makes it simple to create common Kubernetes and AWS workflows, you can also create them manually without Rubix. <i class="fa fa-youtube-play youtube" aria-hidden="true"></i> Watch this [video](https://www.youtube.com/watch?v=Q_OqHIIUPjE) for an overview of how this is accomplished in GitLab! ## Requirements To create an executable runbook, you need: - **Kubernetes** - A Kubernetes cluster is required to deploy the rest of the applications. The simplest way to get started is to connect a cluster using the [GitLab agent for Kubernetes](../../../clusters/agent/_index.md). - **Ingress** - Ingress can provide load balancing, SSL termination, and name-based virtual hosting. It acts as a web proxy for your applications. - **JupyterHub** - [JupyterHub](https://jupyterhub.readthedocs.io/) is a multi-user service for managing notebooks across a team. Jupyter Notebooks provide a web-based interactive programming environment used for data analysis, visualization, and machine learning. ## Nurtch Nurtch is the company behind the [Rubix library](https://github.com/Nurtch/rubix). Rubix is an open-source Python library that makes it easy to perform common DevOps tasks inside Jupyter Notebooks. Tasks such as plotting Cloudwatch metrics and rolling your ECS/Kubernetes app are simplified down to a couple of lines of code. See the [Nurtch Documentation](https://docs.nurtch.com/en/latest/) for more information. ## Configure an executable runbook with GitLab Follow this step-by-step guide to configure an executable runbook in GitLab using the components outlined previously and the pre-loaded demo runbook. 1. Create an [OAuth application for JupyterHub](../../../../integration/oauth_provider.md). 1. When [installing JupyterHub with Helm](https://zero-to-jupyterhub.readthedocs.io/en/latest/jupyterhub/installation.html), use the following values: ```yaml #----------------------------------------------------------------------------- # The hub.config.GitLabOAuthenticator section must be customized! #----------------------------------------------------------------------------- hub: config: GitLabOAuthenticator: # Limit access to members of specific projects or groups or to specific users: # allowedGitlabGroups: [ "my-group-1", "my-group-2" ] # allowedProjectIds: [ 12345, 6789 ] # allowed_users: ["user-1", "user-2"] client_id: <Your OAuth Application ID> client_secret: <Your OAuth Application ID> enable_auth_state: true gitlab_url: https://gitlab.example.com oauth_callback_url: http://<Jupyter Hostname>/hub/oauth_callback scope: - read_user - read_api - openid - profile - email JupyterHub: authenticator_class: gitlab extraConfig: gitlab-config: | c.KubeSpawner.cmd = ['jupyter-labhub'] c.GitLabOAuthenticator.scope = ['api read_repository write_repository'] async def add_auth_env(spawner): ''' We set user's id, login and access token on single user image to enable repository integration for JupyterHub. See: https://gitlab.com/gitlab-org/gitlab-foss/-/issues/47138#note_154294790 ''' auth_state = await spawner.user.get_auth_state() if not auth_state: spawner.log.warning("No auth state for %s", spawner.user) return spawner.environment['GITLAB_ACCESS_TOKEN'] = auth_state['access_token'] spawner.environment['GITLAB_USER_EMAIL'] = auth_state['gitlab_user']['email'] spawner.environment['GITLAB_USER_ID'] = str(auth_state['gitlab_user']['id']) spawner.environment['GITLAB_USER_LOGIN'] = auth_state['gitlab_user']['username'] spawner.environment['GITLAB_USER_NAME'] = auth_state['gitlab_user']['name'] c.KubeSpawner.pre_spawn_hook = add_auth_env singleuser: defaultUrl: "/lab" image: name: registry.gitlab.com/gitlab-org/jupyterhub-user-image tag: latest lifecycleHooks: postStart: exec: command: - "sh" - "-c" - > git clone https://gitlab.com/gitlab-org/nurtch-demo.git DevOps-Runbook-Demo || true; echo "https://oauth2:${GITLAB_ACCESS_TOKEN}@${GITLAB_HOST}" > ~/.git-credentials; git config --global credential.helper store; git config --global user.email "${GITLAB_USER_EMAIL}"; git config --global user.name "${GITLAB_USER_NAME}"; jupyter serverextension enable --py jupyterlab_git proxy: service: type: ClusterIP ``` 1. After JupyterHub has been installed successfully, open the **Jupyter Hostname** in your browser. Select **Sign in with GitLab** button to sign in to JupyterHub and start the server. Authentication is enabled for any user of the GitLab instance with OAuth2. This button redirects you to a page at GitLab requesting authorization for JupyterHub to use your GitLab account. ![authorize Jupyter](img/authorize_jupyter_v11_6.png) 1. Select **Authorize**, and GitLab redirects you to the JupyterHub application. 1. Select **Start My Server** to start the server in a few seconds. 1. To configure the runbook's access to your GitLab project, you must enter your [GitLab Access Token](../../../profile/personal_access_tokens.md) and your Project ID in the **Setup** section of the demo runbook: 1. Select the **DevOps-Runbook-Demo** folder located on the left panel. ![demo runbook](img/demo_runbook_v11_6.png) 1. Select the `Nurtch-DevOps-Demo.ipynb` runbook. ![sample runbook](img/sample_runbook_v11_6.png) Jupyter displays the runbook's contents in the right-hand side of the screen. The **Setup** section displays your `PRIVATE_TOKEN` and your `PROJECT_ID`. Enter these values, maintaining the single quotes as follows: ```sql PRIVATE_TOKEN = '<your_access_token>' PROJECT_ID = '1234567' ``` 1. Update the `VARIABLE_NAME` on the last line of this section to match the name of the variable you're using for your access token. In this example, our variable name is `PRIVATE_TOKEN`. ```sql VARIABLE_VALUE = project.variables.get('PRIVATE_TOKEN').value ``` 1. To configure the operation of a runbook, create and configure variables. For this example, we are using the **Run SQL queries in Notebook** section in the sample runbook to query a PostgreSQL database. The first four lines of the following code block define the variables that are required for this query to function: ```sql %env DB_USER={project.variables.get('DB_USER').value} %env DB_PASSWORD={project.variables.get('DB_PASSWORD').value} %env DB_ENDPOINT={project.variables.get('DB_ENDPOINT').value} %env DB_NAME={project.variables.get('DB_NAME').value} ``` 1. Go to **Settings > CI/CD > Variables** to create the variables in your project. ![GitLab variables](img/gitlab_variables_v11_6.png) 1. Select **Save variables**. 1. In Jupyter, select the **Run SQL queries in Notebook** heading, and then select **Run**. The results are displayed inline as follows: ![PostgreSQL query](img/postgres_query_v11_6.png) You can try other operations, such as running shell scripts or interacting with a Kubernetes cluster. Visit the [Nurtch Documentation](https://docs.nurtch.com/) for more information.
--- stage: Deploy group: Environments info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments title: Runbooks description: Executable runbooks, automation, troubleshooting, and operations. breadcrumbs: - doc - user - project - clusters - runbooks --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} Runbooks are a collection of documented procedures that explain how to carry out a particular process, be it starting, stopping, debugging, or troubleshooting a particular system. Using [Jupyter Notebooks](https://jupyter.org/) and the [Rubix library](https://github.com/Nurtch/rubix), users can get started writing their own executable runbooks. Historically, runbooks took the form of a decision tree or a detailed step-by-step guide depending on the condition or system. Modern implementations have introduced the concept of an "executable runbooks", where, along with a well-defined process, operators can execute pre-written code blocks or database queries against a given environment. ## Executable Runbooks The JupyterHub app offered with the GitLab Kubernetes integration now ships with Nurtch's Rubix library, providing a simple way to create DevOps runbooks. A sample runbook is provided, showcasing common operations. While Rubix makes it simple to create common Kubernetes and AWS workflows, you can also create them manually without Rubix. <i class="fa fa-youtube-play youtube" aria-hidden="true"></i> Watch this [video](https://www.youtube.com/watch?v=Q_OqHIIUPjE) for an overview of how this is accomplished in GitLab! ## Requirements To create an executable runbook, you need: - **Kubernetes** - A Kubernetes cluster is required to deploy the rest of the applications. The simplest way to get started is to connect a cluster using the [GitLab agent for Kubernetes](../../../clusters/agent/_index.md). - **Ingress** - Ingress can provide load balancing, SSL termination, and name-based virtual hosting. It acts as a web proxy for your applications. - **JupyterHub** - [JupyterHub](https://jupyterhub.readthedocs.io/) is a multi-user service for managing notebooks across a team. Jupyter Notebooks provide a web-based interactive programming environment used for data analysis, visualization, and machine learning. ## Nurtch Nurtch is the company behind the [Rubix library](https://github.com/Nurtch/rubix). Rubix is an open-source Python library that makes it easy to perform common DevOps tasks inside Jupyter Notebooks. Tasks such as plotting Cloudwatch metrics and rolling your ECS/Kubernetes app are simplified down to a couple of lines of code. See the [Nurtch Documentation](https://docs.nurtch.com/en/latest/) for more information. ## Configure an executable runbook with GitLab Follow this step-by-step guide to configure an executable runbook in GitLab using the components outlined previously and the pre-loaded demo runbook. 1. Create an [OAuth application for JupyterHub](../../../../integration/oauth_provider.md). 1. When [installing JupyterHub with Helm](https://zero-to-jupyterhub.readthedocs.io/en/latest/jupyterhub/installation.html), use the following values: ```yaml #----------------------------------------------------------------------------- # The hub.config.GitLabOAuthenticator section must be customized! #----------------------------------------------------------------------------- hub: config: GitLabOAuthenticator: # Limit access to members of specific projects or groups or to specific users: # allowedGitlabGroups: [ "my-group-1", "my-group-2" ] # allowedProjectIds: [ 12345, 6789 ] # allowed_users: ["user-1", "user-2"] client_id: <Your OAuth Application ID> client_secret: <Your OAuth Application ID> enable_auth_state: true gitlab_url: https://gitlab.example.com oauth_callback_url: http://<Jupyter Hostname>/hub/oauth_callback scope: - read_user - read_api - openid - profile - email JupyterHub: authenticator_class: gitlab extraConfig: gitlab-config: | c.KubeSpawner.cmd = ['jupyter-labhub'] c.GitLabOAuthenticator.scope = ['api read_repository write_repository'] async def add_auth_env(spawner): ''' We set user's id, login and access token on single user image to enable repository integration for JupyterHub. See: https://gitlab.com/gitlab-org/gitlab-foss/-/issues/47138#note_154294790 ''' auth_state = await spawner.user.get_auth_state() if not auth_state: spawner.log.warning("No auth state for %s", spawner.user) return spawner.environment['GITLAB_ACCESS_TOKEN'] = auth_state['access_token'] spawner.environment['GITLAB_USER_EMAIL'] = auth_state['gitlab_user']['email'] spawner.environment['GITLAB_USER_ID'] = str(auth_state['gitlab_user']['id']) spawner.environment['GITLAB_USER_LOGIN'] = auth_state['gitlab_user']['username'] spawner.environment['GITLAB_USER_NAME'] = auth_state['gitlab_user']['name'] c.KubeSpawner.pre_spawn_hook = add_auth_env singleuser: defaultUrl: "/lab" image: name: registry.gitlab.com/gitlab-org/jupyterhub-user-image tag: latest lifecycleHooks: postStart: exec: command: - "sh" - "-c" - > git clone https://gitlab.com/gitlab-org/nurtch-demo.git DevOps-Runbook-Demo || true; echo "https://oauth2:${GITLAB_ACCESS_TOKEN}@${GITLAB_HOST}" > ~/.git-credentials; git config --global credential.helper store; git config --global user.email "${GITLAB_USER_EMAIL}"; git config --global user.name "${GITLAB_USER_NAME}"; jupyter serverextension enable --py jupyterlab_git proxy: service: type: ClusterIP ``` 1. After JupyterHub has been installed successfully, open the **Jupyter Hostname** in your browser. Select **Sign in with GitLab** button to sign in to JupyterHub and start the server. Authentication is enabled for any user of the GitLab instance with OAuth2. This button redirects you to a page at GitLab requesting authorization for JupyterHub to use your GitLab account. ![authorize Jupyter](img/authorize_jupyter_v11_6.png) 1. Select **Authorize**, and GitLab redirects you to the JupyterHub application. 1. Select **Start My Server** to start the server in a few seconds. 1. To configure the runbook's access to your GitLab project, you must enter your [GitLab Access Token](../../../profile/personal_access_tokens.md) and your Project ID in the **Setup** section of the demo runbook: 1. Select the **DevOps-Runbook-Demo** folder located on the left panel. ![demo runbook](img/demo_runbook_v11_6.png) 1. Select the `Nurtch-DevOps-Demo.ipynb` runbook. ![sample runbook](img/sample_runbook_v11_6.png) Jupyter displays the runbook's contents in the right-hand side of the screen. The **Setup** section displays your `PRIVATE_TOKEN` and your `PROJECT_ID`. Enter these values, maintaining the single quotes as follows: ```sql PRIVATE_TOKEN = '<your_access_token>' PROJECT_ID = '1234567' ``` 1. Update the `VARIABLE_NAME` on the last line of this section to match the name of the variable you're using for your access token. In this example, our variable name is `PRIVATE_TOKEN`. ```sql VARIABLE_VALUE = project.variables.get('PRIVATE_TOKEN').value ``` 1. To configure the operation of a runbook, create and configure variables. For this example, we are using the **Run SQL queries in Notebook** section in the sample runbook to query a PostgreSQL database. The first four lines of the following code block define the variables that are required for this query to function: ```sql %env DB_USER={project.variables.get('DB_USER').value} %env DB_PASSWORD={project.variables.get('DB_PASSWORD').value} %env DB_ENDPOINT={project.variables.get('DB_ENDPOINT').value} %env DB_NAME={project.variables.get('DB_NAME').value} ``` 1. Go to **Settings > CI/CD > Variables** to create the variables in your project. ![GitLab variables](img/gitlab_variables_v11_6.png) 1. Select **Save variables**. 1. In Jupyter, select the **Run SQL queries in Notebook** heading, and then select **Run**. The results are displayed inline as follows: ![PostgreSQL query](img/postgres_query_v11_6.png) You can try other operations, such as running shell scripts or interacting with a Kubernetes cluster. Visit the [Nurtch Documentation](https://docs.nurtch.com/) for more information.
https://docs.gitlab.com/user/project/google_play
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/google_play.md
2025-08-13
doc/user/project/integrations
[ "doc", "user", "project", "integrations" ]
google_play.md
none
unassigned
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Google Play
null
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/111621) in GitLab 15.10 [with a flag](../../../administration/feature_flags/_index.md) named `google_play_integration`. Disabled by default. - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/issues/389611) in GitLab 15.11. Feature flag `google_play_integration` removed. {{< /history >}} This feature is part of [Mobile DevOps](../../../ci/mobile_devops/_index.md) developed by GitLab. The feature is still in development, but you can: - [Request a feature](https://gitlab.com/gitlab-org/incubation-engineering/mobile-devops/feedback/-/issues/new?issuable_template=feature_request). - [Report a bug](https://gitlab.com/gitlab-org/incubation-engineering/mobile-devops/feedback/-/issues/new?issuable_template=report_bug). - [Share feedback](https://gitlab.com/gitlab-org/incubation-engineering/mobile-devops/feedback/-/issues/new?issuable_template=general_feedback). With the Google Play integration, you can configure your CI/CD pipelines to connect to the [Google Play Console](https://play.google.com/console/developers) to build and release apps for Android devices. The Google Play integration works out of the box with [fastlane](https://fastlane.tools/). You can also use this integration with other build tools. ## Enable the integration in GitLab Prerequisites: - You must have a [Google Play Console](https://play.google.com/console/developers) developer account. - You must [generate a new service account key for your project](https://developers.google.com/android-publisher/getting_started) from the Google Cloud console. To enable the Google Play integration in GitLab: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings** > **Integrations**. 1. Select **Google Play**. 1. In **Enable integration**, select the **Active** checkbox. 1. In **Package name**, enter the package name of the app (for example, `com.gitlab.app_name`). 1. Optional. Under **Protected branches and tags only**, select the **Set variables on protected branches and tags only** checkbox. 1. In **Service account key (.JSON)**, drag or upload your key file. 1. Optional. Select **Test settings**. 1. Select **Save changes**. After you enable the integration, the global variables `$SUPPLY_PACKAGE_NAME` and `$SUPPLY_JSON_KEY_DATA` are created for CI/CD use. ### CI/CD variable security Malicious code pushed to your `.gitlab-ci.yml` file could compromise your variables, including `$SUPPLY_JSON_KEY_DATA`, and send them to a third-party server. For more information, see [CI/CD variable security](../../../ci/variables/_index.md#cicd-variable-security). ## Enable the integration in fastlane To enable the integration in fastlane and upload the build to the given track in Google Play, you can add the following code to your app's `fastlane/Fastfile`: ```ruby upload_to_play_store( track: 'internal', aab: '../build/app/outputs/bundle/release/app-release.aab' ) ```
--- stage: none group: unassigned info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments title: Google Play breadcrumbs: - doc - user - project - integrations --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/111621) in GitLab 15.10 [with a flag](../../../administration/feature_flags/_index.md) named `google_play_integration`. Disabled by default. - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/issues/389611) in GitLab 15.11. Feature flag `google_play_integration` removed. {{< /history >}} This feature is part of [Mobile DevOps](../../../ci/mobile_devops/_index.md) developed by GitLab. The feature is still in development, but you can: - [Request a feature](https://gitlab.com/gitlab-org/incubation-engineering/mobile-devops/feedback/-/issues/new?issuable_template=feature_request). - [Report a bug](https://gitlab.com/gitlab-org/incubation-engineering/mobile-devops/feedback/-/issues/new?issuable_template=report_bug). - [Share feedback](https://gitlab.com/gitlab-org/incubation-engineering/mobile-devops/feedback/-/issues/new?issuable_template=general_feedback). With the Google Play integration, you can configure your CI/CD pipelines to connect to the [Google Play Console](https://play.google.com/console/developers) to build and release apps for Android devices. The Google Play integration works out of the box with [fastlane](https://fastlane.tools/). You can also use this integration with other build tools. ## Enable the integration in GitLab Prerequisites: - You must have a [Google Play Console](https://play.google.com/console/developers) developer account. - You must [generate a new service account key for your project](https://developers.google.com/android-publisher/getting_started) from the Google Cloud console. To enable the Google Play integration in GitLab: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings** > **Integrations**. 1. Select **Google Play**. 1. In **Enable integration**, select the **Active** checkbox. 1. In **Package name**, enter the package name of the app (for example, `com.gitlab.app_name`). 1. Optional. Under **Protected branches and tags only**, select the **Set variables on protected branches and tags only** checkbox. 1. In **Service account key (.JSON)**, drag or upload your key file. 1. Optional. Select **Test settings**. 1. Select **Save changes**. After you enable the integration, the global variables `$SUPPLY_PACKAGE_NAME` and `$SUPPLY_JSON_KEY_DATA` are created for CI/CD use. ### CI/CD variable security Malicious code pushed to your `.gitlab-ci.yml` file could compromise your variables, including `$SUPPLY_JSON_KEY_DATA`, and send them to a third-party server. For more information, see [CI/CD variable security](../../../ci/variables/_index.md#cicd-variable-security). ## Enable the integration in fastlane To enable the integration in fastlane and upload the build to the given track in Google Play, you can add the following code to your app's `fastlane/Fastfile`: ```ruby upload_to_play_store( track: 'internal', aab: '../build/app/outputs/bundle/release/app-release.aab' ) ```
https://docs.gitlab.com/user/project/gitlab_slack_app_troubleshooting
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/gitlab_slack_app_troubleshooting.md
2025-08-13
doc/user/project/integrations
[ "doc", "user", "project", "integrations" ]
gitlab_slack_app_troubleshooting.md
Create
Import
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Troubleshooting GitLab for Slack app
Troubleshooting guide for the GitLab for Slack app. Covers common issues like missing projects and notification problems.
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} When working with the GitLab for Slack app, you might encounter the following issues. For administrator documentation, see [GitLab for Slack app administration](../../../administration/settings/slack_app.md#troubleshooting). ## App does not appear in the list of integrations The GitLab for Slack app might not appear in the list of integrations. To have the GitLab for Slack app on your GitLab Self-Managed instance, an administrator must [enable the integration](../../../administration/settings/slack_app.md). On GitLab.com, the GitLab for Slack app is available by default. ## Error: `Project or alias not found` Some Slack commands must have a project full path or alias and fail with the following error if the project cannot be found: ```plaintext GitLab error: project or alias not found ``` To resolve this issue, ensure: - The project full path is correct. - If using a [project alias](gitlab_slack_application.md#create-a-project-alias), the alias is correct. - The GitLab for Slack app is [enabled for the project](gitlab_slack_application.md#from-the-project-or-group-settings). ## Slash commands return `dispatch_failed` in Slack Slash commands might return `/gitlab failed with the error "dispatch_failed"` in Slack. To resolve this issue, ensure an administrator has properly configured the [GitLab for Slack app settings](../../../administration/settings/slack_app.md) on your GitLab Self-Managed instance. ## Notifications not received to a channel If you're not receiving notifications to a Slack channel, ensure: - The channel name you configured is correct. - If the channel is private, you've [added the GitLab for Slack app to the channel](gitlab_slack_application.md#receive-notifications-to-a-private-channel). ## App Home does not display properly If the [App Home](https://api.slack.com/start/overview#app_home) does not display properly, ensure your [app is up to date](gitlab_slack_application.md#reinstall-the-gitlab-for-slack-app). ## Error: `This alias has already been taken` You might encounter error `422: The change you requested was rejected` when trying to set up on a new project. The returned Rails error might be: ```plaintext "exception.message": "Validation failed: Alias This alias has already been taken" ``` To resolve this issue: 1. Search in your namespace for projects with similar names and have the GitLab for Slack app enabled. 1. Check among these projects for those with the same alias name as the failed project. 1. Edit the alias, make it different, and retry enabling GitLab for Slack app for the failed project.
--- stage: Create group: Import info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments title: Troubleshooting GitLab for Slack app description: Troubleshooting guide for the GitLab for Slack app. Covers common issues like missing projects and notification problems. breadcrumbs: - doc - user - project - integrations --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} When working with the GitLab for Slack app, you might encounter the following issues. For administrator documentation, see [GitLab for Slack app administration](../../../administration/settings/slack_app.md#troubleshooting). ## App does not appear in the list of integrations The GitLab for Slack app might not appear in the list of integrations. To have the GitLab for Slack app on your GitLab Self-Managed instance, an administrator must [enable the integration](../../../administration/settings/slack_app.md). On GitLab.com, the GitLab for Slack app is available by default. ## Error: `Project or alias not found` Some Slack commands must have a project full path or alias and fail with the following error if the project cannot be found: ```plaintext GitLab error: project or alias not found ``` To resolve this issue, ensure: - The project full path is correct. - If using a [project alias](gitlab_slack_application.md#create-a-project-alias), the alias is correct. - The GitLab for Slack app is [enabled for the project](gitlab_slack_application.md#from-the-project-or-group-settings). ## Slash commands return `dispatch_failed` in Slack Slash commands might return `/gitlab failed with the error "dispatch_failed"` in Slack. To resolve this issue, ensure an administrator has properly configured the [GitLab for Slack app settings](../../../administration/settings/slack_app.md) on your GitLab Self-Managed instance. ## Notifications not received to a channel If you're not receiving notifications to a Slack channel, ensure: - The channel name you configured is correct. - If the channel is private, you've [added the GitLab for Slack app to the channel](gitlab_slack_application.md#receive-notifications-to-a-private-channel). ## App Home does not display properly If the [App Home](https://api.slack.com/start/overview#app_home) does not display properly, ensure your [app is up to date](gitlab_slack_application.md#reinstall-the-gitlab-for-slack-app). ## Error: `This alias has already been taken` You might encounter error `422: The change you requested was rejected` when trying to set up on a new project. The returned Rails error might be: ```plaintext "exception.message": "Validation failed: Alias This alias has already been taken" ``` To resolve this issue: 1. Search in your namespace for projects with similar names and have the GitLab for Slack app enabled. 1. Check among these projects for those with the same alias name as the failed project. 1. Edit the alias, make it different, and retry enabling GitLab for Slack app for the failed project.
https://docs.gitlab.com/user/project/beyond_identity
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/beyond_identity.md
2025-08-13
doc/user/project/integrations
[ "doc", "user", "project", "integrations" ]
beyond_identity.md
Create
Source Code
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Beyond Identity
Integrate GitLab with Beyond Identity to verify GPG keys added to user accounts.
{{< details >}} - Tier: Premium, Ultimate - Offering: GitLab Self-Managed, GitLab Dedicated {{< /details >}} {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/431433) in GitLab 16.9. {{< /history >}} In GitLab, users can sign their commits after [adding a GPG key to their profile](../repository/signed_commits/gpg.md). The GitLab integration with [Beyond Identity](https://www.beyondidentity.com/) extends this feature. When configured, this integration uses Beyond Identity to validate any new GPG key that a user adds to their profile. Keys that do not pass validation are rejected, and the user must upload a new key. When a user pushes a signed commit to the GitLab instance, GitLab runs a pre-receive check to validate those commits against the GPG key stored in the user's profile. This ensures that only commits signed with validated keys are accepted. ## Set up the Beyond Identity integration for your instance Prerequisites: - You must have administrator access to the GitLab instance. - The email address used in the GitLab profile must be the same as the email assigned to the key in the Beyond Identity Authenticator. - You must have a Beyond Identity API token. You can request it from their Sales Engineer. To enable the Beyond Identity integration for your instance: 1. Sign in to GitLab as an administrator. 1. On the left sidebar, at the bottom, select **Admin**. 1. Select **Settings > Integrations**. 1. Select **Beyond Identity**. 1. Under **Enable integration**, select the **Active** checkbox. 1. In **API token**, paste the API token you received from Beyond Identity. 1. Select **Save changes**. The Beyond Identity integration for your instance is now enabled. ## GPG key verification When a user adds a GPG key to their profile, the key is verified: - If the key wasn't issued by the Beyond Identity Authenticator, it's accepted. - If the key was issued by the Beyond Identity Authenticator, but the key is invalid, it's rejected. For example: the email used in the user's GitLab profile is different from the email assigned to the key in the Beyond Identity Authenticator. When a user pushes a commit, GitLab checks that the commit was signed by a GPG signature uploaded to the user profile. If the signature cannot be verified, the push is rejected. Web commits are accepted without a signature. ## Skip push check for service accounts {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/454369) in GitLab 16.11. {{< /history >}} Prerequisites: - You must have administrator access to the GitLab instance. To skip the push check for [service accounts](../../profile/service_accounts.md): 1. Sign in to GitLab as an administrator. 1. On the left sidebar, at the bottom, select **Admin**. 1. Select **Settings > Integrations**. 1. Select **Beyond Identity**. 1. Select the **Exclude service accounts** checkbox. 1. Select **Save changes**. ## Exclude groups or projects from the Beyond Identity check {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/454372) in GitLab 17.0 [with a flag](../../../administration/feature_flags/_index.md) named `beyond_identity_exclusions`. Enabled by default. - Option to exclude groups [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/454372) in GitLab 17.1. - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/issues/457893) in GitLab 17.7. Feature flag `beyond_identity_exclusions` removed. {{< /history >}} Prerequisites: - You must have administrator access to the GitLab instance. To exclude groups or projects from the Beyond Identity check: 1. Sign in to GitLab as an administrator. 1. On the left sidebar, at the bottom, select **Admin**. 1. Select **Settings > Integrations**. 1. Select **Beyond Identity**. 1. Select the **Exclusions** tab. 1. Select **Add exclusions**. 1. On the drawer, search and select groups or projects to exclude. 1. Select **Add exclusions**.
--- stage: Create group: Source Code info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments description: Integrate GitLab with Beyond Identity to verify GPG keys added to user accounts. title: Beyond Identity breadcrumbs: - doc - user - project - integrations --- {{< details >}} - Tier: Premium, Ultimate - Offering: GitLab Self-Managed, GitLab Dedicated {{< /details >}} {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/431433) in GitLab 16.9. {{< /history >}} In GitLab, users can sign their commits after [adding a GPG key to their profile](../repository/signed_commits/gpg.md). The GitLab integration with [Beyond Identity](https://www.beyondidentity.com/) extends this feature. When configured, this integration uses Beyond Identity to validate any new GPG key that a user adds to their profile. Keys that do not pass validation are rejected, and the user must upload a new key. When a user pushes a signed commit to the GitLab instance, GitLab runs a pre-receive check to validate those commits against the GPG key stored in the user's profile. This ensures that only commits signed with validated keys are accepted. ## Set up the Beyond Identity integration for your instance Prerequisites: - You must have administrator access to the GitLab instance. - The email address used in the GitLab profile must be the same as the email assigned to the key in the Beyond Identity Authenticator. - You must have a Beyond Identity API token. You can request it from their Sales Engineer. To enable the Beyond Identity integration for your instance: 1. Sign in to GitLab as an administrator. 1. On the left sidebar, at the bottom, select **Admin**. 1. Select **Settings > Integrations**. 1. Select **Beyond Identity**. 1. Under **Enable integration**, select the **Active** checkbox. 1. In **API token**, paste the API token you received from Beyond Identity. 1. Select **Save changes**. The Beyond Identity integration for your instance is now enabled. ## GPG key verification When a user adds a GPG key to their profile, the key is verified: - If the key wasn't issued by the Beyond Identity Authenticator, it's accepted. - If the key was issued by the Beyond Identity Authenticator, but the key is invalid, it's rejected. For example: the email used in the user's GitLab profile is different from the email assigned to the key in the Beyond Identity Authenticator. When a user pushes a commit, GitLab checks that the commit was signed by a GPG signature uploaded to the user profile. If the signature cannot be verified, the push is rejected. Web commits are accepted without a signature. ## Skip push check for service accounts {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/454369) in GitLab 16.11. {{< /history >}} Prerequisites: - You must have administrator access to the GitLab instance. To skip the push check for [service accounts](../../profile/service_accounts.md): 1. Sign in to GitLab as an administrator. 1. On the left sidebar, at the bottom, select **Admin**. 1. Select **Settings > Integrations**. 1. Select **Beyond Identity**. 1. Select the **Exclude service accounts** checkbox. 1. Select **Save changes**. ## Exclude groups or projects from the Beyond Identity check {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/454372) in GitLab 17.0 [with a flag](../../../administration/feature_flags/_index.md) named `beyond_identity_exclusions`. Enabled by default. - Option to exclude groups [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/454372) in GitLab 17.1. - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/issues/457893) in GitLab 17.7. Feature flag `beyond_identity_exclusions` removed. {{< /history >}} Prerequisites: - You must have administrator access to the GitLab instance. To exclude groups or projects from the Beyond Identity check: 1. Sign in to GitLab as an administrator. 1. On the left sidebar, at the bottom, select **Admin**. 1. Select **Settings > Integrations**. 1. Select **Beyond Identity**. 1. Select the **Exclusions** tab. 1. Select **Add exclusions**. 1. On the drawer, search and select groups or projects to exclude. 1. Select **Add exclusions**.
https://docs.gitlab.com/user/project/custom_issue_tracker
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/custom_issue_tracker.md
2025-08-13
doc/user/project/integrations
[ "doc", "user", "project", "integrations" ]
custom_issue_tracker.md
Plan
Project Management
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Custom issue tracker
null
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} You can integrate an [external issue tracker](../../../integration/external-issue-tracker.md) with GitLab. If your preferred issue tracker is not listed in the [integrations list](../../../integration/external-issue-tracker.md#configure-an-external-issue-tracker), you can enable a custom issue tracker. After you enable the custom issue tracker, a link to the issue tracker displays on the left sidebar in your project. ![Custom issue tracker link](img/custom_issue_tracker_v18_3.png) ## Enable a custom issue tracker To enable a custom issue tracker in a project: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Integrations**. 1. Select **Custom issue tracker**. 1. Under **Enable integration**, select the **Active** checkbox. 1. Fill in the required fields: - **Project URL**: The URL to view all the issues in the custom issue tracker. - **Issue URL**: The URL to view an issue in the custom issue tracker. The URL must contain `:id`. GitLab replaces `:id` with the issue number (for example, `https://customissuetracker.com/project-name/:id`, which becomes `https://customissuetracker.com/project-name/123`). - **New issue URL**: <!-- The line below was originally added in January 2018: https://gitlab.com/gitlab-org/gitlab/-/commit/778b231f3a5dd42ebe195d4719a26bf675093350 --> **This URL is not used and an [issue exists](https://gitlab.com/gitlab-org/gitlab/-/issues/327503) to remove it**. Enter any URL. 1. Optional. Select **Test settings**. 1. Select **Save changes**. ## Reference issues in a custom issue tracker You can reference issues in a custom issue tracker using: - `#<ID>`, where `<ID>` is a number (for example, `#143`). - `<PROJECT>-<ID>` (for example `API_32-143`) where: - `<PROJECT>` starts with a capital letter, followed by capital letters, numbers, or underscores. - `<ID>` is a number. The `<PROJECT>` part is ignored in links, which always point to the address specified in **Issue URL**. We suggest using the longer format (`<PROJECT>-<ID>`) if you have both internal and external issue trackers enabled. If you use the shorter format, and an issue with the same ID exists in the internal issue tracker, the internal issue is linked.
--- stage: Plan group: Project Management info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments title: Custom issue tracker breadcrumbs: - doc - user - project - integrations --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} You can integrate an [external issue tracker](../../../integration/external-issue-tracker.md) with GitLab. If your preferred issue tracker is not listed in the [integrations list](../../../integration/external-issue-tracker.md#configure-an-external-issue-tracker), you can enable a custom issue tracker. After you enable the custom issue tracker, a link to the issue tracker displays on the left sidebar in your project. ![Custom issue tracker link](img/custom_issue_tracker_v18_3.png) ## Enable a custom issue tracker To enable a custom issue tracker in a project: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Integrations**. 1. Select **Custom issue tracker**. 1. Under **Enable integration**, select the **Active** checkbox. 1. Fill in the required fields: - **Project URL**: The URL to view all the issues in the custom issue tracker. - **Issue URL**: The URL to view an issue in the custom issue tracker. The URL must contain `:id`. GitLab replaces `:id` with the issue number (for example, `https://customissuetracker.com/project-name/:id`, which becomes `https://customissuetracker.com/project-name/123`). - **New issue URL**: <!-- The line below was originally added in January 2018: https://gitlab.com/gitlab-org/gitlab/-/commit/778b231f3a5dd42ebe195d4719a26bf675093350 --> **This URL is not used and an [issue exists](https://gitlab.com/gitlab-org/gitlab/-/issues/327503) to remove it**. Enter any URL. 1. Optional. Select **Test settings**. 1. Select **Save changes**. ## Reference issues in a custom issue tracker You can reference issues in a custom issue tracker using: - `#<ID>`, where `<ID>` is a number (for example, `#143`). - `<PROJECT>-<ID>` (for example `API_32-143`) where: - `<PROJECT>` starts with a capital letter, followed by capital letters, numbers, or underscores. - `<ID>` is a number. The `<PROJECT>` part is ignored in links, which always point to the address specified in **Issue URL**. We suggest using the longer format (`<PROJECT>-<ID>`) if you have both internal and external issue trackers enabled. If you use the shorter format, and an issue with the same ID exists in the internal issue tracker, the internal issue is linked.
https://docs.gitlab.com/user/project/youtrack
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/youtrack.md
2025-08-13
doc/user/project/integrations
[ "doc", "user", "project", "integrations" ]
youtrack.md
Plan
Project Management
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
YouTrack
null
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} JetBrains [YouTrack](https://www.jetbrains.com/youtrack/) is a web-based issue tracking and project management platform. You can configure YouTrack as an [external issue tracker](../../../integration/external-issue-tracker.md) in GitLab. To enable the YouTrack integration in a project: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Integrations**. 1. Select **YouTrack**. 1. Under **Enable integration**, select the **Active** checkbox. 1. Fill in the required fields: - **Project URL**: The URL to the project in YouTrack. - **Issue URL**: The URL to view an issue in the YouTrack project. The URL must contain `:id`. GitLab replaces `:id` with the issue number. 1. Optional. Select **Test settings**. 1. Select **Save changes**. After you configure and enable YouTrack, a link appears on the GitLab project pages. This link takes you to the appropriate YouTrack project. You can also disable [GitLab internal issue tracking](../issues/_index.md) in this project. For more information about the steps and consequences of disabling GitLab issues, see Configure project [visibility](../../public_access.md#change-project-visibility), [features, and permissions](../settings/_index.md#configure-project-features-and-permissions). ## Reference YouTrack issues in GitLab You can reference issues in YouTrack using `<PROJECT>-<ID>` (for example `YT-101`, `Api_32-143` or `gl-030`) where: - `<PROJECT>` starts with a letter and is followed by letters, numbers, or underscores. - `<ID>` is a number. References to `<PROJECT>-<ID>` in merge requests, commits, or comments are automatically linked to the YouTrack issue URL.
--- stage: Plan group: Project Management info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments title: YouTrack breadcrumbs: - doc - user - project - integrations --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} JetBrains [YouTrack](https://www.jetbrains.com/youtrack/) is a web-based issue tracking and project management platform. You can configure YouTrack as an [external issue tracker](../../../integration/external-issue-tracker.md) in GitLab. To enable the YouTrack integration in a project: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Integrations**. 1. Select **YouTrack**. 1. Under **Enable integration**, select the **Active** checkbox. 1. Fill in the required fields: - **Project URL**: The URL to the project in YouTrack. - **Issue URL**: The URL to view an issue in the YouTrack project. The URL must contain `:id`. GitLab replaces `:id` with the issue number. 1. Optional. Select **Test settings**. 1. Select **Save changes**. After you configure and enable YouTrack, a link appears on the GitLab project pages. This link takes you to the appropriate YouTrack project. You can also disable [GitLab internal issue tracking](../issues/_index.md) in this project. For more information about the steps and consequences of disabling GitLab issues, see Configure project [visibility](../../public_access.md#change-project-visibility), [features, and permissions](../settings/_index.md#configure-project-features-and-permissions). ## Reference YouTrack issues in GitLab You can reference issues in YouTrack using `<PROJECT>-<ID>` (for example `YT-101`, `Api_32-143` or `gl-030`) where: - `<PROJECT>` starts with a letter and is followed by letters, numbers, or underscores. - `<ID>` is a number. References to `<PROJECT>-<ID>` in merge requests, commits, or comments are automatically linked to the YouTrack issue URL.
https://docs.gitlab.com/user/project/clickup
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/clickup.md
2025-08-13
doc/user/project/integrations
[ "doc", "user", "project", "integrations" ]
clickup.md
Plan
Project Management
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
ClickUp
null
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/120732) in GitLab 16.1. {{< /history >}} You can use [ClickUp](https://clickup.com/) as an external issue tracker. To enable the ClickUp integration in a project: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Integrations**. 1. Select **ClickUp**. 1. Under **Enable integration**, select the **Active** checkbox. 1. Fill in the required fields: - **Project URL**: The URL to the ClickUp project to link to this GitLab project. - **Issue URL**: The URL to the ClickUp project issue to link to this GitLab project. The URL must contain `:id`. GitLab replaces this ID with the issue number. 1. Optional. Select **Test settings**. 1. Select **Save changes**. After you have configured and enabled ClickUp, you see the ClickUp link on the GitLab project pages, which takes you to your ClickUp project. For example, this is a configuration for a project named `gitlab-ci`: - Project URL: `https://app.clickup.com/1234567` - Issue URL: `https://app.clickup.com/t/1234567/:id` You can also disable [GitLab internal issue tracking](../issues/_index.md) in this project. For more information about the steps and consequences of disabling GitLab issues, see Configure project [visibility](../../public_access.md#change-project-visibility), [features, and permissions](../settings/_index.md#configure-project-features-and-permissions). ## Reference ClickUp issues in GitLab You can reference your ClickUp issues using: - `#<ID>`, where `<ID>` is a alphanumerical string (example `#8wrtcd932`). - `CU-<ID>`, where `<ID>` is a alphanumerical string (example `CU-8wrtcd932`). - `<PROJECT>-<ID>`, for example `API_32-143`, where: - `<PROJECT>` is a ClickUp list custom prefix ID. - `<ID>` is a number. - If you use [Custom Task IDs](https://help.clickup.com/hc/en-us/sections/17044579323671-Custom-Task-IDs), the full custom task ID also works. For example `SOP-1234`. In links, the `CU-` part is ignored and it links to the global URL of the issue. When a custom prefix is used in a ClickUp list, the prefix part is part of the link. We suggest using the `CU-` format (`CU-<ID>`) if you have both internal and external issue trackers enabled. If you use the shorter format, and an issue with the same ID exists in the internal issue tracker, the internal issue is linked. For [Custom Task IDs](https://help.clickup.com/hc/en-us/sections/17044579323671-Custom-Task-IDs), you **must** include the full ID, including your custom prefix. For example, `SOP-1432`.
--- stage: Plan group: Project Management info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments title: ClickUp breadcrumbs: - doc - user - project - integrations --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/120732) in GitLab 16.1. {{< /history >}} You can use [ClickUp](https://clickup.com/) as an external issue tracker. To enable the ClickUp integration in a project: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Integrations**. 1. Select **ClickUp**. 1. Under **Enable integration**, select the **Active** checkbox. 1. Fill in the required fields: - **Project URL**: The URL to the ClickUp project to link to this GitLab project. - **Issue URL**: The URL to the ClickUp project issue to link to this GitLab project. The URL must contain `:id`. GitLab replaces this ID with the issue number. 1. Optional. Select **Test settings**. 1. Select **Save changes**. After you have configured and enabled ClickUp, you see the ClickUp link on the GitLab project pages, which takes you to your ClickUp project. For example, this is a configuration for a project named `gitlab-ci`: - Project URL: `https://app.clickup.com/1234567` - Issue URL: `https://app.clickup.com/t/1234567/:id` You can also disable [GitLab internal issue tracking](../issues/_index.md) in this project. For more information about the steps and consequences of disabling GitLab issues, see Configure project [visibility](../../public_access.md#change-project-visibility), [features, and permissions](../settings/_index.md#configure-project-features-and-permissions). ## Reference ClickUp issues in GitLab You can reference your ClickUp issues using: - `#<ID>`, where `<ID>` is a alphanumerical string (example `#8wrtcd932`). - `CU-<ID>`, where `<ID>` is a alphanumerical string (example `CU-8wrtcd932`). - `<PROJECT>-<ID>`, for example `API_32-143`, where: - `<PROJECT>` is a ClickUp list custom prefix ID. - `<ID>` is a number. - If you use [Custom Task IDs](https://help.clickup.com/hc/en-us/sections/17044579323671-Custom-Task-IDs), the full custom task ID also works. For example `SOP-1234`. In links, the `CU-` part is ignored and it links to the global URL of the issue. When a custom prefix is used in a ClickUp list, the prefix part is part of the link. We suggest using the `CU-` format (`CU-<ID>`) if you have both internal and external issue trackers enabled. If you use the shorter format, and an issue with the same ID exists in the internal issue tracker, the internal issue is linked. For [Custom Task IDs](https://help.clickup.com/hc/en-us/sections/17044579323671-Custom-Task-IDs), you **must** include the full ID, including your custom prefix. For example, `SOP-1432`.
https://docs.gitlab.com/user/project/hangouts_chat
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/hangouts_chat.md
2025-08-13
doc/user/project/integrations
[ "doc", "user", "project", "integrations" ]
hangouts_chat.md
Plan
Project Management
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Google Chat
Configure the Google Chat integration to receive notifications from GitLab in a Google Chat space.
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} You can configure your project in GitLab to send notifications to a space of your choice in [Google Chat](https://chat.google.com/). In GitLab 16.10 and later, threaded notifications are enabled by default in Google Chat for the same GitLab object (for example, an issue or merge request). For more information, see [issue 438452](https://gitlab.com/gitlab-org/gitlab/-/issues/438452). ## Configure the integration ### In Google Chat To configure the integration in Google Chat: 1. Go to the space where you want to receive notifications from GitLab. 1. In the upper left, next to the space name, select the down arrow ({{< icon name="chevron-down" >}}) > **Apps & integrations**. 1. In the **Webhooks** section, select **Add webhooks**. 1. On the **Incoming webhooks** dialog: - In **Name**, enter a name for your webhook (for example, `GitLab integration`). - Optional. In **Avatar URL**, enter an avatar for your bot. 1. Select **Save**. 1. Next to the webhook URL, select the vertical ellipsis ({{< icon name="ellipsis_v" >}}) > **Copy link**. For more information about webhooks, see the [Google Chat documentation](https://developers.google.com/workspace/chat/quickstart/webhooks). ### In GitLab To configure the integration in GitLab: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings** > **Integrations**. 1. Select **Google Chat**. 1. Under **Enable integration**, select the **Active** checkbox. 1. In **Webhook**, [paste the URL you copied from Google Chat](#in-google-chat). 1. In the **Trigger** section, select the checkbox for each GitLab event you want to receive notifications for in your Google Chat space. 1. Optional. In the **Notification settings** section: - Select the **Notify only broken pipelines** checkbox to receive notifications for failed pipelines only. - From the **Branches for which notifications are to be sent** dropdown list, select the branches you want to receive notifications for. 1. Optional. Select **Test settings**. 1. Select **Save changes**.
--- stage: Plan group: Project Management info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments title: Google Chat description: Configure the Google Chat integration to receive notifications from GitLab in a Google Chat space. breadcrumbs: - doc - user - project - integrations --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} You can configure your project in GitLab to send notifications to a space of your choice in [Google Chat](https://chat.google.com/). In GitLab 16.10 and later, threaded notifications are enabled by default in Google Chat for the same GitLab object (for example, an issue or merge request). For more information, see [issue 438452](https://gitlab.com/gitlab-org/gitlab/-/issues/438452). ## Configure the integration ### In Google Chat To configure the integration in Google Chat: 1. Go to the space where you want to receive notifications from GitLab. 1. In the upper left, next to the space name, select the down arrow ({{< icon name="chevron-down" >}}) > **Apps & integrations**. 1. In the **Webhooks** section, select **Add webhooks**. 1. On the **Incoming webhooks** dialog: - In **Name**, enter a name for your webhook (for example, `GitLab integration`). - Optional. In **Avatar URL**, enter an avatar for your bot. 1. Select **Save**. 1. Next to the webhook URL, select the vertical ellipsis ({{< icon name="ellipsis_v" >}}) > **Copy link**. For more information about webhooks, see the [Google Chat documentation](https://developers.google.com/workspace/chat/quickstart/webhooks). ### In GitLab To configure the integration in GitLab: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings** > **Integrations**. 1. Select **Google Chat**. 1. Under **Enable integration**, select the **Active** checkbox. 1. In **Webhook**, [paste the URL you copied from Google Chat](#in-google-chat). 1. In the **Trigger** section, select the checkbox for each GitLab event you want to receive notifications for in your Google Chat space. 1. Optional. In the **Notification settings** section: - Select the **Notify only broken pipelines** checkbox to receive notifications for failed pipelines only. - From the **Branches for which notifications are to be sent** dropdown list, select the branches you want to receive notifications for. 1. Optional. Select **Test settings**. 1. Select **Save changes**.
https://docs.gitlab.com/user/project/integrations
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/_index.md
2025-08-13
doc/user/project/integrations
[ "doc", "user", "project", "integrations" ]
_index.md
none
unassigned
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Project integrations
User documentation for project and group integrations. Includes a list of available integrations.
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} {{< alert type="note" >}} This page contains user documentation for project integrations. For administrator documentation, see [Project integration administration](../../../administration/settings/project_integration_management.md). {{< /alert >}} You can integrate with external applications to add functionality to GitLab. You can view and manage integrations for the: - [Instance](../../../administration/settings/project_integration_management.md#configure-default-settings-for-an-integration) (GitLab Self-Managed) - [Group](#manage-group-default-settings-for-a-project-integration) You can use: - [Instance or group default settings for a project integration](#use-instance-or-group-default-settings-for-a-project-integration) - [Custom settings for a project or group integration](#use-custom-settings-for-a-project-or-group-integration) ## Manage group default settings for a project integration Prerequisites: - You must have the Owner role for the group. To manage the group default settings for a project integration: 1. On the left sidebar, select **Search or go to** and find your group. 1. Select **Settings > Integrations**. 1. Select an integration. 1. Complete the fields. 1. Select **Save changes**. {{< alert type="warning" >}} This may affect all or most of the subgroups and projects belonging to the group. Review the details below. {{< /alert >}} If this is the first time you are setting up group settings for an integration: - The integration is enabled for all subgroups and projects belonging to the group that don't already have this integration configured, if you have the **Enable integration** toggle turned on in the group settings. - Subgroups and projects that already have the integration configured are not affected, but can choose to use the inherited settings at any time. When you make further changes to the group defaults: - They are immediately applied to all subgroups and projects belonging to the group that have the integration set to use default settings. - They are immediately applied to newer subgroups and projects, even those created after you last saved defaults for the integration. If your group default setting has the **Enable integration** toggle turned on, the integration is automatically enabled for all such subgroups and projects. - Subgroups and projects with custom settings selected for the integration are not immediately affected and may choose to use the latest defaults at any time. If [instance settings](../../../administration/settings/project_integration_management.md#configure-default-settings-for-an-integration) have also been configured for the same integration, projects in the group inherit settings from the group. Only the entire settings for an integration can be inherited. Per-field inheritance is proposed in [epic 2137](https://gitlab.com/groups/gitlab-org/-/epics/2137). ### Remove a group default setting Prerequisites: - You must have the Owner role for the group. To remove a group default setting: 1. On the left sidebar, select **Search or go to** and find your group. 1. Select **Settings > Integrations**. 1. Select an integration. 1. Select **Reset** and confirm. Resetting a group default setting removes integrations that use default settings and belong to a project or subgroup of the group. ## Use instance or group default settings for a project integration Prerequisites: - You must have at least the Maintainer role for the project. To use instance or group default settings for a project integration: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Integrations**. 1. Select an integration. 1. On the right, from the dropdown list, select **Use default settings**. 1. Under **Enable integration**, ensure the **Active** checkbox is selected. 1. Complete the fields. 1. Select **Save changes**. ## Use custom settings for a project or group integration Prerequisites: - You must have at least the Maintainer role for the project integration. - You must have the Owner role for the group integration. To use custom settings for a project or group integration: 1. On the left sidebar, select **Search or go to** and find your project or group. 1. Select **Settings > Integrations**. 1. Select an integration. 1. On the right, from the dropdown list, select **Use custom settings**. 1. Under **Enable integration**, ensure the **Active** checkbox is selected. 1. Complete the fields. 1. Select **Save changes**. ## Available integrations The following integrations can be available on a GitLab instance. If an instance administrator has configured an [integration allowlist](../../../administration/settings/project_integration_management.md#integration-allowlist), only those integrations are available. ### CI/CD | Integration | Description | Integration hooks | | ------------------------------------------------------------ | ---------------------------------------------------------------------------------------- | ----------------- | | [Atlassian Bamboo](bamboo.md) | Run CI/CD pipelines with Atlassian Bamboo. | {{< icon name="check-circle" >}} Yes | | Buildkite | Run CI/CD pipelines with Buildkite. | {{< icon name="check-circle" >}} Yes | | Drone | Run CI/CD pipelines with Drone. | {{< icon name="check-circle" >}} Yes | | [Jenkins](../../../integration/jenkins.md) | Run CI/CD pipelines with Jenkins. | {{< icon name="check-circle" >}} Yes | | JetBrains TeamCity | Run CI/CD pipelines with TeamCity. | {{< icon name="check-circle" >}} Yes | ### Event notifications | Integration | Description | Integration hooks | | ------------------------------------------------------------ | ---------------------------------------------------------------------------------------- | ----------------- | | Campfire | Connect Campfire to chat. | {{< icon name="dotted-circle" >}} No | | [Discord Notifications](discord_notifications.md) | Send notifications about project events to a Discord channel. | {{< icon name="dotted-circle" >}} No | | [Google Chat](hangouts_chat.md) | Send notifications from your GitLab project to a space in Google Chat. | {{< icon name="dotted-circle" >}} No | | [irker (IRC gateway)](irker.md) | Send event notifications to IRC channels. | {{< icon name="dotted-circle" >}} No | | [Matrix notifications](matrix.md) | Send notifications about project events to Matrix. | {{< icon name="dotted-circle" >}} No | | [Mattermost notifications](mattermost.md) | Send notifications about project events to Mattermost channels. | {{< icon name="dotted-circle" >}} No | | [Microsoft Teams notifications](microsoft_teams.md) | Send event notifications to Microsoft Teams. | {{< icon name="dotted-circle" >}} No | | [Pumble](pumble.md) | Send event notifications to a Pumble channel. | {{< icon name="dotted-circle" >}} No | | Pushover | Send event notifications to your device. | {{< icon name="dotted-circle" >}} No | | [Telegram](telegram.md) | Send notifications about project events to Telegram. | {{< icon name="dotted-circle" >}} No | | [Unify Circuit](unify_circuit.md) | Send notifications about project events to Unify Circuit. | {{< icon name="dotted-circle" >}} No | | [Webex Teams](webex_teams.md) | Send event notifications to Webex Teams. | {{< icon name="dotted-circle" >}} No | ### Stores | Integration | Description | Integration hooks | | ------------------------------------------------------------ | ---------------------------------------------------------------------------------------- | ----------------- | | [Apple App Store Connect](apple_app_store.md) | Use GitLab to build and release an app in the Apple App Store. | {{< icon name="dotted-circle" >}} No | | [Google Play](google_play.md) | Use GitLab to build and release an app in Google Play. | {{< icon name="dotted-circle" >}} No | | [Harbor](harbor.md) | Use Harbor as the container registry for GitLab. | {{< icon name="dotted-circle" >}} No | | Packagist | Update your PHP dependencies in Packagist. | {{< icon name="check-circle" >}} Yes | ### External issue trackers The following integrations add links to [external issue trackers](../../../integration/external-issue-tracker.md) on the left sidebar in your project. | Integration | Description | Integration hooks | Issue sync | Can create new issues | | ------------------------------------------------------------ | ---------------------------------------------------------------------------------------- | ----------------- |----------------- |----------------- | | [Bugzilla](bugzilla.md) | Use Bugzilla as an issue tracker. | {{< icon name="dotted-circle" >}} No | {{< icon name="dotted-circle" >}} No | {{< icon name="check-circle" >}} Yes | | [ClickUp](clickup.md) | Use ClickUp as an issue tracker. | {{< icon name="dotted-circle" >}} No | {{< icon name="dotted-circle" >}} No | {{< icon name="dotted-circle" >}} No | | [Custom issue tracker](custom_issue_tracker.md) | Use a custom issue tracker. | {{< icon name="dotted-circle" >}} No | {{< icon name="dotted-circle" >}} No | {{< icon name="dotted-circle" >}} No | | [Engineering Workflow Management (EWM)](ewm.md) | Use EWM as an issue tracker. | {{< icon name="dotted-circle" >}} No | {{< icon name="dotted-circle" >}} No | {{< icon name="check-circle" >}} Yes | | [Linear](linear.md) | Use Linear as an issue tracker. | {{< icon name="dotted-circle" >}} No | {{< icon name="dotted-circle" >}} No | {{< icon name="dotted-circle" >}} No | | [Phorge](phorge.md) | Use Phorge as an issue tracker. | {{< icon name="dotted-circle" >}} No | {{< icon name="dotted-circle" >}} No | {{< icon name="check-circle" >}} Yes | | [Redmine](redmine.md) | Use Redmine as an issue tracker. | {{< icon name="dotted-circle" >}} No | {{< icon name="dotted-circle" >}} No | {{< icon name="check-circle" >}} Yes | | [YouTrack](youtrack.md) | Use JetBrains YouTrack as your project's issue tracker. | {{< icon name="dotted-circle" >}} No | {{< icon name="check-circle" >}} Yes | {{< icon name="dotted-circle" >}} No | ### External wikis The following integrations add links to external wikis on the left sidebar in your project. | Integration | Description | Integration hooks | | ------------------------------------------------------------ | ---------------------------------------------------------------------------------------- | ----------------- | | [Confluence Workspace](confluence.md) | Use Confluence Cloud Workspace as an internal wiki. | {{< icon name="dotted-circle" >}} No | | [External wiki](../wiki/_index.md#link-an-external-wiki) | Link an external wiki. | {{< icon name="dotted-circle" >}} No | ### Other | Integration | Description | Integration hooks | | ------------------------------------------------------------ | ---------------------------------------------------------------------------------------- | ----------------- | | [Asana](asana.md) | Add commit messages as comments to Asana tasks. | {{< icon name="dotted-circle" >}} No | | Assembla | Manage projects with Assembla. | {{< icon name="dotted-circle" >}} No | | [Beyond Identity](beyond_identity.md) | Verify that GPG keys are authorized by Beyond Identity Authenticator. | {{< icon name="dotted-circle" >}} No | | [Datadog](../../../integration/datadog.md) | Trace your GitLab pipelines with Datadog. | {{< icon name="check-circle" >}} Yes | | [Diffblue Cover](../../../integration/diffblue_cover.md) | Automatically write comprehensive, human-like Java unit tests. | {{< icon name="check-circle" >}} No | | [Emails on push](emails_on_push.md) | Send commits and diffs on push by email. | {{< icon name="dotted-circle" >}} No | | [GitGuardian](git_guardian.md) | Reject commits based on GitGuardian policies. | {{< icon name="dotted-circle" >}} No | | [GitHub](github.md) | Receive statuses for commits and pull requests. | {{< icon name="dotted-circle" >}} No | | [GitLab for Slack app](gitlab_slack_application.md) | Use the native Slack app to receive notifications and run commands. | {{< icon name="dotted-circle" >}} No | | [Google Artifact Management](google_artifact_management.md) | Manage your artifacts in Google Artifact Registry. | {{< icon name="dotted-circle" >}} No | | [Google Cloud IAM](../../../integration/google_cloud_iam.md) | Manage permissions for Google Cloud resources with Identity and Access Management (IAM). | {{< icon name="dotted-circle" >}} No | | [Jira](../../../integration/jira/_index.md) | Use Jira as an issue tracker. | {{< icon name="dotted-circle" >}} No | | [Mattermost slash commands](mattermost_slash_commands.md) | Run slash commands from a Mattermost chat environment. | {{< icon name="dotted-circle" >}} No | | [Pipeline status emails](pipeline_status_emails.md) | Send the pipeline status to a list of recipients by email. | {{< icon name="dotted-circle" >}} No | | [Pivotal Tracker](pivotal_tracker.md) | Add commit messages as comments to Pivotal Tracker stories. | {{< icon name="dotted-circle" >}} No | | [Slack slash commands](slack_slash_commands.md) | Run slash commands from a Slack chat environment. | {{< icon name="dotted-circle" >}} No | | [Squash TM](squash_tm.md) | Update Squash TM requirements when GitLab issues are modified. | {{< icon name="check-circle" >}} Yes | ## Project webhooks Some integrations use [webhooks](webhooks.md) for external applications. You can configure a project webhook to listen for specific events like pushes, issues, or merge requests. When the webhook is triggered, GitLab sends a POST request with data to a specified webhook URL. For a list of integrations that use webhooks, see [Available integrations](#available-integrations). ## Push hook limit If a single push includes changes to more than three branches or tags, integrations supported by `push_hooks` and `tag_push_hooks` events are not executed. To change the number of supported branches or tags, configure the [`push_event_hooks_limit` setting](../../../api/settings.md#available-settings). ## SSL verification By default, the SSL certificate for outgoing HTTP requests is verified based on an internal list of certificate authorities. The SSL certificate cannot be self-signed. You can disable SSL verification when you configure [webhooks](webhooks.md#configure-webhooks) and some integrations. ## Related topics - [Integrations API](../../../api/project_integrations.md) - [GitLab Developer Portal](https://developer.gitlab.com)
--- stage: none group: unassigned info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments title: Project integrations description: User documentation for project and group integrations. Includes a list of available integrations. breadcrumbs: - doc - user - project - integrations --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} {{< alert type="note" >}} This page contains user documentation for project integrations. For administrator documentation, see [Project integration administration](../../../administration/settings/project_integration_management.md). {{< /alert >}} You can integrate with external applications to add functionality to GitLab. You can view and manage integrations for the: - [Instance](../../../administration/settings/project_integration_management.md#configure-default-settings-for-an-integration) (GitLab Self-Managed) - [Group](#manage-group-default-settings-for-a-project-integration) You can use: - [Instance or group default settings for a project integration](#use-instance-or-group-default-settings-for-a-project-integration) - [Custom settings for a project or group integration](#use-custom-settings-for-a-project-or-group-integration) ## Manage group default settings for a project integration Prerequisites: - You must have the Owner role for the group. To manage the group default settings for a project integration: 1. On the left sidebar, select **Search or go to** and find your group. 1. Select **Settings > Integrations**. 1. Select an integration. 1. Complete the fields. 1. Select **Save changes**. {{< alert type="warning" >}} This may affect all or most of the subgroups and projects belonging to the group. Review the details below. {{< /alert >}} If this is the first time you are setting up group settings for an integration: - The integration is enabled for all subgroups and projects belonging to the group that don't already have this integration configured, if you have the **Enable integration** toggle turned on in the group settings. - Subgroups and projects that already have the integration configured are not affected, but can choose to use the inherited settings at any time. When you make further changes to the group defaults: - They are immediately applied to all subgroups and projects belonging to the group that have the integration set to use default settings. - They are immediately applied to newer subgroups and projects, even those created after you last saved defaults for the integration. If your group default setting has the **Enable integration** toggle turned on, the integration is automatically enabled for all such subgroups and projects. - Subgroups and projects with custom settings selected for the integration are not immediately affected and may choose to use the latest defaults at any time. If [instance settings](../../../administration/settings/project_integration_management.md#configure-default-settings-for-an-integration) have also been configured for the same integration, projects in the group inherit settings from the group. Only the entire settings for an integration can be inherited. Per-field inheritance is proposed in [epic 2137](https://gitlab.com/groups/gitlab-org/-/epics/2137). ### Remove a group default setting Prerequisites: - You must have the Owner role for the group. To remove a group default setting: 1. On the left sidebar, select **Search or go to** and find your group. 1. Select **Settings > Integrations**. 1. Select an integration. 1. Select **Reset** and confirm. Resetting a group default setting removes integrations that use default settings and belong to a project or subgroup of the group. ## Use instance or group default settings for a project integration Prerequisites: - You must have at least the Maintainer role for the project. To use instance or group default settings for a project integration: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Integrations**. 1. Select an integration. 1. On the right, from the dropdown list, select **Use default settings**. 1. Under **Enable integration**, ensure the **Active** checkbox is selected. 1. Complete the fields. 1. Select **Save changes**. ## Use custom settings for a project or group integration Prerequisites: - You must have at least the Maintainer role for the project integration. - You must have the Owner role for the group integration. To use custom settings for a project or group integration: 1. On the left sidebar, select **Search or go to** and find your project or group. 1. Select **Settings > Integrations**. 1. Select an integration. 1. On the right, from the dropdown list, select **Use custom settings**. 1. Under **Enable integration**, ensure the **Active** checkbox is selected. 1. Complete the fields. 1. Select **Save changes**. ## Available integrations The following integrations can be available on a GitLab instance. If an instance administrator has configured an [integration allowlist](../../../administration/settings/project_integration_management.md#integration-allowlist), only those integrations are available. ### CI/CD | Integration | Description | Integration hooks | | ------------------------------------------------------------ | ---------------------------------------------------------------------------------------- | ----------------- | | [Atlassian Bamboo](bamboo.md) | Run CI/CD pipelines with Atlassian Bamboo. | {{< icon name="check-circle" >}} Yes | | Buildkite | Run CI/CD pipelines with Buildkite. | {{< icon name="check-circle" >}} Yes | | Drone | Run CI/CD pipelines with Drone. | {{< icon name="check-circle" >}} Yes | | [Jenkins](../../../integration/jenkins.md) | Run CI/CD pipelines with Jenkins. | {{< icon name="check-circle" >}} Yes | | JetBrains TeamCity | Run CI/CD pipelines with TeamCity. | {{< icon name="check-circle" >}} Yes | ### Event notifications | Integration | Description | Integration hooks | | ------------------------------------------------------------ | ---------------------------------------------------------------------------------------- | ----------------- | | Campfire | Connect Campfire to chat. | {{< icon name="dotted-circle" >}} No | | [Discord Notifications](discord_notifications.md) | Send notifications about project events to a Discord channel. | {{< icon name="dotted-circle" >}} No | | [Google Chat](hangouts_chat.md) | Send notifications from your GitLab project to a space in Google Chat. | {{< icon name="dotted-circle" >}} No | | [irker (IRC gateway)](irker.md) | Send event notifications to IRC channels. | {{< icon name="dotted-circle" >}} No | | [Matrix notifications](matrix.md) | Send notifications about project events to Matrix. | {{< icon name="dotted-circle" >}} No | | [Mattermost notifications](mattermost.md) | Send notifications about project events to Mattermost channels. | {{< icon name="dotted-circle" >}} No | | [Microsoft Teams notifications](microsoft_teams.md) | Send event notifications to Microsoft Teams. | {{< icon name="dotted-circle" >}} No | | [Pumble](pumble.md) | Send event notifications to a Pumble channel. | {{< icon name="dotted-circle" >}} No | | Pushover | Send event notifications to your device. | {{< icon name="dotted-circle" >}} No | | [Telegram](telegram.md) | Send notifications about project events to Telegram. | {{< icon name="dotted-circle" >}} No | | [Unify Circuit](unify_circuit.md) | Send notifications about project events to Unify Circuit. | {{< icon name="dotted-circle" >}} No | | [Webex Teams](webex_teams.md) | Send event notifications to Webex Teams. | {{< icon name="dotted-circle" >}} No | ### Stores | Integration | Description | Integration hooks | | ------------------------------------------------------------ | ---------------------------------------------------------------------------------------- | ----------------- | | [Apple App Store Connect](apple_app_store.md) | Use GitLab to build and release an app in the Apple App Store. | {{< icon name="dotted-circle" >}} No | | [Google Play](google_play.md) | Use GitLab to build and release an app in Google Play. | {{< icon name="dotted-circle" >}} No | | [Harbor](harbor.md) | Use Harbor as the container registry for GitLab. | {{< icon name="dotted-circle" >}} No | | Packagist | Update your PHP dependencies in Packagist. | {{< icon name="check-circle" >}} Yes | ### External issue trackers The following integrations add links to [external issue trackers](../../../integration/external-issue-tracker.md) on the left sidebar in your project. | Integration | Description | Integration hooks | Issue sync | Can create new issues | | ------------------------------------------------------------ | ---------------------------------------------------------------------------------------- | ----------------- |----------------- |----------------- | | [Bugzilla](bugzilla.md) | Use Bugzilla as an issue tracker. | {{< icon name="dotted-circle" >}} No | {{< icon name="dotted-circle" >}} No | {{< icon name="check-circle" >}} Yes | | [ClickUp](clickup.md) | Use ClickUp as an issue tracker. | {{< icon name="dotted-circle" >}} No | {{< icon name="dotted-circle" >}} No | {{< icon name="dotted-circle" >}} No | | [Custom issue tracker](custom_issue_tracker.md) | Use a custom issue tracker. | {{< icon name="dotted-circle" >}} No | {{< icon name="dotted-circle" >}} No | {{< icon name="dotted-circle" >}} No | | [Engineering Workflow Management (EWM)](ewm.md) | Use EWM as an issue tracker. | {{< icon name="dotted-circle" >}} No | {{< icon name="dotted-circle" >}} No | {{< icon name="check-circle" >}} Yes | | [Linear](linear.md) | Use Linear as an issue tracker. | {{< icon name="dotted-circle" >}} No | {{< icon name="dotted-circle" >}} No | {{< icon name="dotted-circle" >}} No | | [Phorge](phorge.md) | Use Phorge as an issue tracker. | {{< icon name="dotted-circle" >}} No | {{< icon name="dotted-circle" >}} No | {{< icon name="check-circle" >}} Yes | | [Redmine](redmine.md) | Use Redmine as an issue tracker. | {{< icon name="dotted-circle" >}} No | {{< icon name="dotted-circle" >}} No | {{< icon name="check-circle" >}} Yes | | [YouTrack](youtrack.md) | Use JetBrains YouTrack as your project's issue tracker. | {{< icon name="dotted-circle" >}} No | {{< icon name="check-circle" >}} Yes | {{< icon name="dotted-circle" >}} No | ### External wikis The following integrations add links to external wikis on the left sidebar in your project. | Integration | Description | Integration hooks | | ------------------------------------------------------------ | ---------------------------------------------------------------------------------------- | ----------------- | | [Confluence Workspace](confluence.md) | Use Confluence Cloud Workspace as an internal wiki. | {{< icon name="dotted-circle" >}} No | | [External wiki](../wiki/_index.md#link-an-external-wiki) | Link an external wiki. | {{< icon name="dotted-circle" >}} No | ### Other | Integration | Description | Integration hooks | | ------------------------------------------------------------ | ---------------------------------------------------------------------------------------- | ----------------- | | [Asana](asana.md) | Add commit messages as comments to Asana tasks. | {{< icon name="dotted-circle" >}} No | | Assembla | Manage projects with Assembla. | {{< icon name="dotted-circle" >}} No | | [Beyond Identity](beyond_identity.md) | Verify that GPG keys are authorized by Beyond Identity Authenticator. | {{< icon name="dotted-circle" >}} No | | [Datadog](../../../integration/datadog.md) | Trace your GitLab pipelines with Datadog. | {{< icon name="check-circle" >}} Yes | | [Diffblue Cover](../../../integration/diffblue_cover.md) | Automatically write comprehensive, human-like Java unit tests. | {{< icon name="check-circle" >}} No | | [Emails on push](emails_on_push.md) | Send commits and diffs on push by email. | {{< icon name="dotted-circle" >}} No | | [GitGuardian](git_guardian.md) | Reject commits based on GitGuardian policies. | {{< icon name="dotted-circle" >}} No | | [GitHub](github.md) | Receive statuses for commits and pull requests. | {{< icon name="dotted-circle" >}} No | | [GitLab for Slack app](gitlab_slack_application.md) | Use the native Slack app to receive notifications and run commands. | {{< icon name="dotted-circle" >}} No | | [Google Artifact Management](google_artifact_management.md) | Manage your artifacts in Google Artifact Registry. | {{< icon name="dotted-circle" >}} No | | [Google Cloud IAM](../../../integration/google_cloud_iam.md) | Manage permissions for Google Cloud resources with Identity and Access Management (IAM). | {{< icon name="dotted-circle" >}} No | | [Jira](../../../integration/jira/_index.md) | Use Jira as an issue tracker. | {{< icon name="dotted-circle" >}} No | | [Mattermost slash commands](mattermost_slash_commands.md) | Run slash commands from a Mattermost chat environment. | {{< icon name="dotted-circle" >}} No | | [Pipeline status emails](pipeline_status_emails.md) | Send the pipeline status to a list of recipients by email. | {{< icon name="dotted-circle" >}} No | | [Pivotal Tracker](pivotal_tracker.md) | Add commit messages as comments to Pivotal Tracker stories. | {{< icon name="dotted-circle" >}} No | | [Slack slash commands](slack_slash_commands.md) | Run slash commands from a Slack chat environment. | {{< icon name="dotted-circle" >}} No | | [Squash TM](squash_tm.md) | Update Squash TM requirements when GitLab issues are modified. | {{< icon name="check-circle" >}} Yes | ## Project webhooks Some integrations use [webhooks](webhooks.md) for external applications. You can configure a project webhook to listen for specific events like pushes, issues, or merge requests. When the webhook is triggered, GitLab sends a POST request with data to a specified webhook URL. For a list of integrations that use webhooks, see [Available integrations](#available-integrations). ## Push hook limit If a single push includes changes to more than three branches or tags, integrations supported by `push_hooks` and `tag_push_hooks` events are not executed. To change the number of supported branches or tags, configure the [`push_event_hooks_limit` setting](../../../api/settings.md#available-settings). ## SSL verification By default, the SSL certificate for outgoing HTTP requests is verified based on an internal list of certificate authorities. The SSL certificate cannot be self-signed. You can disable SSL verification when you configure [webhooks](webhooks.md#configure-webhooks) and some integrations. ## Related topics - [Integrations API](../../../api/project_integrations.md) - [GitLab Developer Portal](https://developer.gitlab.com)
https://docs.gitlab.com/user/project/matrix
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/matrix.md
2025-08-13
doc/user/project/integrations
[ "doc", "user", "project", "integrations" ]
matrix.md
Growth
Engagement
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Matrix
null
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/) in GitLab 17.3. {{< /history >}} You can configure GitLab to send notifications to a Matrix room. ## Set up the Matrix integration in GitLab After you join to a Matrix room, you can configure GitLab to send notifications: 1. To enable the integration: - **For your group or project**: 1. On the left sidebar, select **Search or go to** and find your project or group. 1. Select **Settings** > **Integrations**. - **For your instance**: 1. On the left sidebar, at the bottom, select **Admin area**. 1. Select **Settings** > **Integrations**. 1. Select **Matrix**. 1. Under **Enable integration**, select the **Active** checkbox. 1. Optional. In **Hostname**, enter the hostname of your server. 1. In **Token**, paste the token value from the Matrix's user. 1. In the **Trigger** section, select the checkboxes for the GitLab events you want to receive in Matrix. 1. In the **Notification settings** section: - In **Room identifier**, paste the Matrix room identifier. - Optional. Select the **Notify only broken pipelines** checkbox to receive notifications for failed pipelines only. - Optional. From the **Branches for which notifications are to be sent** dropdown list, select the branches you want to receive notifications for. 1. Optional. Select **Test settings**. 1. Select **Save changes**. The Matrix room can now receive all selected GitLab events.
--- stage: Growth group: Engagement info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments title: Matrix breadcrumbs: - doc - user - project - integrations --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/) in GitLab 17.3. {{< /history >}} You can configure GitLab to send notifications to a Matrix room. ## Set up the Matrix integration in GitLab After you join to a Matrix room, you can configure GitLab to send notifications: 1. To enable the integration: - **For your group or project**: 1. On the left sidebar, select **Search or go to** and find your project or group. 1. Select **Settings** > **Integrations**. - **For your instance**: 1. On the left sidebar, at the bottom, select **Admin area**. 1. Select **Settings** > **Integrations**. 1. Select **Matrix**. 1. Under **Enable integration**, select the **Active** checkbox. 1. Optional. In **Hostname**, enter the hostname of your server. 1. In **Token**, paste the token value from the Matrix's user. 1. In the **Trigger** section, select the checkboxes for the GitLab events you want to receive in Matrix. 1. In the **Notification settings** section: - In **Room identifier**, paste the Matrix room identifier. - Optional. Select the **Notify only broken pipelines** checkbox to receive notifications for failed pipelines only. - Optional. From the **Branches for which notifications are to be sent** dropdown list, select the branches you want to receive notifications for. 1. Optional. Select **Test settings**. 1. Select **Save changes**. The Matrix room can now receive all selected GitLab events.
https://docs.gitlab.com/user/project/zentao
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/zentao.md
2025-08-13
doc/user/project/integrations
[ "doc", "user", "project", "integrations" ]
zentao.md
null
null
null
null
null
<!-- markdownlint-disable --> This document was moved to [another location](_index.md). <!-- This redirect file can be deleted after <2025-11-11>. --> <!-- Redirects that point to other docs in the same project expire in three months. --> <!-- Redirects that point to docs in a different project or site (for example, link is not relative and starts with `https:`) expire in one year. --> <!-- Before deletion, see: https://docs.gitlab.com/development/documentation/redirects -->
--- redirect_to: _index.md remove_date: '2025-11-11' breadcrumbs: - doc - user - project - integrations --- <!-- markdownlint-disable --> This document was moved to [another location](_index.md). <!-- This redirect file can be deleted after <2025-11-11>. --> <!-- Redirects that point to other docs in the same project expire in three months. --> <!-- Redirects that point to docs in a different project or site (for example, link is not relative and starts with `https:`) expire in one year. --> <!-- Before deletion, see: https://docs.gitlab.com/development/documentation/redirects -->
https://docs.gitlab.com/user/project/pivotal_tracker
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/pivotal_tracker.md
2025-08-13
doc/user/project/integrations
[ "doc", "user", "project", "integrations" ]
pivotal_tracker.md
Plan
Project Management
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Pivotal Tracker
null
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} The Pivotal Tracker integration adds commit messages as comments to Pivotal Tracker stories. Once enabled, commit messages are checked for square brackets containing a hash mark followed by the story ID (for example, `[#555]`). Every story ID found gets the commit comment added to it. You can also close a story with a message containing: `fix [#555]`. You can use any of these words: - `fix` - `fixed` - `fixes` - `complete` - `completes` - `completed` - `finish` - `finished` - `finishes` - `delivers` Read more about the [Source Commits endpoint](https://www.pivotaltracker.com/help/api/rest/v5#Source_Commits) in the Pivotal Tracker API documentation. See also the [Pivotal Tracker integration API documentation](../../../api/project_integrations.md#pivotal-tracker). ## Set up Pivotal Tracker In Pivotal Tracker, [create an API token](https://www.pivotaltracker.com/help/articles/api_token/). Complete these steps in GitLab: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Integrations**. 1. Select **Pivotal Tracker**. 1. Ensure that the **Active** toggle is enabled. 1. Paste the token you generated in Pivotal Tracker. 1. Optional. To restrict this setting to specific branches, list them in the **Restrict to branch** field, separated with commas. 1. Optional. Select **Test settings**. 1. Select **Save changes**.
--- stage: Plan group: Project Management info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments title: Pivotal Tracker breadcrumbs: - doc - user - project - integrations --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} The Pivotal Tracker integration adds commit messages as comments to Pivotal Tracker stories. Once enabled, commit messages are checked for square brackets containing a hash mark followed by the story ID (for example, `[#555]`). Every story ID found gets the commit comment added to it. You can also close a story with a message containing: `fix [#555]`. You can use any of these words: - `fix` - `fixed` - `fixes` - `complete` - `completes` - `completed` - `finish` - `finished` - `finishes` - `delivers` Read more about the [Source Commits endpoint](https://www.pivotaltracker.com/help/api/rest/v5#Source_Commits) in the Pivotal Tracker API documentation. See also the [Pivotal Tracker integration API documentation](../../../api/project_integrations.md#pivotal-tracker). ## Set up Pivotal Tracker In Pivotal Tracker, [create an API token](https://www.pivotaltracker.com/help/articles/api_token/). Complete these steps in GitLab: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Integrations**. 1. Select **Pivotal Tracker**. 1. Ensure that the **Active** toggle is enabled. 1. Paste the token you generated in Pivotal Tracker. 1. Optional. To restrict this setting to specific branches, list them in the **Restrict to branch** field, separated with commas. 1. Optional. Select **Test settings**. 1. Select **Save changes**.
https://docs.gitlab.com/user/project/webhook_events
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/webhook_events.md
2025-08-13
doc/user/project/integrations
[ "doc", "user", "project", "integrations" ]
webhook_events.md
Create
Import
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Webhook events
List of GitLab webhook events and payloads. Includes JSON examples.
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} Connect GitLab to your external applications and automate your workflow with webhooks. When specific events occur in GitLab, webhooks send HTTP POST requests with detailed information to your configured endpoints. Build automated processes that react to code changes, deployments, comments, and other activities without manual intervention. This page lists the events that are triggered for [project webhooks](webhooks.md) and [group webhooks](webhooks.md#group-webhooks). For a list of events triggered for system webhooks, see [system webhooks](../../../administration/system_hooks.md). ## Events triggered for both project and group webhooks Event type | Trigger ---------------------------------------------|----------------------------------------------------------------------------- [Push event](#push-events) | A push is made to the repository. [Tag event](#tag-events) | Tags are created or deleted in the repository. [Work item event](#work-item-events) | A new work item is created or an existing one is edited, closed, or reopened. [Comment event](#comment-events) | A new comment is made or edited on commits, merge requests, issues, and code snippets. <sup>1</sup> [Merge request event](#merge-request-events) | A merge request is created, edited, merged, or closed, or a commit is added in the source branch. [Wiki page event](#wiki-page-events) | A wiki page is created, edited, or deleted. [Pipeline event](#pipeline-events) | A pipeline status changes. [Job event](#job-events) | A job status changes. [Deployment event](#deployment-events) | A deployment starts, succeeds, fails, or is canceled. [Feature flag event](#feature-flag-events) | A feature flag is turned on or off. [Release event](#release-events) | A release is created, edited, or deleted. [Milestone event](#milestone-events) | A milestone is created, closed, reopened, or deleted. [Emoji event](#emoji-events) | An emoji reaction is added or removed. [Project or group access token event](#project-and-group-access-token-events) | A project or group access token will expire in seven days. [Vulnerability event](#vulnerability-events) | A vulnerability is created or updated. **Footnotes**: 1. Comment events triggered when the comment is edited [introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/127169) in GitLab 16.11. ## Events triggered for group webhooks only Event type | Trigger ---------------------------------------------|----------------------------------------------------------------------------- [Group member event](#group-member-events) | A user is added or removed from a group, or a user's access level or access expiration date changes. [Project event](#project-events) | A project is created or deleted in a group. [Subgroup event](#subgroup-events) | A subgroup is created or removed from a group. {{< alert type="note" >}} If an author has no public email listed in their [GitLab profile](https://gitlab.com/-/user_settings/profile), the `email` attribute in the webhook payload displays a value of `[REDACTED]`. {{< /alert >}} ## Push events Push events are triggered when you push to the repository, except when: - You push tags. - A single push includes changes for more than three branches by default (depending on the [`push_event_hooks_limit` setting](../../../api/settings.md#available-settings)). If you push more than 20 commits at once, the `commits` attribute in the payload contains information about the newest 20 commits only. Loading detailed commit data is expensive, so this restriction exists for performance reasons. The `total_commits_count` attribute contains the actual number of commits. If you create and push a branch without any new commits, the `commits` attribute in the payload is empty. Request header: ```plaintext X-Gitlab-Event: Push Hook ``` Payload example: ```json { "object_kind": "push", "event_name": "push", "before": "95790bf891e76fee5e1747ab589903a6a1f80f22", "after": "da1560886d4f094c3e6c9ef40349f7d38b5d27d7", "ref": "refs/heads/master", "ref_protected": true, "checkout_sha": "da1560886d4f094c3e6c9ef40349f7d38b5d27d7", "user_id": 4, "user_name": "John Smith", "user_username": "jsmith", "user_email": "john@example.com", "user_avatar": "https://s.gravatar.com/avatar/d4c74594d841139328695756648b6bd6?s=8://s.gravatar.com/avatar/d4c74594d841139328695756648b6bd6?s=80", "project_id": 15, "project":{ "id": 15, "name":"Diaspora", "description":"", "web_url":"http://example.com/mike/diaspora", "avatar_url":null, "git_ssh_url":"git@example.com:mike/diaspora.git", "git_http_url":"http://example.com/mike/diaspora.git", "namespace":"Mike", "visibility_level":0, "path_with_namespace":"mike/diaspora", "default_branch":"master", "homepage":"http://example.com/mike/diaspora", "url":"git@example.com:mike/diaspora.git", "ssh_url":"git@example.com:mike/diaspora.git", "http_url":"http://example.com/mike/diaspora.git" }, "repository":{ "name": "Diaspora", "url": "git@example.com:mike/diaspora.git", "description": "", "homepage": "http://example.com/mike/diaspora", "git_http_url":"http://example.com/mike/diaspora.git", "git_ssh_url":"git@example.com:mike/diaspora.git", "visibility_level":0 }, "commits": [ { "id": "b6568db1bc1dcd7f8b4d5a946b0b91f9dacd7327", "message": "Update Catalan translation to e38cb41.\n\nSee https://gitlab.com/gitlab-org/gitlab for more information", "title": "Update Catalan translation to e38cb41.", "timestamp": "2011-12-12T14:27:31+02:00", "url": "http://example.com/mike/diaspora/commit/b6568db1bc1dcd7f8b4d5a946b0b91f9dacd7327", "author": { "name": "Jordi Mallach", "email": "jordi@softcatala.org" }, "added": ["CHANGELOG"], "modified": ["app/controller/application.rb"], "removed": [] }, { "id": "da1560886d4f094c3e6c9ef40349f7d38b5d27d7", "message": "fixed readme", "title": "fixed readme", "timestamp": "2012-01-03T23:36:29+02:00", "url": "http://example.com/mike/diaspora/commit/da1560886d4f094c3e6c9ef40349f7d38b5d27d7", "author": { "name": "GitLab dev user", "email": "gitlabdev@dv6700.(none)" }, "added": ["CHANGELOG"], "modified": ["app/controller/application.rb"], "removed": [] } ], "total_commits_count": 4 } ``` ## Tag events Tag events are triggered when you create or delete tags in the repository. This hook is not executed if a single push includes changes for more than three tags by default (depending on the [`push_event_hooks_limit` setting](../../../api/settings.md#available-settings)). Request header: ```plaintext X-Gitlab-Event: Tag Push Hook ``` Payload example: ```json { "object_kind": "tag_push", "event_name": "tag_push", "before": "0000000000000000000000000000000000000000", "after": "82b3d5ae55f7080f1e6022629cdb57bfae7cccc7", "ref": "refs/tags/v1.0.0", "ref_protected": true, "checkout_sha": "82b3d5ae55f7080f1e6022629cdb57bfae7cccc7", "user_id": 1, "user_name": "John Smith", "user_avatar": "https://s.gravatar.com/avatar/d4c74594d841139328695756648b6bd6?s=8://s.gravatar.com/avatar/d4c74594d841139328695756648b6bd6?s=80", "project_id": 1, "project":{ "id": 1, "name":"Example", "description":"", "web_url":"http://example.com/jsmith/example", "avatar_url":null, "git_ssh_url":"git@example.com:jsmith/example.git", "git_http_url":"http://example.com/jsmith/example.git", "namespace":"Jsmith", "visibility_level":0, "path_with_namespace":"jsmith/example", "default_branch":"master", "homepage":"http://example.com/jsmith/example", "url":"git@example.com:jsmith/example.git", "ssh_url":"git@example.com:jsmith/example.git", "http_url":"http://example.com/jsmith/example.git" }, "repository":{ "name": "Example", "url": "ssh://git@example.com/jsmith/example.git", "description": "", "homepage": "http://example.com/jsmith/example", "git_http_url":"http://example.com/jsmith/example.git", "git_ssh_url":"git@example.com:jsmith/example.git", "visibility_level":0 }, "commits": [], "total_commits_count": 0 } ``` ## Work item events {{< history >}} - `type` attribute in `object_attributes` [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/467415) in GitLab 17.2. - Support for epics [introduced](https://gitlab.com/groups/gitlab-org/-/epics/13056) in GitLab 17.3. [The new look for epics](../../group/epics/_index.md#epics-as-work-items) must be enabled. - Support for epics [generally available](https://gitlab.com/gitlab-org/gitlab/-/issues/468310) in GitLab 18.1. {{< /history >}} Work item events are triggered when a work item is created, edited, closed, or reopened. The supported work item types are: - [Epics](../../group/epics/_index.md) - [Issue](../issues/_index.md) - [Tasks](../../tasks.md) - [Incidents](../../../operations/incident_management/incidents.md) - [Test cases](../../../ci/test_cases/_index.md) - [Requirements](../requirements/_index.md) - [Objectives and key results (OKRs)](../../okrs.md) For issues and [Service Desk](../service_desk/_index.md) issues, the `object_kind` is `issue`, and the `type` is `Issue`. For all other work items, the `object_kind` field is `work_item`, and the `type` is the work item type. For work item type `Epic`, to get events for changes, the webhook must be registered for the group. The available values for `object_attributes.action` in the payload are: - `open` - `close` - `reopen` - `update` The `assignee` and `assignee_id` keys are deprecated and contain the first assignee only. The `escalation_status` and `escalation_policy` fields are only available for issue types which [support escalations](../../../operations/incident_management/paging.md#paging), such as incidents. Request header: ```plaintext X-Gitlab-Event: Issue Hook ``` Payload example: ```json { "object_kind": "issue", "event_type": "issue", "user": { "id": 1, "name": "Administrator", "username": "root", "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40\u0026d=identicon", "email": "admin@example.com" }, "project": { "id": 1, "name":"Gitlab Test", "description":"Aut reprehenderit ut est.", "web_url":"http://example.com/gitlabhq/gitlab-test", "avatar_url":null, "git_ssh_url":"git@example.com:gitlabhq/gitlab-test.git", "git_http_url":"http://example.com/gitlabhq/gitlab-test.git", "namespace":"GitlabHQ", "visibility_level":20, "path_with_namespace":"gitlabhq/gitlab-test", "default_branch":"master", "ci_config_path": null, "homepage":"http://example.com/gitlabhq/gitlab-test", "url":"http://example.com/gitlabhq/gitlab-test.git", "ssh_url":"git@example.com:gitlabhq/gitlab-test.git", "http_url":"http://example.com/gitlabhq/gitlab-test.git" }, "object_attributes": { "id": 301, "title": "New API: create/update/delete file", "assignee_ids": [51], "assignee_id": 51, "author_id": 51, "project_id": 14, "created_at": "2013-12-03T17:15:43Z", "updated_at": "2013-12-03T17:15:43Z", "updated_by_id": 1, "last_edited_at": null, "last_edited_by_id": null, "relative_position": 0, "description": "Create new API for manipulations with repository", "milestone_id": null, "state_id": 1, "confidential": false, "discussion_locked": true, "due_date": null, "moved_to_id": null, "duplicated_to_id": null, "time_estimate": 0, "total_time_spent": 0, "time_change": 0, "human_total_time_spent": null, "human_time_estimate": null, "human_time_change": null, "weight": null, "health_status": "at_risk", "type": "Issue", "iid": 23, "url": "http://example.com/diaspora/issues/23", "state": "opened", "action": "open", "severity": "high", "escalation_status": "triggered", "escalation_policy": { "id": 18, "name": "Engineering On-call" }, "labels": [{ "id": 206, "title": "API", "color": "#ffffff", "project_id": 14, "created_at": "2013-12-03T17:15:43Z", "updated_at": "2013-12-03T17:15:43Z", "template": false, "description": "API related issues", "type": "ProjectLabel", "group_id": 41 }] }, "repository": { "name": "Gitlab Test", "url": "http://example.com/gitlabhq/gitlab-test.git", "description": "Aut reprehenderit ut est.", "homepage": "http://example.com/gitlabhq/gitlab-test" }, "assignees": [{ "name": "User1", "username": "user1", "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40\u0026d=identicon" }], "assignee": { "name": "User1", "username": "user1", "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40\u0026d=identicon" }, "labels": [{ "id": 206, "title": "API", "color": "#ffffff", "project_id": 14, "created_at": "2013-12-03T17:15:43Z", "updated_at": "2013-12-03T17:15:43Z", "template": false, "description": "API related issues", "type": "ProjectLabel", "group_id": 41 }], "changes": { "updated_by_id": { "previous": null, "current": 1 }, "updated_at": { "previous": "2017-09-15 16:50:55 UTC", "current": "2017-09-15 16:52:00 UTC" }, "labels": { "previous": [{ "id": 206, "title": "API", "color": "#ffffff", "project_id": 14, "created_at": "2013-12-03T17:15:43Z", "updated_at": "2013-12-03T17:15:43Z", "template": false, "description": "API related issues", "type": "ProjectLabel", "group_id": 41 }], "current": [{ "id": 205, "title": "Platform", "color": "#123123", "project_id": 14, "created_at": "2013-12-03T17:15:43Z", "updated_at": "2013-12-03T17:15:43Z", "template": false, "description": "Platform related issues", "type": "ProjectLabel", "group_id": 41 }] } } } ``` ## Comment events {{< history >}} - `object_attributes.action` property [introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/147856) in GitLab 16.11. {{< /history >}} Comment events are triggered when a new comment is made or edited on commits, merge requests, issues, and code snippets. The note data is stored in `object_attributes` (for example, `note` or `noteable_type`). The payload includes information about the target of the comment. For example, a comment on an issue includes specific issue information under the `issue` key. The available target types are: - `commit` - `merge_request` - `issue` - `snippet` The available values for `object_attributes.action` in the payload are: - `create` - `update` ### Comment on a commit Request header: ```plaintext X-Gitlab-Event: Note Hook ``` Payload example: ```json { "object_kind": "note", "event_type": "note", "user": { "id": 1, "name": "Administrator", "username": "root", "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40\u0026d=identicon", "email": "admin@example.com" }, "project_id": 5, "project":{ "id": 5, "name":"Gitlab Test", "description":"Aut reprehenderit ut est.", "web_url":"http://example.com/gitlabhq/gitlab-test", "avatar_url":null, "git_ssh_url":"git@example.com:gitlabhq/gitlab-test.git", "git_http_url":"http://example.com/gitlabhq/gitlab-test.git", "namespace":"GitlabHQ", "visibility_level":20, "path_with_namespace":"gitlabhq/gitlab-test", "default_branch":"master", "homepage":"http://example.com/gitlabhq/gitlab-test", "url":"http://example.com/gitlabhq/gitlab-test.git", "ssh_url":"git@example.com:gitlabhq/gitlab-test.git", "http_url":"http://example.com/gitlabhq/gitlab-test.git" }, "repository":{ "name": "Gitlab Test", "url": "http://example.com/gitlab-org/gitlab-test.git", "description": "Aut reprehenderit ut est.", "homepage": "http://example.com/gitlab-org/gitlab-test" }, "object_attributes": { "id": 1243, "note": "This is a commit comment. How does this work?", "noteable_type": "Commit", "author_id": 1, "created_at": "2015-05-17 18:08:09 UTC", "updated_at": "2015-05-17 18:08:09 UTC", "project_id": 5, "attachment":null, "line_code": "bec9703f7a456cd2b4ab5fb3220ae016e3e394e3_0_1", "commit_id": "cfe32cf61b73a0d5e9f13e774abde7ff789b1660", "noteable_id": null, "system": false, "st_diff": { "diff": "--- /dev/null\n+++ b/six\n@@ -0,0 +1 @@\n+Subproject commit 409f37c4f05865e4fb208c771485f211a22c4c2d\n", "new_path": "six", "old_path": "six", "a_mode": "0", "b_mode": "160000", "new_file": true, "renamed_file": false, "deleted_file": false }, "action": "create", "url": "http://example.com/gitlab-org/gitlab-test/commit/cfe32cf61b73a0d5e9f13e774abde7ff789b1660#note_1243" }, "commit": { "id": "cfe32cf61b73a0d5e9f13e774abde7ff789b1660", "message": "Add submodule\n\nSigned-off-by: Example User \u003cuser@example.com.com\u003e\n", "timestamp": "2014-02-27T10:06:20+02:00", "url": "http://example.com/gitlab-org/gitlab-test/commit/cfe32cf61b73a0d5e9f13e774abde7ff789b1660", "author": { "name": "Example User", "email": "user@example.com" } } } ``` ### Comment on a merge request Request header: ```plaintext X-Gitlab-Event: Note Hook ``` Payload example: ```json { "object_kind": "note", "event_type": "note", "user": { "id": 1, "name": "Administrator", "username": "root", "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40\u0026d=identicon", "email": "admin@example.com" }, "project_id": 5, "project":{ "id": 5, "name":"Gitlab Test", "description":"Aut reprehenderit ut est.", "web_url":"http://example.com/gitlab-org/gitlab-test", "avatar_url":null, "git_ssh_url":"git@example.com:gitlab-org/gitlab-test.git", "git_http_url":"http://example.com/gitlab-org/gitlab-test.git", "namespace":"Gitlab Org", "visibility_level":10, "path_with_namespace":"gitlab-org/gitlab-test", "default_branch":"master", "homepage":"http://example.com/gitlab-org/gitlab-test", "url":"http://example.com/gitlab-org/gitlab-test.git", "ssh_url":"git@example.com:gitlab-org/gitlab-test.git", "http_url":"http://example.com/gitlab-org/gitlab-test.git" }, "repository":{ "name": "Gitlab Test", "url": "http://localhost/gitlab-org/gitlab-test.git", "description": "Aut reprehenderit ut est.", "homepage": "http://example.com/gitlab-org/gitlab-test" }, "object_attributes": { "id": 1244, "note": "This MR needs work.", "noteable_type": "MergeRequest", "author_id": 1, "created_at": "2015-05-17 18:21:36 UTC", "updated_at": "2015-05-17 18:21:36 UTC", "project_id": 5, "attachment": null, "line_code": null, "commit_id": "", "noteable_id": 7, "system": false, "st_diff": null, "action": "create", "url": "http://example.com/gitlab-org/gitlab-test/merge_requests/1#note_1244" }, "merge_request": { "id": 7, "target_branch": "markdown", "source_branch": "master", "source_project_id": 5, "author_id": 8, "assignee_id": 28, "title": "Tempora et eos debitis quae laborum et.", "created_at": "2015-03-01 20:12:53 UTC", "updated_at": "2015-03-21 18:27:27 UTC", "milestone_id": 11, "state": "opened", "merge_status": "cannot_be_merged", "target_project_id": 5, "iid": 1, "description": "Et voluptas corrupti assumenda temporibus. Architecto cum animi eveniet amet asperiores. Vitae numquam voluptate est natus sit et ad id.", "position": 0, "labels": [ { "id": 25, "title": "Afterpod", "color": "#3e8068", "project_id": null, "created_at": "2019-06-05T14:32:20.211Z", "updated_at": "2019-06-05T14:32:20.211Z", "template": false, "description": null, "type": "GroupLabel", "group_id": 4 }, { "id": 86, "title": "Element", "color": "#231afe", "project_id": 4, "created_at": "2019-06-05T14:32:20.637Z", "updated_at": "2019-06-05T14:32:20.637Z", "template": false, "description": null, "type": "ProjectLabel", "group_id": null } ], "source":{ "name":"Gitlab Test", "description":"Aut reprehenderit ut est.", "web_url":"http://example.com/gitlab-org/gitlab-test", "avatar_url":null, "git_ssh_url":"git@example.com:gitlab-org/gitlab-test.git", "git_http_url":"http://example.com/gitlab-org/gitlab-test.git", "namespace":"Gitlab Org", "visibility_level":10, "path_with_namespace":"gitlab-org/gitlab-test", "default_branch":"master", "homepage":"http://example.com/gitlab-org/gitlab-test", "url":"http://example.com/gitlab-org/gitlab-test.git", "ssh_url":"git@example.com:gitlab-org/gitlab-test.git", "http_url":"http://example.com/gitlab-org/gitlab-test.git" }, "target": { "name":"Gitlab Test", "description":"Aut reprehenderit ut est.", "web_url":"http://example.com/gitlab-org/gitlab-test", "avatar_url":null, "git_ssh_url":"git@example.com:gitlab-org/gitlab-test.git", "git_http_url":"http://example.com/gitlab-org/gitlab-test.git", "namespace":"Gitlab Org", "visibility_level":10, "path_with_namespace":"gitlab-org/gitlab-test", "default_branch":"master", "homepage":"http://example.com/gitlab-org/gitlab-test", "url":"http://example.com/gitlab-org/gitlab-test.git", "ssh_url":"git@example.com:gitlab-org/gitlab-test.git", "http_url":"http://example.com/gitlab-org/gitlab-test.git" }, "last_commit": { "id": "562e173be03b8ff2efb05345d12df18815438a4b", "message": "Merge branch 'another-branch' into 'master'\n\nCheck in this test\n", "timestamp": "2015-04-08T21: 00:25-07:00", "url": "http://example.com/gitlab-org/gitlab-test/commit/562e173be03b8ff2efb05345d12df18815438a4b", "author": { "name": "John Smith", "email": "john@example.com" } }, "work_in_progress": false, "draft": false, "assignee": { "name": "User1", "username": "user1", "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40\u0026d=identicon" }, "detailed_merge_status": "checking" } } ``` ### Comment on an issue - The `assignee_id` field is deprecated and shows the first assignee only. - The `event_type` is set to `confidential_note` for confidential issues. Request header: ```plaintext X-Gitlab-Event: Note Hook ``` Payload example: ```json { "object_kind": "note", "event_type": "note", "user": { "id": 1, "name": "Administrator", "username": "root", "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40\u0026d=identicon", "email": "admin@example.com" }, "project_id": 5, "project":{ "id": 5, "name":"Gitlab Test", "description":"Aut reprehenderit ut est.", "web_url":"http://example.com/gitlab-org/gitlab-test", "avatar_url":null, "git_ssh_url":"git@example.com:gitlab-org/gitlab-test.git", "git_http_url":"http://example.com/gitlab-org/gitlab-test.git", "namespace":"Gitlab Org", "visibility_level":10, "path_with_namespace":"gitlab-org/gitlab-test", "default_branch":"master", "homepage":"http://example.com/gitlab-org/gitlab-test", "url":"http://example.com/gitlab-org/gitlab-test.git", "ssh_url":"git@example.com:gitlab-org/gitlab-test.git", "http_url":"http://example.com/gitlab-org/gitlab-test.git" }, "repository":{ "name":"diaspora", "url":"git@example.com:mike/diaspora.git", "description":"", "homepage":"http://example.com/mike/diaspora" }, "object_attributes": { "id": 1241, "note": "Hello world", "noteable_type": "Issue", "author_id": 1, "created_at": "2015-05-17 17:06:40 UTC", "updated_at": "2015-05-17 17:06:40 UTC", "project_id": 5, "attachment": null, "line_code": null, "commit_id": "", "noteable_id": 92, "system": false, "st_diff": null, "action": "create", "url": "http://example.com/gitlab-org/gitlab-test/issues/17#note_1241" }, "issue": { "id": 92, "title": "test", "assignee_ids": [], "assignee_id": null, "author_id": 1, "project_id": 5, "created_at": "2015-04-12 14:53:17 UTC", "updated_at": "2015-04-26 08:28:42 UTC", "position": 0, "branch_name": null, "description": "test", "milestone_id": null, "state": "closed", "iid": 17, "labels": [ { "id": 25, "title": "Afterpod", "color": "#3e8068", "project_id": null, "created_at": "2019-06-05T14:32:20.211Z", "updated_at": "2019-06-05T14:32:20.211Z", "template": false, "description": null, "type": "GroupLabel", "group_id": 4 }, { "id": 86, "title": "Element", "color": "#231afe", "project_id": 4, "created_at": "2019-06-05T14:32:20.637Z", "updated_at": "2019-06-05T14:32:20.637Z", "template": false, "description": null, "type": "ProjectLabel", "group_id": null } ] } } ``` ### Comment on a code snippet Request header: ```plaintext X-Gitlab-Event: Note Hook ``` Payload example: ```json { "object_kind": "note", "event_type": "note", "user": { "id": 1, "name": "Administrator", "username": "root", "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40\u0026d=identicon", "email": "admin@example.com" }, "project_id": 5, "project":{ "id": 5, "name":"Gitlab Test", "description":"Aut reprehenderit ut est.", "web_url":"http://example.com/gitlab-org/gitlab-test", "avatar_url":null, "git_ssh_url":"git@example.com:gitlab-org/gitlab-test.git", "git_http_url":"http://example.com/gitlab-org/gitlab-test.git", "namespace":"Gitlab Org", "visibility_level":10, "path_with_namespace":"gitlab-org/gitlab-test", "default_branch":"master", "homepage":"http://example.com/gitlab-org/gitlab-test", "url":"http://example.com/gitlab-org/gitlab-test.git", "ssh_url":"git@example.com:gitlab-org/gitlab-test.git", "http_url":"http://example.com/gitlab-org/gitlab-test.git" }, "repository":{ "name":"Gitlab Test", "url":"http://example.com/gitlab-org/gitlab-test.git", "description":"Aut reprehenderit ut est.", "homepage":"http://example.com/gitlab-org/gitlab-test" }, "object_attributes": { "id": 1245, "note": "Is this snippet doing what it's supposed to be doing?", "noteable_type": "Snippet", "author_id": 1, "created_at": "2015-05-17 18:35:50 UTC", "updated_at": "2015-05-17 18:35:50 UTC", "project_id": 5, "attachment": null, "line_code": null, "commit_id": "", "noteable_id": 53, "system": false, "st_diff": null, "action": "create", "url": "http://example.com/gitlab-org/gitlab-test/-/snippets/53#note_1245" }, "snippet": { "id": 53, "title": "test", "description": "A snippet description.", "content": "puts 'Hello world'", "author_id": 1, "project_id": 5, "created_at": "2015-04-09 02:40:38 UTC", "updated_at": "2015-04-09 02:40:38 UTC", "file_name": "test.rb", "type": "ProjectSnippet", "visibility_level": 0, "url": "http://example.com/gitlab-org/gitlab-test/-/snippets/53" } } ``` ## Merge request events Merge request events are triggered when: - A new merge request is created. - An existing merge request is updated, approved (by all required approvers), unapproved, merged, or closed. - An individual user adds or removes their approval to an existing merge request. - A commit is added in the source branch. - All threads are resolved on the merge request. Merge request events can be triggered even if the `changes` field is empty. Webhook receivers should always inspect the content of the `changes` field for the actual changes in a merge request. The available values for `object_attributes.action` in the payload are: - `open` - `close` - `reopen` - `update` - `approved` - `unapproved` - `approval` - `unapproval` - `merge` The field `object_attributes.oldrev` is only available when there are actual code changes, like: - New code is pushed. - A [suggestion](../merge_requests/reviews/suggestions.md) is applied. Request header: ```plaintext X-Gitlab-Event: Merge Request Hook ``` Payload example: ```json { "object_kind": "merge_request", "event_type": "merge_request", "user": { "id": 1, "name": "Administrator", "username": "root", "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40\u0026d=identicon", "email": "admin@example.com" }, "project": { "id": 1, "name":"Gitlab Test", "description":"Aut reprehenderit ut est.", "web_url":"http://example.com/gitlabhq/gitlab-test", "avatar_url":null, "git_ssh_url":"git@example.com:gitlabhq/gitlab-test.git", "git_http_url":"http://example.com/gitlabhq/gitlab-test.git", "namespace":"GitlabHQ", "visibility_level":20, "path_with_namespace":"gitlabhq/gitlab-test", "default_branch":"master", "ci_config_path":"", "homepage":"http://example.com/gitlabhq/gitlab-test", "url":"http://example.com/gitlabhq/gitlab-test.git", "ssh_url":"git@example.com:gitlabhq/gitlab-test.git", "http_url":"http://example.com/gitlabhq/gitlab-test.git" }, "repository": { "name": "Gitlab Test", "url": "http://example.com/gitlabhq/gitlab-test.git", "description": "Aut reprehenderit ut est.", "homepage": "http://example.com/gitlabhq/gitlab-test" }, "object_attributes": { "id": 99, "iid": 1, "target_branch": "master", "source_branch": "ms-viewport", "source_project_id": 14, "author_id": 51, "assignee_ids": [6], "assignee_id": 6, "reviewer_ids": [6], "title": "MS-Viewport", "created_at": "2013-12-03T17:23:34Z", "updated_at": "2013-12-03T17:23:34Z", "last_edited_at": "2013-12-03T17:23:34Z", "last_edited_by_id": 1, "milestone_id": null, "state_id": 1, "state": "opened", "blocking_discussions_resolved": true, "work_in_progress": false, "draft": false, "first_contribution": true, "merge_status": "unchecked", "target_project_id": 14, "description": "", "prepared_at": "2013-12-03T19:23:34Z", "total_time_spent": 1800, "time_change": 30, "human_total_time_spent": "30m", "human_time_change": "30s", "human_time_estimate": "30m", "url": "http://example.com/diaspora/merge_requests/1", "source": { "name":"Awesome Project", "description":"Aut reprehenderit ut est.", "web_url":"http://example.com/awesome_space/awesome_project", "avatar_url":null, "git_ssh_url":"git@example.com:awesome_space/awesome_project.git", "git_http_url":"http://example.com/awesome_space/awesome_project.git", "namespace":"Awesome Space", "visibility_level":20, "path_with_namespace":"awesome_space/awesome_project", "default_branch":"master", "homepage":"http://example.com/awesome_space/awesome_project", "url":"http://example.com/awesome_space/awesome_project.git", "ssh_url":"git@example.com:awesome_space/awesome_project.git", "http_url":"http://example.com/awesome_space/awesome_project.git" }, "target": { "name":"Awesome Project", "description":"Aut reprehenderit ut est.", "web_url":"http://example.com/awesome_space/awesome_project", "avatar_url":null, "git_ssh_url":"git@example.com:awesome_space/awesome_project.git", "git_http_url":"http://example.com/awesome_space/awesome_project.git", "namespace":"Awesome Space", "visibility_level":20, "path_with_namespace":"awesome_space/awesome_project", "default_branch":"master", "homepage":"http://example.com/awesome_space/awesome_project", "url":"http://example.com/awesome_space/awesome_project.git", "ssh_url":"git@example.com:awesome_space/awesome_project.git", "http_url":"http://example.com/awesome_space/awesome_project.git" }, "last_commit": { "id": "da1560886d4f094c3e6c9ef40349f7d38b5d27d7", "message": "fixed readme", "title": "Update file README.md", "timestamp": "2012-01-03T23:36:29+02:00", "url": "http://example.com/awesome_space/awesome_project/commits/da1560886d4f094c3e6c9ef40349f7d38b5d27d7", "author": { "name": "GitLab dev user", "email": "gitlabdev@dv6700.(none)" } }, "labels": [{ "id": 206, "title": "API", "color": "#ffffff", "project_id": 14, "created_at": "2013-12-03T17:15:43Z", "updated_at": "2013-12-03T17:15:43Z", "template": false, "description": "API related issues", "type": "ProjectLabel", "group_id": 41 }], "action": "open", "detailed_merge_status": "mergeable" }, "labels": [{ "id": 206, "title": "API", "color": "#ffffff", "project_id": 14, "created_at": "2013-12-03T17:15:43Z", "updated_at": "2013-12-03T17:15:43Z", "template": false, "description": "API related issues", "type": "ProjectLabel", "group_id": 41 }], "changes": { "updated_by_id": { "previous": null, "current": 1 }, "draft": { "previous": true, "current": false }, "updated_at": { "previous": "2017-09-15 16:50:55 UTC", "current":"2017-09-15 16:52:00 UTC" }, "labels": { "previous": [{ "id": 206, "title": "API", "color": "#ffffff", "project_id": 14, "created_at": "2013-12-03T17:15:43Z", "updated_at": "2013-12-03T17:15:43Z", "template": false, "description": "API related issues", "type": "ProjectLabel", "group_id": 41 }], "current": [{ "id": 205, "title": "Platform", "color": "#123123", "project_id": 14, "created_at": "2013-12-03T17:15:43Z", "updated_at": "2013-12-03T17:15:43Z", "template": false, "description": "Platform related issues", "type": "ProjectLabel", "group_id": 41 }] }, "last_edited_at": { "previous": null, "current": "2023-03-15 00:00:10 UTC" }, "last_edited_by_id": { "previous": null, "current": 3278533 } }, "assignees": [ { "id": 6, "name": "User1", "username": "user1", "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40\u0026d=identicon" } ], "reviewers": [ { "id": 6, "name": "User1", "username": "user1", "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40\u0026d=identicon" } ] } ``` {{< alert type="note" >}} The fields `assignee_id` and `merge_status` are [deprecated](../../../api/merge_requests.md). {{< /alert >}} ## Wiki page events Wiki page events are triggered when a wiki page is created, updated, or deleted. Request header: ```plaintext X-Gitlab-Event: Wiki Page Hook ``` Payload example: ```json { "object_kind": "wiki_page", "user": { "id": 1, "name": "Administrator", "username": "root", "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80\u0026d=identicon", "email": "admin@example.com" }, "project": { "id": 1, "name": "awesome-project", "description": "This is awesome", "web_url": "http://example.com/root/awesome-project", "avatar_url": null, "git_ssh_url": "git@example.com:root/awesome-project.git", "git_http_url": "http://example.com/root/awesome-project.git", "namespace": "root", "visibility_level": 0, "path_with_namespace": "root/awesome-project", "default_branch": "master", "homepage": "http://example.com/root/awesome-project", "url": "git@example.com:root/awesome-project.git", "ssh_url": "git@example.com:root/awesome-project.git", "http_url": "http://example.com/root/awesome-project.git" }, "wiki": { "web_url": "http://example.com/root/awesome-project/-/wikis/home", "git_ssh_url": "git@example.com:root/awesome-project.wiki.git", "git_http_url": "http://example.com/root/awesome-project.wiki.git", "path_with_namespace": "root/awesome-project.wiki", "default_branch": "master" }, "object_attributes": { "title": "Awesome", "content": "awesome content goes here", "format": "markdown", "message": "adding an awesome page to the wiki", "slug": "awesome", "url": "http://example.com/root/awesome-project/-/wikis/awesome", "action": "create", "diff_url": "http://example.com/root/awesome-project/-/wikis/home/diff?version_id=78ee4a6705abfbff4f4132c6646dbaae9c8fb6ec", "version_id": "3ad67c972065298d226dd80b2b03e0fc2421e731" } } ``` ## Pipeline events Pipeline events are triggered when the status of a pipeline changes. In [GitLab 15.1](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/89546) and later, pipeline webhooks triggered by blocked users are not processed. In [GitLab 16.1](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/123639) and later, pipeline webhooks started to expose `object_attributes.name`. Request header: ```plaintext X-Gitlab-Event: Pipeline Hook ``` Payload example: ```json { "object_kind": "pipeline", "object_attributes":{ "id": 31, "iid": 3, "name": "Pipeline for branch: master", "ref": "master", "tag": false, "sha": "bcbb5ec396a2c0f828686f14fac9b80b780504f2", "before_sha": "bcbb5ec396a2c0f828686f14fac9b80b780504f2", "source": "merge_request_event", "status": "success", "stages":[ "build", "test", "deploy" ], "created_at": "2016-08-12 15:23:28 UTC", "finished_at": "2016-08-12 15:26:29 UTC", "duration": 63, "variables": [ { "key": "NESTOR_PROD_ENVIRONMENT", "value": "us-west-1" } ], "url": "http://example.com/gitlab-org/gitlab-test/-/pipelines/31" }, "merge_request": { "id": 1, "iid": 1, "title": "Test", "source_branch": "test", "source_project_id": 1, "target_branch": "master", "target_project_id": 1, "state": "opened", "merge_status": "can_be_merged", "detailed_merge_status": "mergeable", "url": "http://192.168.64.1:3005/gitlab-org/gitlab-test/merge_requests/1" }, "user":{ "id": 1, "name": "Administrator", "username": "root", "avatar_url": "http://www.gravatar.com/avatar/e32bd13e2add097461cb96824b7a829c?s=80\u0026d=identicon", "email": "user_email@gitlab.com" }, "project":{ "id": 1, "name": "Gitlab Test", "description": "Atque in sunt eos similique dolores voluptatem.", "web_url": "http://192.168.64.1:3005/gitlab-org/gitlab-test", "avatar_url": null, "git_ssh_url": "git@192.168.64.1:gitlab-org/gitlab-test.git", "git_http_url": "http://192.168.64.1:3005/gitlab-org/gitlab-test.git", "namespace": "Gitlab Org", "visibility_level": 20, "path_with_namespace": "gitlab-org/gitlab-test", "default_branch": "master" }, "commit":{ "id": "bcbb5ec396a2c0f828686f14fac9b80b780504f2", "message": "test\n", "timestamp": "2016-08-12T17:23:21+02:00", "url": "http://example.com/gitlab-org/gitlab-test/commit/bcbb5ec396a2c0f828686f14fac9b80b780504f2", "author":{ "name": "User", "email": "user@gitlab.com" } }, "source_pipeline":{ "project":{ "id": 41, "web_url": "https://gitlab.example.com/gitlab-org/upstream-project", "path_with_namespace": "gitlab-org/upstream-project" }, "pipeline_id": 30, "job_id": 3401 }, "builds":[ { "id": 380, "stage": "deploy", "name": "production", "status": "skipped", "created_at": "2016-08-12 15:23:28 UTC", "started_at": null, "finished_at": null, "duration": null, "queued_duration": null, "failure_reason": null, "when": "manual", "manual": true, "allow_failure": false, "user":{ "id": 1, "name": "Administrator", "username": "root", "avatar_url": "http://www.gravatar.com/avatar/e32bd13e2add097461cb96824b7a829c?s=80\u0026d=identicon", "email": "admin@example.com" }, "runner": null, "artifacts_file":{ "filename": null, "size": null }, "environment": { "name": "production", "action": "start", "deployment_tier": "production" } }, { "id": 377, "stage": "test", "name": "test-image", "status": "success", "created_at": "2016-08-12 15:23:28 UTC", "started_at": "2016-08-12 15:26:12 UTC", "finished_at": "2016-08-12 15:26:29 UTC", "duration": 17.0, "queued_duration": 196.0, "failure_reason": null, "when": "on_success", "manual": false, "allow_failure": false, "user":{ "id": 1, "name": "Administrator", "username": "root", "avatar_url": "http://www.gravatar.com/avatar/e32bd13e2add097461cb96824b7a829c?s=80\u0026d=identicon", "email": "admin@example.com" }, "runner": { "id": 380987, "description": "shared-runners-manager-6.gitlab.com", "active": true, "runner_type": "instance_type", "is_shared": true, "tags": [ "linux", "docker", "shared-runner" ] }, "artifacts_file":{ "filename": null, "size": null }, "environment": null }, { "id": 378, "stage": "test", "name": "test-build", "status": "failed", "created_at": "2016-08-12 15:23:28 UTC", "started_at": "2016-08-12 15:26:12 UTC", "finished_at": "2016-08-12 15:26:29 UTC", "duration": 17.0, "queued_duration": 196.0, "failure_reason": "script_failure", "when": "on_success", "manual": false, "allow_failure": false, "user":{ "id": 1, "name": "Administrator", "username": "root", "avatar_url": "http://www.gravatar.com/avatar/e32bd13e2add097461cb96824b7a829c?s=80\u0026d=identicon", "email": "admin@example.com" }, "runner": { "id":380987, "description":"shared-runners-manager-6.gitlab.com", "active":true, "runner_type": "instance_type", "is_shared": true, "tags": [ "linux", "docker" ] }, "artifacts_file":{ "filename": null, "size": null }, "environment": null }, { "id": 376, "stage": "build", "name": "build-image", "status": "success", "created_at": "2016-08-12 15:23:28 UTC", "started_at": "2016-08-12 15:24:56 UTC", "finished_at": "2016-08-12 15:25:26 UTC", "duration": 17.0, "queued_duration": 196.0, "failure_reason": null, "when": "on_success", "manual": false, "allow_failure": false, "user":{ "id": 1, "name": "Administrator", "username": "root", "avatar_url": "http://www.gravatar.com/avatar/e32bd13e2add097461cb96824b7a829c?s=80\u0026d=identicon", "email": "admin@example.com" }, "runner": { "id": 380987, "description": "shared-runners-manager-6.gitlab.com", "active": true, "runner_type": "instance_type", "is_shared": true, "tags": [ "linux", "docker" ] }, "artifacts_file":{ "filename": null, "size": null }, "environment": null }, { "id": 379, "stage": "deploy", "name": "staging", "status": "created", "created_at": "2016-08-12 15:23:28 UTC", "started_at": null, "finished_at": null, "duration": null, "queued_duration": null, "failure_reason": null, "when": "on_success", "manual": false, "allow_failure": false, "user":{ "id": 1, "name": "Administrator", "username": "root", "avatar_url": "http://www.gravatar.com/avatar/e32bd13e2add097461cb96824b7a829c?s=80\u0026d=identicon", "email": "admin@example.com" }, "runner": null, "artifacts_file":{ "filename": null, "size": null }, "environment": { "name": "staging", "action": "start", "deployment_tier": "staging" } } ] } ``` ## Job events Job events are triggered when the status of a job changes. Trigger jobs are excluded. The `commit.id` in the payload is the ID of the pipeline, not the ID of the commit. In [GitLab 15.1](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/89546) and later, job events triggered by blocked users are not processed. Request header: ```plaintext X-Gitlab-Event: Job Hook ``` Payload example: ```json { "object_kind": "build", "ref": "gitlab-script-trigger", "tag": false, "before_sha": "2293ada6b400935a1378653304eaf6221e0fdb8f", "sha": "2293ada6b400935a1378653304eaf6221e0fdb8f", "build_id": 1977, "build_name": "test", "build_stage": "test", "build_status": "created", "build_created_at": "2021-02-23T02:41:37.886Z", "build_created_at_iso": "2021-02-23T02:41:37Z", "build_started_at": null, "build_started_at_iso": null, "build_finished_at": null, "build_finished_at_iso": null, "build_duration": null, "build_queued_duration": 1095.588715, // duration in seconds "build_allow_failure": false, "build_failure_reason": "script_failure", "retries_count": 2, // the second retry of this job "pipeline_id": 2366, "project_id": 380, "project_name": "gitlab-org/gitlab-test", "user": { "id": 3, "name": "User", "email": "user@gitlab.com", "avatar_url": "http://www.gravatar.com/avatar/e32bd13e2add097461cb96824b7a829c?s=80\u0026d=identicon" }, "commit": { "id": 2366, "name": "Build pipeline", "sha": "2293ada6b400935a1378653304eaf6221e0fdb8f", "message": "test\n", "author_name": "User", "author_email": "user@gitlab.com", "status": "created", "duration": null, "started_at": null, "started_at_iso": null, "finished_at": null, "finished_at_iso": null }, "repository": { "name": "gitlab_test", "description": "Atque in sunt eos similique dolores voluptatem.", "homepage": "http://192.168.64.1:3005/gitlab-org/gitlab-test", "git_ssh_url": "git@192.168.64.1:gitlab-org/gitlab-test.git", "git_http_url": "http://192.168.64.1:3005/gitlab-org/gitlab-test.git", "visibility_level": 20 }, "project":{ "id": 380, "name": "Gitlab Test", "description": "Atque in sunt eos similique dolores voluptatem.", "web_url": "http://192.168.64.1:3005/gitlab-org/gitlab-test", "avatar_url": null, "git_ssh_url": "git@192.168.64.1:gitlab-org/gitlab-test.git", "git_http_url": "http://192.168.64.1:3005/gitlab-org/gitlab-test.git", "namespace": "Gitlab Org", "visibility_level": 20, "path_with_namespace": "gitlab-org/gitlab-test", "default_branch": "master" }, "runner": { "active": true, "runner_type": "project_type", "is_shared": false, "id": 380987, "description": "shared-runners-manager-6.gitlab.com", "tags": [ "linux", "docker" ] }, "environment": null, "source_pipeline":{ "project":{ "id": 41, "web_url": "https://gitlab.example.com/gitlab-org/upstream-project", "path_with_namespace": "gitlab-org/upstream-project" }, "pipeline_id": 30, "job_id": 3401 }, } ``` ### Number of retries {{< history >}} - `retries_count` [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/382046) in GitLab 15.6 [with a flag](../../../administration/feature_flags/_index.md) named `job_webhook_retries_count`. Disabled by default. - `retries_count` [enabled on GitLab Self-Managed](https://gitlab.com/gitlab-org/gitlab/-/issues/382046) in GitLab 16.2. {{< /history >}} `retries_count` is an integer that indicates if the job is a retry. `0` means that the job has not been retried. `1` means that it's the first retry. ### Pipeline name {{< history >}} - `commit.name` [introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/107963) in GitLab 15.8. {{< /history >}} You can set custom names for pipelines with [`workflow:name`](../../../ci/yaml/_index.md#workflowname). If the pipeline has a name, that name is the value of `commit.name`. ## Deployment events Deployment events are triggered when a deployment: - Starts - Succeeds - Fails - Is canceled The `deployable_id` and `deployable_url` in the payload represent a CI/CD job that executed the deployment. When the deployment event occurs by [API](../../../ci/environments/external_deployment_tools.md) or [`trigger` jobs](../../../ci/pipelines/downstream_pipelines.md), `deployable_url` is `null`. Request header: ```plaintext X-Gitlab-Event: Deployment Hook ``` Payload example: ```json { "object_kind": "deployment", "status": "success", "status_changed_at":"2021-04-28 21:50:00 +0200", "deployment_id": 15, "deployable_id": 796, "deployable_url": "http://10.126.0.2:3000/root/test-deployment-webhooks/-/jobs/796", "environment": "staging", "environment_tier": "staging", "environment_slug": "staging", "environment_external_url": "https://staging.example.com", "project": { "id": 30, "name": "test-deployment-webhooks", "description": "", "web_url": "http://10.126.0.2:3000/root/test-deployment-webhooks", "avatar_url": null, "git_ssh_url": "ssh://vlad@10.126.0.2:2222/root/test-deployment-webhooks.git", "git_http_url": "http://10.126.0.2:3000/root/test-deployment-webhooks.git", "namespace": "Administrator", "visibility_level": 0, "path_with_namespace": "root/test-deployment-webhooks", "default_branch": "master", "ci_config_path": "", "homepage": "http://10.126.0.2:3000/root/test-deployment-webhooks", "url": "ssh://vlad@10.126.0.2:2222/root/test-deployment-webhooks.git", "ssh_url": "ssh://vlad@10.126.0.2:2222/root/test-deployment-webhooks.git", "http_url": "http://10.126.0.2:3000/root/test-deployment-webhooks.git" }, "short_sha": "279484c0", "user": { "id": 1, "name": "Administrator", "username": "root", "avatar_url": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", "email": "admin@example.com" }, "user_url": "http://10.126.0.2:3000/root", "commit_url": "http://10.126.0.2:3000/root/test-deployment-webhooks/-/commit/279484c09fbe69ededfced8c1bb6e6d24616b468", "commit_title": "Add new file" } ``` ## Group member events {{< details >}} - Tier: Premium, Ultimate {{< /details >}} {{< history >}} - Access request events [introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/163094) in GitLab 17.4. {{< /history >}} These events are triggered for [group webhooks](webhooks.md#group-webhooks) only. Member events are triggered when: - A user is added as a group member. - The access level of a user changes. - The expiration date for user access is updated. - A user is removed from the group. - A user requests access to the group. - An access request is denied. ### Add member to group Request header: ```plaintext X-Gitlab-Event: Member Hook ``` Payload example: ```json { "created_at": "2020-12-11T04:57:22Z", "updated_at": "2020-12-11T04:57:22Z", "group_name": "webhook-test", "group_path": "webhook-test", "group_id": 100, "user_username": "test_user", "user_name": "Test User", "user_email": "testuser@webhooktest.com", "user_id": 64, "group_access": "Guest", "group_plan": null, "expires_at": "2020-12-14T00:00:00Z", "event_name": "user_add_to_group" } ``` ### Update member access level or expiration date Request header: ```plaintext X-Gitlab-Event: Member Hook ``` Payload example: ```json { "created_at": "2020-12-11T04:57:22Z", "updated_at": "2020-12-12T08:48:19Z", "group_name": "webhook-test", "group_path": "webhook-test", "group_id": 100, "user_username": "test_user", "user_name": "Test User", "user_email": "testuser@webhooktest.com", "user_id": 64, "group_access": "Developer", "group_plan": null, "expires_at": "2020-12-20T00:00:00Z", "event_name": "user_update_for_group" } ``` ### Remove member from group Request header: ```plaintext X-Gitlab-Event: Member Hook ``` Payload example: ```json { "created_at": "2020-12-11T04:57:22Z", "updated_at": "2020-12-12T08:52:34Z", "group_name": "webhook-test", "group_path": "webhook-test", "group_id": 100, "user_username": "test_user", "user_name": "Test User", "user_email": "testuser@webhooktest.com", "user_id": 64, "group_access": "Guest", "group_plan": null, "expires_at": "2020-12-14T00:00:00Z", "event_name": "user_remove_from_group" } ``` ### A user requests access {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/163094) in GitLab 17.4 [with a flag](../../../administration/feature_flags/_index.md) named `group_access_request_webhooks`. Disabled by default. - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/issues/479877) in GitLab 17.5. Feature flag `group_access_request_webhooks` removed. {{< /history >}} Request header: ```plaintext X-Gitlab-Event: Member Hook ``` Payload example: ```json { "created_at": "2020-12-11T04:57:22Z", "updated_at": "2020-12-12T08:52:34Z", "group_name": "webhook-test", "group_path": "webhook-test", "group_id": 100, "user_username": "test_user", "user_name": "Test User", "user_email": "testuser@webhooktest.com", "user_id": 64, "group_access": "Guest", "group_plan": null, "expires_at": "2020-12-14T00:00:00Z", "event_name": "user_access_request_to_group" } ``` ### An access request is denied {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/163094) in GitLab 17.4 [with a flag](../../../administration/feature_flags/_index.md) named `group_access_request_webhooks`. Disabled by default. - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/issues/479877) in GitLab 17.5. Feature flag `group_access_request_webhooks` removed. {{< /history >}} Request header: ```plaintext X-Gitlab-Event: Member Hook ``` Payload example: ```json { "created_at": "2020-12-11T04:57:22Z", "updated_at": "2020-12-12T08:52:34Z", "group_name": "webhook-test", "group_path": "webhook-test", "group_id": 100, "user_username": "test_user", "user_name": "Test User", "user_email": "testuser@webhooktest.com", "user_id": 64, "group_access": "Guest", "group_plan": null, "expires_at": "2020-12-14T00:00:00Z", "event_name": "user_access_request_denied_for_group" } ``` ## Project events {{< details >}} - Tier: Premium, Ultimate {{< /details >}} {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/359044) in GitLab 17.6. {{< /history >}} These events are triggered for [group webhooks](webhooks.md#group-webhooks) only. Project events are triggered when: - A [project is created in a group](#create-a-project-in-a-group). - A [project is deleted in a group](#delete-a-project-in-a-group). ### Create a project in a group Request header: ```plaintext X-Gitlab-Event: Project Hook ``` Payload example: ```json { "event_name": "project_create", "created_at": "2024-10-07T10:43:48Z", "updated_at": "2024-10-07T10:43:48Z", "name": "project1", "path": "project1", "path_with_namespace": "group1/project1", "project_id": 22, "project_namespace_id": 32, "owners": [{ "name": "John", "email": "user1@example.com" }], "project_visibility": "private" } ``` ### Delete a project in a group Request header: ```plaintext X-Gitlab-Event: Project Hook ``` Payload example: ```json { "event_name": "project_destroy", "created_at": "2024-10-07T10:43:48Z", "updated_at": "2024-10-07T10:43:48Z", "name": "project1", "path": "project1", "path_with_namespace": "group1/project1", "project_id": 22, "project_namespace_id": 32, "owners": [{ "name": "John", "email": "user1@example.com" }], "project_visibility": "private" } ``` ## Subgroup events {{< details >}} - Tier: Premium, Ultimate {{< /details >}} These events are triggered for [group webhooks](webhooks.md#group-webhooks) only. Subgroup events are triggered when: - A [subgroup is created in a group](#create-a-subgroup-in-a-group). - A [subgroup is removed from a group](#remove-a-subgroup-from-a-group). ### Create a subgroup in a group Request header: ```plaintext X-Gitlab-Event: Subgroup Hook ``` Payload example: ```json { "created_at": "2021-01-20T09:40:12Z", "updated_at": "2021-01-20T09:40:12Z", "event_name": "subgroup_create", "name": "subgroup1", "path": "subgroup1", "full_path": "group1/subgroup1", "group_id": 10, "parent_group_id": 7, "parent_name": "group1", "parent_path": "group1", "parent_full_path": "group1" } ``` ### Remove a subgroup from a group This webhook is not triggered when a [subgroup is transferred to a new parent group](../../group/manage.md#transfer-a-group). Request header: ```plaintext X-Gitlab-Event: Subgroup Hook ``` Payload example: ```json { "created_at": "2021-01-20T09:40:12Z", "updated_at": "2021-01-20T09:40:12Z", "event_name": "subgroup_destroy", "name": "subgroup1", "path": "subgroup1", "full_path": "group1/subgroup1", "group_id": 10, "parent_group_id": 7, "parent_name": "group1", "parent_path": "group1", "parent_full_path": "group1" } ``` ## Feature flag events Feature flag events are triggered when a feature flag is turned on or off. Request header: ```plaintext X-Gitlab-Event: Feature Flag Hook ``` Payload example: ```json { "object_kind": "feature_flag", "project": { "id": 1, "name":"Gitlab Test", "description":"Aut reprehenderit ut est.", "web_url":"http://example.com/gitlabhq/gitlab-test", "avatar_url":null, "git_ssh_url":"git@example.com:gitlabhq/gitlab-test.git", "git_http_url":"http://example.com/gitlabhq/gitlab-test.git", "namespace":"GitlabHQ", "visibility_level":20, "path_with_namespace":"gitlabhq/gitlab-test", "default_branch":"master", "ci_config_path": null, "homepage":"http://example.com/gitlabhq/gitlab-test", "url":"http://example.com/gitlabhq/gitlab-test.git", "ssh_url":"git@example.com:gitlabhq/gitlab-test.git", "http_url":"http://example.com/gitlabhq/gitlab-test.git" }, "user": { "id": 1, "name": "Administrator", "username": "root", "avatar_url": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", "email": "admin@example.com" }, "user_url": "http://example.com/root", "object_attributes": { "id": 6, "name": "test-feature-flag", "description": "test-feature-flag-description", "active": true } } ``` ## Release events {{< history >}} - Delete release event [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/418113) in GitLab 16.5. {{< /history >}} Release events are triggered when a release is created, updated, or deleted. The available values for `object_attributes.action` in the payload are: - `create` - `update` - `delete` Request header: ```plaintext X-Gitlab-Event: Release Hook ``` Payload example: ```json { "id": 1, "created_at": "2020-11-02 12:55:12 UTC", "description": "v1.1 has been released", "name": "v1.1", "released_at": "2020-11-02 12:55:12 UTC", "tag": "v1.1", "object_kind": "release", "project": { "id": 2, "name": "release-webhook-example", "description": "", "web_url": "https://example.com/gitlab-org/release-webhook-example", "avatar_url": null, "git_ssh_url": "ssh://git@example.com/gitlab-org/release-webhook-example.git", "git_http_url": "https://example.com/gitlab-org/release-webhook-example.git", "namespace": "Gitlab", "visibility_level": 0, "path_with_namespace": "gitlab-org/release-webhook-example", "default_branch": "master", "ci_config_path": null, "homepage": "https://example.com/gitlab-org/release-webhook-example", "url": "ssh://git@example.com/gitlab-org/release-webhook-example.git", "ssh_url": "ssh://git@example.com/gitlab-org/release-webhook-example.git", "http_url": "https://example.com/gitlab-org/release-webhook-example.git" }, "url": "https://example.com/gitlab-org/release-webhook-example/-/releases/v1.1", "action": "create", "assets": { "count": 5, "links": [ { "id": 1, "external": true, // deprecated in GitLab 15.9, will be removed in GitLab 16.0. "link_type": "other", "name": "Changelog", "url": "https://example.net/changelog" } ], "sources": [ { "format": "zip", "url": "https://example.com/gitlab-org/release-webhook-example/-/archive/v1.1/release-webhook-example-v1.1.zip" }, { "format": "tar.gz", "url": "https://example.com/gitlab-org/release-webhook-example/-/archive/v1.1/release-webhook-example-v1.1.tar.gz" }, { "format": "tar.bz2", "url": "https://example.com/gitlab-org/release-webhook-example/-/archive/v1.1/release-webhook-example-v1.1.tar.bz2" }, { "format": "tar", "url": "https://example.com/gitlab-org/release-webhook-example/-/archive/v1.1/release-webhook-example-v1.1.tar" } ] }, "commit": { "id": "ee0a3fb31ac16e11b9dbb596ad16d4af654d08f8", "message": "Release v1.1", "title": "Release v1.1", "timestamp": "2020-10-31T14:58:32+11:00", "url": "https://example.com/gitlab-org/release-webhook-example/-/commit/ee0a3fb31ac16e11b9dbb596ad16d4af654d08f8", "author": { "name": "Example User", "email": "user@example.com" } } } ``` ## Milestone events {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/14213) in GitLab 18.2. {{< /history >}} Milestone events are triggered when a milestone is created, closed, reopened, or deleted. The available values for `object_attributes.action` in the payload are: - `create` - `close` - `reopen` Request header: ```plaintext X-Gitlab-Event: Milestone Hook ``` Payload example: ```json { "object_kind": "milestone", "event_type": "milestone", "project": { "id": 1, "name": "Gitlab Test", "description": "Aut reprehenderit ut est.", "web_url": "http://example.com/gitlabhq/gitlab-test", "avatar_url": null, "git_ssh_url": "git@example.com:gitlabhq/gitlab-test.git", "git_http_url": "http://example.com/gitlabhq/gitlab-test.git", "namespace": "GitlabHQ", "visibility_level": 20, "path_with_namespace": "gitlabhq/gitlab-test", "default_branch": "master", "ci_config_path": null, "homepage": "http://example.com/gitlabhq/gitlab-test", "url": "http://example.com/gitlabhq/gitlab-test.git", "ssh_url": "git@example.com:gitlabhq/gitlab-test.git", "http_url": "http://example.com/gitlabhq/gitlab-test.git" }, "object_attributes": { "id": 61, "iid": 10, "title": "v1.0", "description": "First stable release", "state": "active", "created_at": "2025-06-16 14:10:57 UTC", "updated_at": "2025-06-16 14:10:57 UTC", "due_date": "2025-06-30", "start_date": "2025-06-16", "group_id": null, "project_id": 1 }, "action": "create" } ``` ## Emoji events {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/123952) in GitLab 16.2 [with a flag](../../../administration/feature_flags/_index.md) named `emoji_webhooks`. Disabled by default. - [Enabled on GitLab.com](https://gitlab.com/gitlab-org/gitlab/-/issues/417288) in GitLab 16.3. - [Enabled by default](https://gitlab.com/gitlab-org/gitlab/-/issues/417288) in GitLab 16.4. - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/issues/417288) in GitLab 17.5. Feature flag `emoji_webhooks` removed. {{< /history >}} An emoji event is triggered when an [emoji reaction](../../emoji_reactions.md) is added or removed on: - Issues - Merge requests - Project snippets - Comments on: - Issues - Merge requests - Project snippets - Commits The available values for `object_attributes.action` in the payload are: - `award` to add a reaction - `revoke` to remove a reaction Request header: ```plaintext X-Gitlab-Event: Emoji Hook ``` Payload example: ```json { "object_kind": "emoji", "event_type": "award", "user": { "id": 1, "name": "Blake Bergstrom", "username": "root", "avatar_url": "http://example.com/uploads/-/system/user/avatar/1/avatar.png", "email": "[REDACTED]" }, "project_id": 6, "project": { "id": 6, "name": "Flight", "description": "Velit fugit aperiam illum deleniti odio sequi.", "web_url": "http://example.com/flightjs/Flight", "avatar_url": null, "git_ssh_url": "ssh://git@example.com/flightjs/Flight.git", "git_http_url": "http://example.com/flightjs/Flight.git", "namespace": "Flightjs", "visibility_level": 20, "path_with_namespace": "flightjs/Flight", "default_branch": "master", "ci_config_path": null, "homepage": "http://example.com/flightjs/Flight", "url": "ssh://git@example.com/flightjs/Flight.git", "ssh_url": "ssh://git@example.com/flightjs/Flight.git", "http_url": "http://example.com/flightjs/Flight.git" }, "object_attributes": { "user_id": 1, "created_at": "2023-07-04 20:44:11 UTC", "id": 1, "name": "thumbsup", "awardable_type": "Note", "awardable_id": 363, "updated_at": "2023-07-04 20:44:11 UTC", "action": "award", "awarded_on_url": "http://example.com/flightjs/Flight/-/issues/42#note_363" }, "note": { "attachment": null, "author_id": 1, "change_position": null, "commit_id": null, "created_at": "2023-07-04 15:09:55 UTC", "discussion_id": "c3d97fd471f210a5dc8b97a409e3bea95ee06c14", "id": 363, "line_code": null, "note": "Testing 123", "noteable_id": 635, "noteable_type": "Issue", "original_position": null, "position": null, "project_id": 6, "resolved_at": null, "resolved_by_id": null, "resolved_by_push": null, "st_diff": null, "system": false, "type": null, "updated_at": "2023-07-04 19:58:46 UTC", "updated_by_id": null, "description": "Testing 123", "url": "http://example.com/flightjs/Flight/-/issues/42#note_363" }, "issue": { "author_id": 1, "closed_at": null, "confidential": false, "created_at": "2023-07-04 14:59:43 UTC", "description": "Issue description!", "discussion_locked": null, "due_date": null, "id": 635, "iid": 42, "last_edited_at": null, "last_edited_by_id": null, "milestone_id": null, "moved_to_id": null, "duplicated_to_id": null, "project_id": 6, "relative_position": 18981, "state_id": 1, "time_estimate": 0, "title": "New issue!", "updated_at": "2023-07-04 15:09:55 UTC", "updated_by_id": null, "weight": null, "health_status": null, "url": "http://example.com/flightjs/Flight/-/issues/42", "total_time_spent": 0, "time_change": 0, "human_total_time_spent": null, "human_time_change": null, "human_time_estimate": null, "assignee_ids": [ 1 ], "assignee_id": 1, "labels": [ ], "state": "opened", "severity": "unknown" } } ``` ## Project and group access token events {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/141907) in GitLab 16.10 [with a flag](../../../administration/feature_flags/_index.md) named `access_token_webhooks`. Disabled by default. - [Enabled on GitLab.com](https://gitlab.com/gitlab-org/gitlab/-/issues/439379) in GitLab 16.11. - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/issues/454642) in GitLab 16.11. Feature flag `access_token_webhooks` removed. - `full_path` attribute [added](https://gitlab.com/gitlab-org/gitlab/-/issues/465421) in GitLab 17.4. - 60 and 30 day notifications [generally available](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/173792) in GitLab 17.7. {{< /history >}} Access token expiry events trigger before an [access tokens](../../../security/tokens/_index.md) expires. These events trigger: - One day before the token expires - Seven days before the token expires - 30 days before the token expires, if the feature is enabled. - 60 days before the token expires, if the feature is enabled. The available values for `event_name` in the payload are: - `expiring_access_token` Request header: ```plaintext X-Gitlab-Event: Resource Access Token Hook ``` Payload example for project: ```json { "object_kind": "access_token", "project": { "id": 7, "name": "Flight", "description": "Eum dolore maxime atque reprehenderit voluptatem.", "web_url": "https://example.com/flightjs/Flight", "avatar_url": null, "git_ssh_url": "ssh://git@example.com/flightjs/Flight.git", "git_http_url": "https://example.com/flightjs/Flight.git", "namespace": "Flightjs", "visibility_level": 0, "path_with_namespace": "flightjs/Flight", "default_branch": "master", "ci_config_path": null, "homepage": "https://example.com/flightjs/Flight", "url": "ssh://git@example.com/flightjs/Flight.git", "ssh_url": "ssh://git@example.com/flightjs/Flight.git", "http_url": "https://example.com/flightjs/Flight.git" }, "object_attributes": { "user_id": 90, "created_at": "2024-01-24 16:27:40 UTC", "id": 25, "name": "acd", "expires_at": "2024-01-26" }, "event_name": "expiring_access_token" } ``` Payload example for group: ```json { "object_kind": "access_token", "group": { "group_name": "Twitter", "group_path": "twitter", "group_id": 35, "full_path": "twitter" }, "object_attributes": { "user_id": 90, "created_at": "2024-01-24 16:27:40 UTC", "id": 25, "name": "acd", "expires_at": "2024-01-26" }, "event_name": "expiring_access_token" } ``` ## Vulnerability events {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/169701) in GitLab 17.7 [with a flag](../../../administration/feature_flags/_index.md) named `vulnerabilities_as_webhook_events`. Disabled by default. - Creating an event when a vulnerability is created or when an issue is linked to a vulnerability [introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/176064) in GitLab 17.8. - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/issues/528397) in GitLab 17.11. Feature flag `vulnerabilities_as_webhook_events` removed. {{< /history >}} A vulnerability event is triggered when: - A vulnerability is created. - A vulnerability's [status is changed](../../application_security/vulnerabilities/_index.md#vulnerability-status-values). - An issue is linked to a vulnerability. Request header: ```plaintext X-Gitlab-Event: Vulnerability Hook ``` Payload example: ```json { "object_kind": "vulnerability", "object_attributes": { "url": "https://example.com/flightjs/Flight/-/security/vulnerabilities/1", "title": "REXML DoS vulnerability", "state": "confirmed", "project_id": 50, "location": { "file": "Gemfile.lock", "dependency": { "package": { "name": "rexml" }, "version": "3.3.1" } }, "cvss": [ { "vector": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H", "vendor": "NVD" } ], "severity": "high", "severity_overridden": false, "identifiers": [ { "name": "Gemnasium-29dce398-220a-4315-8c84-16cd8b6d9b05", "external_id": "29dce398-220a-4315-8c84-16cd8b6d9b05", "external_type": "gemnasium", "url": "https://gitlab.com/gitlab-org/security-products/gemnasium-db/-/blob/master/gem/rexml/CVE-2024-41123.yml" }, { "name": "CVE-2024-41123", "external_id": "CVE-2024-41123", "external_type": "cve", "url": "https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2024-41123" } ], "issues": [ { "title": "REXML ReDoS vulnerability", "url": "https://example.com/flightjs/Flight/-/issues/1", "created_at": "2025-01-08T00:46:14.429Z", "updated_at": "2025-01-08T00:46:14.429Z" } ], "report_type": "dependency_scanning", "confidence": "unknown", "confidence_overridden": false, "confirmed_at": "2025-01-08T00:46:14.413Z", "confirmed_by_id": 1, "dismissed_at": null, "dismissed_by_id": null, "resolved_on_default_branch": false, "created_at": "2025-01-08T00:46:14.413Z", "updated_at": "2025-01-08T00:46:14.413Z" } } ```
--- stage: Create group: Import info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments title: Webhook events description: List of GitLab webhook events and payloads. Includes JSON examples. breadcrumbs: - doc - user - project - integrations --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} Connect GitLab to your external applications and automate your workflow with webhooks. When specific events occur in GitLab, webhooks send HTTP POST requests with detailed information to your configured endpoints. Build automated processes that react to code changes, deployments, comments, and other activities without manual intervention. This page lists the events that are triggered for [project webhooks](webhooks.md) and [group webhooks](webhooks.md#group-webhooks). For a list of events triggered for system webhooks, see [system webhooks](../../../administration/system_hooks.md). ## Events triggered for both project and group webhooks Event type | Trigger ---------------------------------------------|----------------------------------------------------------------------------- [Push event](#push-events) | A push is made to the repository. [Tag event](#tag-events) | Tags are created or deleted in the repository. [Work item event](#work-item-events) | A new work item is created or an existing one is edited, closed, or reopened. [Comment event](#comment-events) | A new comment is made or edited on commits, merge requests, issues, and code snippets. <sup>1</sup> [Merge request event](#merge-request-events) | A merge request is created, edited, merged, or closed, or a commit is added in the source branch. [Wiki page event](#wiki-page-events) | A wiki page is created, edited, or deleted. [Pipeline event](#pipeline-events) | A pipeline status changes. [Job event](#job-events) | A job status changes. [Deployment event](#deployment-events) | A deployment starts, succeeds, fails, or is canceled. [Feature flag event](#feature-flag-events) | A feature flag is turned on or off. [Release event](#release-events) | A release is created, edited, or deleted. [Milestone event](#milestone-events) | A milestone is created, closed, reopened, or deleted. [Emoji event](#emoji-events) | An emoji reaction is added or removed. [Project or group access token event](#project-and-group-access-token-events) | A project or group access token will expire in seven days. [Vulnerability event](#vulnerability-events) | A vulnerability is created or updated. **Footnotes**: 1. Comment events triggered when the comment is edited [introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/127169) in GitLab 16.11. ## Events triggered for group webhooks only Event type | Trigger ---------------------------------------------|----------------------------------------------------------------------------- [Group member event](#group-member-events) | A user is added or removed from a group, or a user's access level or access expiration date changes. [Project event](#project-events) | A project is created or deleted in a group. [Subgroup event](#subgroup-events) | A subgroup is created or removed from a group. {{< alert type="note" >}} If an author has no public email listed in their [GitLab profile](https://gitlab.com/-/user_settings/profile), the `email` attribute in the webhook payload displays a value of `[REDACTED]`. {{< /alert >}} ## Push events Push events are triggered when you push to the repository, except when: - You push tags. - A single push includes changes for more than three branches by default (depending on the [`push_event_hooks_limit` setting](../../../api/settings.md#available-settings)). If you push more than 20 commits at once, the `commits` attribute in the payload contains information about the newest 20 commits only. Loading detailed commit data is expensive, so this restriction exists for performance reasons. The `total_commits_count` attribute contains the actual number of commits. If you create and push a branch without any new commits, the `commits` attribute in the payload is empty. Request header: ```plaintext X-Gitlab-Event: Push Hook ``` Payload example: ```json { "object_kind": "push", "event_name": "push", "before": "95790bf891e76fee5e1747ab589903a6a1f80f22", "after": "da1560886d4f094c3e6c9ef40349f7d38b5d27d7", "ref": "refs/heads/master", "ref_protected": true, "checkout_sha": "da1560886d4f094c3e6c9ef40349f7d38b5d27d7", "user_id": 4, "user_name": "John Smith", "user_username": "jsmith", "user_email": "john@example.com", "user_avatar": "https://s.gravatar.com/avatar/d4c74594d841139328695756648b6bd6?s=8://s.gravatar.com/avatar/d4c74594d841139328695756648b6bd6?s=80", "project_id": 15, "project":{ "id": 15, "name":"Diaspora", "description":"", "web_url":"http://example.com/mike/diaspora", "avatar_url":null, "git_ssh_url":"git@example.com:mike/diaspora.git", "git_http_url":"http://example.com/mike/diaspora.git", "namespace":"Mike", "visibility_level":0, "path_with_namespace":"mike/diaspora", "default_branch":"master", "homepage":"http://example.com/mike/diaspora", "url":"git@example.com:mike/diaspora.git", "ssh_url":"git@example.com:mike/diaspora.git", "http_url":"http://example.com/mike/diaspora.git" }, "repository":{ "name": "Diaspora", "url": "git@example.com:mike/diaspora.git", "description": "", "homepage": "http://example.com/mike/diaspora", "git_http_url":"http://example.com/mike/diaspora.git", "git_ssh_url":"git@example.com:mike/diaspora.git", "visibility_level":0 }, "commits": [ { "id": "b6568db1bc1dcd7f8b4d5a946b0b91f9dacd7327", "message": "Update Catalan translation to e38cb41.\n\nSee https://gitlab.com/gitlab-org/gitlab for more information", "title": "Update Catalan translation to e38cb41.", "timestamp": "2011-12-12T14:27:31+02:00", "url": "http://example.com/mike/diaspora/commit/b6568db1bc1dcd7f8b4d5a946b0b91f9dacd7327", "author": { "name": "Jordi Mallach", "email": "jordi@softcatala.org" }, "added": ["CHANGELOG"], "modified": ["app/controller/application.rb"], "removed": [] }, { "id": "da1560886d4f094c3e6c9ef40349f7d38b5d27d7", "message": "fixed readme", "title": "fixed readme", "timestamp": "2012-01-03T23:36:29+02:00", "url": "http://example.com/mike/diaspora/commit/da1560886d4f094c3e6c9ef40349f7d38b5d27d7", "author": { "name": "GitLab dev user", "email": "gitlabdev@dv6700.(none)" }, "added": ["CHANGELOG"], "modified": ["app/controller/application.rb"], "removed": [] } ], "total_commits_count": 4 } ``` ## Tag events Tag events are triggered when you create or delete tags in the repository. This hook is not executed if a single push includes changes for more than three tags by default (depending on the [`push_event_hooks_limit` setting](../../../api/settings.md#available-settings)). Request header: ```plaintext X-Gitlab-Event: Tag Push Hook ``` Payload example: ```json { "object_kind": "tag_push", "event_name": "tag_push", "before": "0000000000000000000000000000000000000000", "after": "82b3d5ae55f7080f1e6022629cdb57bfae7cccc7", "ref": "refs/tags/v1.0.0", "ref_protected": true, "checkout_sha": "82b3d5ae55f7080f1e6022629cdb57bfae7cccc7", "user_id": 1, "user_name": "John Smith", "user_avatar": "https://s.gravatar.com/avatar/d4c74594d841139328695756648b6bd6?s=8://s.gravatar.com/avatar/d4c74594d841139328695756648b6bd6?s=80", "project_id": 1, "project":{ "id": 1, "name":"Example", "description":"", "web_url":"http://example.com/jsmith/example", "avatar_url":null, "git_ssh_url":"git@example.com:jsmith/example.git", "git_http_url":"http://example.com/jsmith/example.git", "namespace":"Jsmith", "visibility_level":0, "path_with_namespace":"jsmith/example", "default_branch":"master", "homepage":"http://example.com/jsmith/example", "url":"git@example.com:jsmith/example.git", "ssh_url":"git@example.com:jsmith/example.git", "http_url":"http://example.com/jsmith/example.git" }, "repository":{ "name": "Example", "url": "ssh://git@example.com/jsmith/example.git", "description": "", "homepage": "http://example.com/jsmith/example", "git_http_url":"http://example.com/jsmith/example.git", "git_ssh_url":"git@example.com:jsmith/example.git", "visibility_level":0 }, "commits": [], "total_commits_count": 0 } ``` ## Work item events {{< history >}} - `type` attribute in `object_attributes` [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/467415) in GitLab 17.2. - Support for epics [introduced](https://gitlab.com/groups/gitlab-org/-/epics/13056) in GitLab 17.3. [The new look for epics](../../group/epics/_index.md#epics-as-work-items) must be enabled. - Support for epics [generally available](https://gitlab.com/gitlab-org/gitlab/-/issues/468310) in GitLab 18.1. {{< /history >}} Work item events are triggered when a work item is created, edited, closed, or reopened. The supported work item types are: - [Epics](../../group/epics/_index.md) - [Issue](../issues/_index.md) - [Tasks](../../tasks.md) - [Incidents](../../../operations/incident_management/incidents.md) - [Test cases](../../../ci/test_cases/_index.md) - [Requirements](../requirements/_index.md) - [Objectives and key results (OKRs)](../../okrs.md) For issues and [Service Desk](../service_desk/_index.md) issues, the `object_kind` is `issue`, and the `type` is `Issue`. For all other work items, the `object_kind` field is `work_item`, and the `type` is the work item type. For work item type `Epic`, to get events for changes, the webhook must be registered for the group. The available values for `object_attributes.action` in the payload are: - `open` - `close` - `reopen` - `update` The `assignee` and `assignee_id` keys are deprecated and contain the first assignee only. The `escalation_status` and `escalation_policy` fields are only available for issue types which [support escalations](../../../operations/incident_management/paging.md#paging), such as incidents. Request header: ```plaintext X-Gitlab-Event: Issue Hook ``` Payload example: ```json { "object_kind": "issue", "event_type": "issue", "user": { "id": 1, "name": "Administrator", "username": "root", "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40\u0026d=identicon", "email": "admin@example.com" }, "project": { "id": 1, "name":"Gitlab Test", "description":"Aut reprehenderit ut est.", "web_url":"http://example.com/gitlabhq/gitlab-test", "avatar_url":null, "git_ssh_url":"git@example.com:gitlabhq/gitlab-test.git", "git_http_url":"http://example.com/gitlabhq/gitlab-test.git", "namespace":"GitlabHQ", "visibility_level":20, "path_with_namespace":"gitlabhq/gitlab-test", "default_branch":"master", "ci_config_path": null, "homepage":"http://example.com/gitlabhq/gitlab-test", "url":"http://example.com/gitlabhq/gitlab-test.git", "ssh_url":"git@example.com:gitlabhq/gitlab-test.git", "http_url":"http://example.com/gitlabhq/gitlab-test.git" }, "object_attributes": { "id": 301, "title": "New API: create/update/delete file", "assignee_ids": [51], "assignee_id": 51, "author_id": 51, "project_id": 14, "created_at": "2013-12-03T17:15:43Z", "updated_at": "2013-12-03T17:15:43Z", "updated_by_id": 1, "last_edited_at": null, "last_edited_by_id": null, "relative_position": 0, "description": "Create new API for manipulations with repository", "milestone_id": null, "state_id": 1, "confidential": false, "discussion_locked": true, "due_date": null, "moved_to_id": null, "duplicated_to_id": null, "time_estimate": 0, "total_time_spent": 0, "time_change": 0, "human_total_time_spent": null, "human_time_estimate": null, "human_time_change": null, "weight": null, "health_status": "at_risk", "type": "Issue", "iid": 23, "url": "http://example.com/diaspora/issues/23", "state": "opened", "action": "open", "severity": "high", "escalation_status": "triggered", "escalation_policy": { "id": 18, "name": "Engineering On-call" }, "labels": [{ "id": 206, "title": "API", "color": "#ffffff", "project_id": 14, "created_at": "2013-12-03T17:15:43Z", "updated_at": "2013-12-03T17:15:43Z", "template": false, "description": "API related issues", "type": "ProjectLabel", "group_id": 41 }] }, "repository": { "name": "Gitlab Test", "url": "http://example.com/gitlabhq/gitlab-test.git", "description": "Aut reprehenderit ut est.", "homepage": "http://example.com/gitlabhq/gitlab-test" }, "assignees": [{ "name": "User1", "username": "user1", "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40\u0026d=identicon" }], "assignee": { "name": "User1", "username": "user1", "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40\u0026d=identicon" }, "labels": [{ "id": 206, "title": "API", "color": "#ffffff", "project_id": 14, "created_at": "2013-12-03T17:15:43Z", "updated_at": "2013-12-03T17:15:43Z", "template": false, "description": "API related issues", "type": "ProjectLabel", "group_id": 41 }], "changes": { "updated_by_id": { "previous": null, "current": 1 }, "updated_at": { "previous": "2017-09-15 16:50:55 UTC", "current": "2017-09-15 16:52:00 UTC" }, "labels": { "previous": [{ "id": 206, "title": "API", "color": "#ffffff", "project_id": 14, "created_at": "2013-12-03T17:15:43Z", "updated_at": "2013-12-03T17:15:43Z", "template": false, "description": "API related issues", "type": "ProjectLabel", "group_id": 41 }], "current": [{ "id": 205, "title": "Platform", "color": "#123123", "project_id": 14, "created_at": "2013-12-03T17:15:43Z", "updated_at": "2013-12-03T17:15:43Z", "template": false, "description": "Platform related issues", "type": "ProjectLabel", "group_id": 41 }] } } } ``` ## Comment events {{< history >}} - `object_attributes.action` property [introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/147856) in GitLab 16.11. {{< /history >}} Comment events are triggered when a new comment is made or edited on commits, merge requests, issues, and code snippets. The note data is stored in `object_attributes` (for example, `note` or `noteable_type`). The payload includes information about the target of the comment. For example, a comment on an issue includes specific issue information under the `issue` key. The available target types are: - `commit` - `merge_request` - `issue` - `snippet` The available values for `object_attributes.action` in the payload are: - `create` - `update` ### Comment on a commit Request header: ```plaintext X-Gitlab-Event: Note Hook ``` Payload example: ```json { "object_kind": "note", "event_type": "note", "user": { "id": 1, "name": "Administrator", "username": "root", "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40\u0026d=identicon", "email": "admin@example.com" }, "project_id": 5, "project":{ "id": 5, "name":"Gitlab Test", "description":"Aut reprehenderit ut est.", "web_url":"http://example.com/gitlabhq/gitlab-test", "avatar_url":null, "git_ssh_url":"git@example.com:gitlabhq/gitlab-test.git", "git_http_url":"http://example.com/gitlabhq/gitlab-test.git", "namespace":"GitlabHQ", "visibility_level":20, "path_with_namespace":"gitlabhq/gitlab-test", "default_branch":"master", "homepage":"http://example.com/gitlabhq/gitlab-test", "url":"http://example.com/gitlabhq/gitlab-test.git", "ssh_url":"git@example.com:gitlabhq/gitlab-test.git", "http_url":"http://example.com/gitlabhq/gitlab-test.git" }, "repository":{ "name": "Gitlab Test", "url": "http://example.com/gitlab-org/gitlab-test.git", "description": "Aut reprehenderit ut est.", "homepage": "http://example.com/gitlab-org/gitlab-test" }, "object_attributes": { "id": 1243, "note": "This is a commit comment. How does this work?", "noteable_type": "Commit", "author_id": 1, "created_at": "2015-05-17 18:08:09 UTC", "updated_at": "2015-05-17 18:08:09 UTC", "project_id": 5, "attachment":null, "line_code": "bec9703f7a456cd2b4ab5fb3220ae016e3e394e3_0_1", "commit_id": "cfe32cf61b73a0d5e9f13e774abde7ff789b1660", "noteable_id": null, "system": false, "st_diff": { "diff": "--- /dev/null\n+++ b/six\n@@ -0,0 +1 @@\n+Subproject commit 409f37c4f05865e4fb208c771485f211a22c4c2d\n", "new_path": "six", "old_path": "six", "a_mode": "0", "b_mode": "160000", "new_file": true, "renamed_file": false, "deleted_file": false }, "action": "create", "url": "http://example.com/gitlab-org/gitlab-test/commit/cfe32cf61b73a0d5e9f13e774abde7ff789b1660#note_1243" }, "commit": { "id": "cfe32cf61b73a0d5e9f13e774abde7ff789b1660", "message": "Add submodule\n\nSigned-off-by: Example User \u003cuser@example.com.com\u003e\n", "timestamp": "2014-02-27T10:06:20+02:00", "url": "http://example.com/gitlab-org/gitlab-test/commit/cfe32cf61b73a0d5e9f13e774abde7ff789b1660", "author": { "name": "Example User", "email": "user@example.com" } } } ``` ### Comment on a merge request Request header: ```plaintext X-Gitlab-Event: Note Hook ``` Payload example: ```json { "object_kind": "note", "event_type": "note", "user": { "id": 1, "name": "Administrator", "username": "root", "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40\u0026d=identicon", "email": "admin@example.com" }, "project_id": 5, "project":{ "id": 5, "name":"Gitlab Test", "description":"Aut reprehenderit ut est.", "web_url":"http://example.com/gitlab-org/gitlab-test", "avatar_url":null, "git_ssh_url":"git@example.com:gitlab-org/gitlab-test.git", "git_http_url":"http://example.com/gitlab-org/gitlab-test.git", "namespace":"Gitlab Org", "visibility_level":10, "path_with_namespace":"gitlab-org/gitlab-test", "default_branch":"master", "homepage":"http://example.com/gitlab-org/gitlab-test", "url":"http://example.com/gitlab-org/gitlab-test.git", "ssh_url":"git@example.com:gitlab-org/gitlab-test.git", "http_url":"http://example.com/gitlab-org/gitlab-test.git" }, "repository":{ "name": "Gitlab Test", "url": "http://localhost/gitlab-org/gitlab-test.git", "description": "Aut reprehenderit ut est.", "homepage": "http://example.com/gitlab-org/gitlab-test" }, "object_attributes": { "id": 1244, "note": "This MR needs work.", "noteable_type": "MergeRequest", "author_id": 1, "created_at": "2015-05-17 18:21:36 UTC", "updated_at": "2015-05-17 18:21:36 UTC", "project_id": 5, "attachment": null, "line_code": null, "commit_id": "", "noteable_id": 7, "system": false, "st_diff": null, "action": "create", "url": "http://example.com/gitlab-org/gitlab-test/merge_requests/1#note_1244" }, "merge_request": { "id": 7, "target_branch": "markdown", "source_branch": "master", "source_project_id": 5, "author_id": 8, "assignee_id": 28, "title": "Tempora et eos debitis quae laborum et.", "created_at": "2015-03-01 20:12:53 UTC", "updated_at": "2015-03-21 18:27:27 UTC", "milestone_id": 11, "state": "opened", "merge_status": "cannot_be_merged", "target_project_id": 5, "iid": 1, "description": "Et voluptas corrupti assumenda temporibus. Architecto cum animi eveniet amet asperiores. Vitae numquam voluptate est natus sit et ad id.", "position": 0, "labels": [ { "id": 25, "title": "Afterpod", "color": "#3e8068", "project_id": null, "created_at": "2019-06-05T14:32:20.211Z", "updated_at": "2019-06-05T14:32:20.211Z", "template": false, "description": null, "type": "GroupLabel", "group_id": 4 }, { "id": 86, "title": "Element", "color": "#231afe", "project_id": 4, "created_at": "2019-06-05T14:32:20.637Z", "updated_at": "2019-06-05T14:32:20.637Z", "template": false, "description": null, "type": "ProjectLabel", "group_id": null } ], "source":{ "name":"Gitlab Test", "description":"Aut reprehenderit ut est.", "web_url":"http://example.com/gitlab-org/gitlab-test", "avatar_url":null, "git_ssh_url":"git@example.com:gitlab-org/gitlab-test.git", "git_http_url":"http://example.com/gitlab-org/gitlab-test.git", "namespace":"Gitlab Org", "visibility_level":10, "path_with_namespace":"gitlab-org/gitlab-test", "default_branch":"master", "homepage":"http://example.com/gitlab-org/gitlab-test", "url":"http://example.com/gitlab-org/gitlab-test.git", "ssh_url":"git@example.com:gitlab-org/gitlab-test.git", "http_url":"http://example.com/gitlab-org/gitlab-test.git" }, "target": { "name":"Gitlab Test", "description":"Aut reprehenderit ut est.", "web_url":"http://example.com/gitlab-org/gitlab-test", "avatar_url":null, "git_ssh_url":"git@example.com:gitlab-org/gitlab-test.git", "git_http_url":"http://example.com/gitlab-org/gitlab-test.git", "namespace":"Gitlab Org", "visibility_level":10, "path_with_namespace":"gitlab-org/gitlab-test", "default_branch":"master", "homepage":"http://example.com/gitlab-org/gitlab-test", "url":"http://example.com/gitlab-org/gitlab-test.git", "ssh_url":"git@example.com:gitlab-org/gitlab-test.git", "http_url":"http://example.com/gitlab-org/gitlab-test.git" }, "last_commit": { "id": "562e173be03b8ff2efb05345d12df18815438a4b", "message": "Merge branch 'another-branch' into 'master'\n\nCheck in this test\n", "timestamp": "2015-04-08T21: 00:25-07:00", "url": "http://example.com/gitlab-org/gitlab-test/commit/562e173be03b8ff2efb05345d12df18815438a4b", "author": { "name": "John Smith", "email": "john@example.com" } }, "work_in_progress": false, "draft": false, "assignee": { "name": "User1", "username": "user1", "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40\u0026d=identicon" }, "detailed_merge_status": "checking" } } ``` ### Comment on an issue - The `assignee_id` field is deprecated and shows the first assignee only. - The `event_type` is set to `confidential_note` for confidential issues. Request header: ```plaintext X-Gitlab-Event: Note Hook ``` Payload example: ```json { "object_kind": "note", "event_type": "note", "user": { "id": 1, "name": "Administrator", "username": "root", "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40\u0026d=identicon", "email": "admin@example.com" }, "project_id": 5, "project":{ "id": 5, "name":"Gitlab Test", "description":"Aut reprehenderit ut est.", "web_url":"http://example.com/gitlab-org/gitlab-test", "avatar_url":null, "git_ssh_url":"git@example.com:gitlab-org/gitlab-test.git", "git_http_url":"http://example.com/gitlab-org/gitlab-test.git", "namespace":"Gitlab Org", "visibility_level":10, "path_with_namespace":"gitlab-org/gitlab-test", "default_branch":"master", "homepage":"http://example.com/gitlab-org/gitlab-test", "url":"http://example.com/gitlab-org/gitlab-test.git", "ssh_url":"git@example.com:gitlab-org/gitlab-test.git", "http_url":"http://example.com/gitlab-org/gitlab-test.git" }, "repository":{ "name":"diaspora", "url":"git@example.com:mike/diaspora.git", "description":"", "homepage":"http://example.com/mike/diaspora" }, "object_attributes": { "id": 1241, "note": "Hello world", "noteable_type": "Issue", "author_id": 1, "created_at": "2015-05-17 17:06:40 UTC", "updated_at": "2015-05-17 17:06:40 UTC", "project_id": 5, "attachment": null, "line_code": null, "commit_id": "", "noteable_id": 92, "system": false, "st_diff": null, "action": "create", "url": "http://example.com/gitlab-org/gitlab-test/issues/17#note_1241" }, "issue": { "id": 92, "title": "test", "assignee_ids": [], "assignee_id": null, "author_id": 1, "project_id": 5, "created_at": "2015-04-12 14:53:17 UTC", "updated_at": "2015-04-26 08:28:42 UTC", "position": 0, "branch_name": null, "description": "test", "milestone_id": null, "state": "closed", "iid": 17, "labels": [ { "id": 25, "title": "Afterpod", "color": "#3e8068", "project_id": null, "created_at": "2019-06-05T14:32:20.211Z", "updated_at": "2019-06-05T14:32:20.211Z", "template": false, "description": null, "type": "GroupLabel", "group_id": 4 }, { "id": 86, "title": "Element", "color": "#231afe", "project_id": 4, "created_at": "2019-06-05T14:32:20.637Z", "updated_at": "2019-06-05T14:32:20.637Z", "template": false, "description": null, "type": "ProjectLabel", "group_id": null } ] } } ``` ### Comment on a code snippet Request header: ```plaintext X-Gitlab-Event: Note Hook ``` Payload example: ```json { "object_kind": "note", "event_type": "note", "user": { "id": 1, "name": "Administrator", "username": "root", "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40\u0026d=identicon", "email": "admin@example.com" }, "project_id": 5, "project":{ "id": 5, "name":"Gitlab Test", "description":"Aut reprehenderit ut est.", "web_url":"http://example.com/gitlab-org/gitlab-test", "avatar_url":null, "git_ssh_url":"git@example.com:gitlab-org/gitlab-test.git", "git_http_url":"http://example.com/gitlab-org/gitlab-test.git", "namespace":"Gitlab Org", "visibility_level":10, "path_with_namespace":"gitlab-org/gitlab-test", "default_branch":"master", "homepage":"http://example.com/gitlab-org/gitlab-test", "url":"http://example.com/gitlab-org/gitlab-test.git", "ssh_url":"git@example.com:gitlab-org/gitlab-test.git", "http_url":"http://example.com/gitlab-org/gitlab-test.git" }, "repository":{ "name":"Gitlab Test", "url":"http://example.com/gitlab-org/gitlab-test.git", "description":"Aut reprehenderit ut est.", "homepage":"http://example.com/gitlab-org/gitlab-test" }, "object_attributes": { "id": 1245, "note": "Is this snippet doing what it's supposed to be doing?", "noteable_type": "Snippet", "author_id": 1, "created_at": "2015-05-17 18:35:50 UTC", "updated_at": "2015-05-17 18:35:50 UTC", "project_id": 5, "attachment": null, "line_code": null, "commit_id": "", "noteable_id": 53, "system": false, "st_diff": null, "action": "create", "url": "http://example.com/gitlab-org/gitlab-test/-/snippets/53#note_1245" }, "snippet": { "id": 53, "title": "test", "description": "A snippet description.", "content": "puts 'Hello world'", "author_id": 1, "project_id": 5, "created_at": "2015-04-09 02:40:38 UTC", "updated_at": "2015-04-09 02:40:38 UTC", "file_name": "test.rb", "type": "ProjectSnippet", "visibility_level": 0, "url": "http://example.com/gitlab-org/gitlab-test/-/snippets/53" } } ``` ## Merge request events Merge request events are triggered when: - A new merge request is created. - An existing merge request is updated, approved (by all required approvers), unapproved, merged, or closed. - An individual user adds or removes their approval to an existing merge request. - A commit is added in the source branch. - All threads are resolved on the merge request. Merge request events can be triggered even if the `changes` field is empty. Webhook receivers should always inspect the content of the `changes` field for the actual changes in a merge request. The available values for `object_attributes.action` in the payload are: - `open` - `close` - `reopen` - `update` - `approved` - `unapproved` - `approval` - `unapproval` - `merge` The field `object_attributes.oldrev` is only available when there are actual code changes, like: - New code is pushed. - A [suggestion](../merge_requests/reviews/suggestions.md) is applied. Request header: ```plaintext X-Gitlab-Event: Merge Request Hook ``` Payload example: ```json { "object_kind": "merge_request", "event_type": "merge_request", "user": { "id": 1, "name": "Administrator", "username": "root", "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40\u0026d=identicon", "email": "admin@example.com" }, "project": { "id": 1, "name":"Gitlab Test", "description":"Aut reprehenderit ut est.", "web_url":"http://example.com/gitlabhq/gitlab-test", "avatar_url":null, "git_ssh_url":"git@example.com:gitlabhq/gitlab-test.git", "git_http_url":"http://example.com/gitlabhq/gitlab-test.git", "namespace":"GitlabHQ", "visibility_level":20, "path_with_namespace":"gitlabhq/gitlab-test", "default_branch":"master", "ci_config_path":"", "homepage":"http://example.com/gitlabhq/gitlab-test", "url":"http://example.com/gitlabhq/gitlab-test.git", "ssh_url":"git@example.com:gitlabhq/gitlab-test.git", "http_url":"http://example.com/gitlabhq/gitlab-test.git" }, "repository": { "name": "Gitlab Test", "url": "http://example.com/gitlabhq/gitlab-test.git", "description": "Aut reprehenderit ut est.", "homepage": "http://example.com/gitlabhq/gitlab-test" }, "object_attributes": { "id": 99, "iid": 1, "target_branch": "master", "source_branch": "ms-viewport", "source_project_id": 14, "author_id": 51, "assignee_ids": [6], "assignee_id": 6, "reviewer_ids": [6], "title": "MS-Viewport", "created_at": "2013-12-03T17:23:34Z", "updated_at": "2013-12-03T17:23:34Z", "last_edited_at": "2013-12-03T17:23:34Z", "last_edited_by_id": 1, "milestone_id": null, "state_id": 1, "state": "opened", "blocking_discussions_resolved": true, "work_in_progress": false, "draft": false, "first_contribution": true, "merge_status": "unchecked", "target_project_id": 14, "description": "", "prepared_at": "2013-12-03T19:23:34Z", "total_time_spent": 1800, "time_change": 30, "human_total_time_spent": "30m", "human_time_change": "30s", "human_time_estimate": "30m", "url": "http://example.com/diaspora/merge_requests/1", "source": { "name":"Awesome Project", "description":"Aut reprehenderit ut est.", "web_url":"http://example.com/awesome_space/awesome_project", "avatar_url":null, "git_ssh_url":"git@example.com:awesome_space/awesome_project.git", "git_http_url":"http://example.com/awesome_space/awesome_project.git", "namespace":"Awesome Space", "visibility_level":20, "path_with_namespace":"awesome_space/awesome_project", "default_branch":"master", "homepage":"http://example.com/awesome_space/awesome_project", "url":"http://example.com/awesome_space/awesome_project.git", "ssh_url":"git@example.com:awesome_space/awesome_project.git", "http_url":"http://example.com/awesome_space/awesome_project.git" }, "target": { "name":"Awesome Project", "description":"Aut reprehenderit ut est.", "web_url":"http://example.com/awesome_space/awesome_project", "avatar_url":null, "git_ssh_url":"git@example.com:awesome_space/awesome_project.git", "git_http_url":"http://example.com/awesome_space/awesome_project.git", "namespace":"Awesome Space", "visibility_level":20, "path_with_namespace":"awesome_space/awesome_project", "default_branch":"master", "homepage":"http://example.com/awesome_space/awesome_project", "url":"http://example.com/awesome_space/awesome_project.git", "ssh_url":"git@example.com:awesome_space/awesome_project.git", "http_url":"http://example.com/awesome_space/awesome_project.git" }, "last_commit": { "id": "da1560886d4f094c3e6c9ef40349f7d38b5d27d7", "message": "fixed readme", "title": "Update file README.md", "timestamp": "2012-01-03T23:36:29+02:00", "url": "http://example.com/awesome_space/awesome_project/commits/da1560886d4f094c3e6c9ef40349f7d38b5d27d7", "author": { "name": "GitLab dev user", "email": "gitlabdev@dv6700.(none)" } }, "labels": [{ "id": 206, "title": "API", "color": "#ffffff", "project_id": 14, "created_at": "2013-12-03T17:15:43Z", "updated_at": "2013-12-03T17:15:43Z", "template": false, "description": "API related issues", "type": "ProjectLabel", "group_id": 41 }], "action": "open", "detailed_merge_status": "mergeable" }, "labels": [{ "id": 206, "title": "API", "color": "#ffffff", "project_id": 14, "created_at": "2013-12-03T17:15:43Z", "updated_at": "2013-12-03T17:15:43Z", "template": false, "description": "API related issues", "type": "ProjectLabel", "group_id": 41 }], "changes": { "updated_by_id": { "previous": null, "current": 1 }, "draft": { "previous": true, "current": false }, "updated_at": { "previous": "2017-09-15 16:50:55 UTC", "current":"2017-09-15 16:52:00 UTC" }, "labels": { "previous": [{ "id": 206, "title": "API", "color": "#ffffff", "project_id": 14, "created_at": "2013-12-03T17:15:43Z", "updated_at": "2013-12-03T17:15:43Z", "template": false, "description": "API related issues", "type": "ProjectLabel", "group_id": 41 }], "current": [{ "id": 205, "title": "Platform", "color": "#123123", "project_id": 14, "created_at": "2013-12-03T17:15:43Z", "updated_at": "2013-12-03T17:15:43Z", "template": false, "description": "Platform related issues", "type": "ProjectLabel", "group_id": 41 }] }, "last_edited_at": { "previous": null, "current": "2023-03-15 00:00:10 UTC" }, "last_edited_by_id": { "previous": null, "current": 3278533 } }, "assignees": [ { "id": 6, "name": "User1", "username": "user1", "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40\u0026d=identicon" } ], "reviewers": [ { "id": 6, "name": "User1", "username": "user1", "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40\u0026d=identicon" } ] } ``` {{< alert type="note" >}} The fields `assignee_id` and `merge_status` are [deprecated](../../../api/merge_requests.md). {{< /alert >}} ## Wiki page events Wiki page events are triggered when a wiki page is created, updated, or deleted. Request header: ```plaintext X-Gitlab-Event: Wiki Page Hook ``` Payload example: ```json { "object_kind": "wiki_page", "user": { "id": 1, "name": "Administrator", "username": "root", "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80\u0026d=identicon", "email": "admin@example.com" }, "project": { "id": 1, "name": "awesome-project", "description": "This is awesome", "web_url": "http://example.com/root/awesome-project", "avatar_url": null, "git_ssh_url": "git@example.com:root/awesome-project.git", "git_http_url": "http://example.com/root/awesome-project.git", "namespace": "root", "visibility_level": 0, "path_with_namespace": "root/awesome-project", "default_branch": "master", "homepage": "http://example.com/root/awesome-project", "url": "git@example.com:root/awesome-project.git", "ssh_url": "git@example.com:root/awesome-project.git", "http_url": "http://example.com/root/awesome-project.git" }, "wiki": { "web_url": "http://example.com/root/awesome-project/-/wikis/home", "git_ssh_url": "git@example.com:root/awesome-project.wiki.git", "git_http_url": "http://example.com/root/awesome-project.wiki.git", "path_with_namespace": "root/awesome-project.wiki", "default_branch": "master" }, "object_attributes": { "title": "Awesome", "content": "awesome content goes here", "format": "markdown", "message": "adding an awesome page to the wiki", "slug": "awesome", "url": "http://example.com/root/awesome-project/-/wikis/awesome", "action": "create", "diff_url": "http://example.com/root/awesome-project/-/wikis/home/diff?version_id=78ee4a6705abfbff4f4132c6646dbaae9c8fb6ec", "version_id": "3ad67c972065298d226dd80b2b03e0fc2421e731" } } ``` ## Pipeline events Pipeline events are triggered when the status of a pipeline changes. In [GitLab 15.1](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/89546) and later, pipeline webhooks triggered by blocked users are not processed. In [GitLab 16.1](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/123639) and later, pipeline webhooks started to expose `object_attributes.name`. Request header: ```plaintext X-Gitlab-Event: Pipeline Hook ``` Payload example: ```json { "object_kind": "pipeline", "object_attributes":{ "id": 31, "iid": 3, "name": "Pipeline for branch: master", "ref": "master", "tag": false, "sha": "bcbb5ec396a2c0f828686f14fac9b80b780504f2", "before_sha": "bcbb5ec396a2c0f828686f14fac9b80b780504f2", "source": "merge_request_event", "status": "success", "stages":[ "build", "test", "deploy" ], "created_at": "2016-08-12 15:23:28 UTC", "finished_at": "2016-08-12 15:26:29 UTC", "duration": 63, "variables": [ { "key": "NESTOR_PROD_ENVIRONMENT", "value": "us-west-1" } ], "url": "http://example.com/gitlab-org/gitlab-test/-/pipelines/31" }, "merge_request": { "id": 1, "iid": 1, "title": "Test", "source_branch": "test", "source_project_id": 1, "target_branch": "master", "target_project_id": 1, "state": "opened", "merge_status": "can_be_merged", "detailed_merge_status": "mergeable", "url": "http://192.168.64.1:3005/gitlab-org/gitlab-test/merge_requests/1" }, "user":{ "id": 1, "name": "Administrator", "username": "root", "avatar_url": "http://www.gravatar.com/avatar/e32bd13e2add097461cb96824b7a829c?s=80\u0026d=identicon", "email": "user_email@gitlab.com" }, "project":{ "id": 1, "name": "Gitlab Test", "description": "Atque in sunt eos similique dolores voluptatem.", "web_url": "http://192.168.64.1:3005/gitlab-org/gitlab-test", "avatar_url": null, "git_ssh_url": "git@192.168.64.1:gitlab-org/gitlab-test.git", "git_http_url": "http://192.168.64.1:3005/gitlab-org/gitlab-test.git", "namespace": "Gitlab Org", "visibility_level": 20, "path_with_namespace": "gitlab-org/gitlab-test", "default_branch": "master" }, "commit":{ "id": "bcbb5ec396a2c0f828686f14fac9b80b780504f2", "message": "test\n", "timestamp": "2016-08-12T17:23:21+02:00", "url": "http://example.com/gitlab-org/gitlab-test/commit/bcbb5ec396a2c0f828686f14fac9b80b780504f2", "author":{ "name": "User", "email": "user@gitlab.com" } }, "source_pipeline":{ "project":{ "id": 41, "web_url": "https://gitlab.example.com/gitlab-org/upstream-project", "path_with_namespace": "gitlab-org/upstream-project" }, "pipeline_id": 30, "job_id": 3401 }, "builds":[ { "id": 380, "stage": "deploy", "name": "production", "status": "skipped", "created_at": "2016-08-12 15:23:28 UTC", "started_at": null, "finished_at": null, "duration": null, "queued_duration": null, "failure_reason": null, "when": "manual", "manual": true, "allow_failure": false, "user":{ "id": 1, "name": "Administrator", "username": "root", "avatar_url": "http://www.gravatar.com/avatar/e32bd13e2add097461cb96824b7a829c?s=80\u0026d=identicon", "email": "admin@example.com" }, "runner": null, "artifacts_file":{ "filename": null, "size": null }, "environment": { "name": "production", "action": "start", "deployment_tier": "production" } }, { "id": 377, "stage": "test", "name": "test-image", "status": "success", "created_at": "2016-08-12 15:23:28 UTC", "started_at": "2016-08-12 15:26:12 UTC", "finished_at": "2016-08-12 15:26:29 UTC", "duration": 17.0, "queued_duration": 196.0, "failure_reason": null, "when": "on_success", "manual": false, "allow_failure": false, "user":{ "id": 1, "name": "Administrator", "username": "root", "avatar_url": "http://www.gravatar.com/avatar/e32bd13e2add097461cb96824b7a829c?s=80\u0026d=identicon", "email": "admin@example.com" }, "runner": { "id": 380987, "description": "shared-runners-manager-6.gitlab.com", "active": true, "runner_type": "instance_type", "is_shared": true, "tags": [ "linux", "docker", "shared-runner" ] }, "artifacts_file":{ "filename": null, "size": null }, "environment": null }, { "id": 378, "stage": "test", "name": "test-build", "status": "failed", "created_at": "2016-08-12 15:23:28 UTC", "started_at": "2016-08-12 15:26:12 UTC", "finished_at": "2016-08-12 15:26:29 UTC", "duration": 17.0, "queued_duration": 196.0, "failure_reason": "script_failure", "when": "on_success", "manual": false, "allow_failure": false, "user":{ "id": 1, "name": "Administrator", "username": "root", "avatar_url": "http://www.gravatar.com/avatar/e32bd13e2add097461cb96824b7a829c?s=80\u0026d=identicon", "email": "admin@example.com" }, "runner": { "id":380987, "description":"shared-runners-manager-6.gitlab.com", "active":true, "runner_type": "instance_type", "is_shared": true, "tags": [ "linux", "docker" ] }, "artifacts_file":{ "filename": null, "size": null }, "environment": null }, { "id": 376, "stage": "build", "name": "build-image", "status": "success", "created_at": "2016-08-12 15:23:28 UTC", "started_at": "2016-08-12 15:24:56 UTC", "finished_at": "2016-08-12 15:25:26 UTC", "duration": 17.0, "queued_duration": 196.0, "failure_reason": null, "when": "on_success", "manual": false, "allow_failure": false, "user":{ "id": 1, "name": "Administrator", "username": "root", "avatar_url": "http://www.gravatar.com/avatar/e32bd13e2add097461cb96824b7a829c?s=80\u0026d=identicon", "email": "admin@example.com" }, "runner": { "id": 380987, "description": "shared-runners-manager-6.gitlab.com", "active": true, "runner_type": "instance_type", "is_shared": true, "tags": [ "linux", "docker" ] }, "artifacts_file":{ "filename": null, "size": null }, "environment": null }, { "id": 379, "stage": "deploy", "name": "staging", "status": "created", "created_at": "2016-08-12 15:23:28 UTC", "started_at": null, "finished_at": null, "duration": null, "queued_duration": null, "failure_reason": null, "when": "on_success", "manual": false, "allow_failure": false, "user":{ "id": 1, "name": "Administrator", "username": "root", "avatar_url": "http://www.gravatar.com/avatar/e32bd13e2add097461cb96824b7a829c?s=80\u0026d=identicon", "email": "admin@example.com" }, "runner": null, "artifacts_file":{ "filename": null, "size": null }, "environment": { "name": "staging", "action": "start", "deployment_tier": "staging" } } ] } ``` ## Job events Job events are triggered when the status of a job changes. Trigger jobs are excluded. The `commit.id` in the payload is the ID of the pipeline, not the ID of the commit. In [GitLab 15.1](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/89546) and later, job events triggered by blocked users are not processed. Request header: ```plaintext X-Gitlab-Event: Job Hook ``` Payload example: ```json { "object_kind": "build", "ref": "gitlab-script-trigger", "tag": false, "before_sha": "2293ada6b400935a1378653304eaf6221e0fdb8f", "sha": "2293ada6b400935a1378653304eaf6221e0fdb8f", "build_id": 1977, "build_name": "test", "build_stage": "test", "build_status": "created", "build_created_at": "2021-02-23T02:41:37.886Z", "build_created_at_iso": "2021-02-23T02:41:37Z", "build_started_at": null, "build_started_at_iso": null, "build_finished_at": null, "build_finished_at_iso": null, "build_duration": null, "build_queued_duration": 1095.588715, // duration in seconds "build_allow_failure": false, "build_failure_reason": "script_failure", "retries_count": 2, // the second retry of this job "pipeline_id": 2366, "project_id": 380, "project_name": "gitlab-org/gitlab-test", "user": { "id": 3, "name": "User", "email": "user@gitlab.com", "avatar_url": "http://www.gravatar.com/avatar/e32bd13e2add097461cb96824b7a829c?s=80\u0026d=identicon" }, "commit": { "id": 2366, "name": "Build pipeline", "sha": "2293ada6b400935a1378653304eaf6221e0fdb8f", "message": "test\n", "author_name": "User", "author_email": "user@gitlab.com", "status": "created", "duration": null, "started_at": null, "started_at_iso": null, "finished_at": null, "finished_at_iso": null }, "repository": { "name": "gitlab_test", "description": "Atque in sunt eos similique dolores voluptatem.", "homepage": "http://192.168.64.1:3005/gitlab-org/gitlab-test", "git_ssh_url": "git@192.168.64.1:gitlab-org/gitlab-test.git", "git_http_url": "http://192.168.64.1:3005/gitlab-org/gitlab-test.git", "visibility_level": 20 }, "project":{ "id": 380, "name": "Gitlab Test", "description": "Atque in sunt eos similique dolores voluptatem.", "web_url": "http://192.168.64.1:3005/gitlab-org/gitlab-test", "avatar_url": null, "git_ssh_url": "git@192.168.64.1:gitlab-org/gitlab-test.git", "git_http_url": "http://192.168.64.1:3005/gitlab-org/gitlab-test.git", "namespace": "Gitlab Org", "visibility_level": 20, "path_with_namespace": "gitlab-org/gitlab-test", "default_branch": "master" }, "runner": { "active": true, "runner_type": "project_type", "is_shared": false, "id": 380987, "description": "shared-runners-manager-6.gitlab.com", "tags": [ "linux", "docker" ] }, "environment": null, "source_pipeline":{ "project":{ "id": 41, "web_url": "https://gitlab.example.com/gitlab-org/upstream-project", "path_with_namespace": "gitlab-org/upstream-project" }, "pipeline_id": 30, "job_id": 3401 }, } ``` ### Number of retries {{< history >}} - `retries_count` [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/382046) in GitLab 15.6 [with a flag](../../../administration/feature_flags/_index.md) named `job_webhook_retries_count`. Disabled by default. - `retries_count` [enabled on GitLab Self-Managed](https://gitlab.com/gitlab-org/gitlab/-/issues/382046) in GitLab 16.2. {{< /history >}} `retries_count` is an integer that indicates if the job is a retry. `0` means that the job has not been retried. `1` means that it's the first retry. ### Pipeline name {{< history >}} - `commit.name` [introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/107963) in GitLab 15.8. {{< /history >}} You can set custom names for pipelines with [`workflow:name`](../../../ci/yaml/_index.md#workflowname). If the pipeline has a name, that name is the value of `commit.name`. ## Deployment events Deployment events are triggered when a deployment: - Starts - Succeeds - Fails - Is canceled The `deployable_id` and `deployable_url` in the payload represent a CI/CD job that executed the deployment. When the deployment event occurs by [API](../../../ci/environments/external_deployment_tools.md) or [`trigger` jobs](../../../ci/pipelines/downstream_pipelines.md), `deployable_url` is `null`. Request header: ```plaintext X-Gitlab-Event: Deployment Hook ``` Payload example: ```json { "object_kind": "deployment", "status": "success", "status_changed_at":"2021-04-28 21:50:00 +0200", "deployment_id": 15, "deployable_id": 796, "deployable_url": "http://10.126.0.2:3000/root/test-deployment-webhooks/-/jobs/796", "environment": "staging", "environment_tier": "staging", "environment_slug": "staging", "environment_external_url": "https://staging.example.com", "project": { "id": 30, "name": "test-deployment-webhooks", "description": "", "web_url": "http://10.126.0.2:3000/root/test-deployment-webhooks", "avatar_url": null, "git_ssh_url": "ssh://vlad@10.126.0.2:2222/root/test-deployment-webhooks.git", "git_http_url": "http://10.126.0.2:3000/root/test-deployment-webhooks.git", "namespace": "Administrator", "visibility_level": 0, "path_with_namespace": "root/test-deployment-webhooks", "default_branch": "master", "ci_config_path": "", "homepage": "http://10.126.0.2:3000/root/test-deployment-webhooks", "url": "ssh://vlad@10.126.0.2:2222/root/test-deployment-webhooks.git", "ssh_url": "ssh://vlad@10.126.0.2:2222/root/test-deployment-webhooks.git", "http_url": "http://10.126.0.2:3000/root/test-deployment-webhooks.git" }, "short_sha": "279484c0", "user": { "id": 1, "name": "Administrator", "username": "root", "avatar_url": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", "email": "admin@example.com" }, "user_url": "http://10.126.0.2:3000/root", "commit_url": "http://10.126.0.2:3000/root/test-deployment-webhooks/-/commit/279484c09fbe69ededfced8c1bb6e6d24616b468", "commit_title": "Add new file" } ``` ## Group member events {{< details >}} - Tier: Premium, Ultimate {{< /details >}} {{< history >}} - Access request events [introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/163094) in GitLab 17.4. {{< /history >}} These events are triggered for [group webhooks](webhooks.md#group-webhooks) only. Member events are triggered when: - A user is added as a group member. - The access level of a user changes. - The expiration date for user access is updated. - A user is removed from the group. - A user requests access to the group. - An access request is denied. ### Add member to group Request header: ```plaintext X-Gitlab-Event: Member Hook ``` Payload example: ```json { "created_at": "2020-12-11T04:57:22Z", "updated_at": "2020-12-11T04:57:22Z", "group_name": "webhook-test", "group_path": "webhook-test", "group_id": 100, "user_username": "test_user", "user_name": "Test User", "user_email": "testuser@webhooktest.com", "user_id": 64, "group_access": "Guest", "group_plan": null, "expires_at": "2020-12-14T00:00:00Z", "event_name": "user_add_to_group" } ``` ### Update member access level or expiration date Request header: ```plaintext X-Gitlab-Event: Member Hook ``` Payload example: ```json { "created_at": "2020-12-11T04:57:22Z", "updated_at": "2020-12-12T08:48:19Z", "group_name": "webhook-test", "group_path": "webhook-test", "group_id": 100, "user_username": "test_user", "user_name": "Test User", "user_email": "testuser@webhooktest.com", "user_id": 64, "group_access": "Developer", "group_plan": null, "expires_at": "2020-12-20T00:00:00Z", "event_name": "user_update_for_group" } ``` ### Remove member from group Request header: ```plaintext X-Gitlab-Event: Member Hook ``` Payload example: ```json { "created_at": "2020-12-11T04:57:22Z", "updated_at": "2020-12-12T08:52:34Z", "group_name": "webhook-test", "group_path": "webhook-test", "group_id": 100, "user_username": "test_user", "user_name": "Test User", "user_email": "testuser@webhooktest.com", "user_id": 64, "group_access": "Guest", "group_plan": null, "expires_at": "2020-12-14T00:00:00Z", "event_name": "user_remove_from_group" } ``` ### A user requests access {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/163094) in GitLab 17.4 [with a flag](../../../administration/feature_flags/_index.md) named `group_access_request_webhooks`. Disabled by default. - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/issues/479877) in GitLab 17.5. Feature flag `group_access_request_webhooks` removed. {{< /history >}} Request header: ```plaintext X-Gitlab-Event: Member Hook ``` Payload example: ```json { "created_at": "2020-12-11T04:57:22Z", "updated_at": "2020-12-12T08:52:34Z", "group_name": "webhook-test", "group_path": "webhook-test", "group_id": 100, "user_username": "test_user", "user_name": "Test User", "user_email": "testuser@webhooktest.com", "user_id": 64, "group_access": "Guest", "group_plan": null, "expires_at": "2020-12-14T00:00:00Z", "event_name": "user_access_request_to_group" } ``` ### An access request is denied {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/163094) in GitLab 17.4 [with a flag](../../../administration/feature_flags/_index.md) named `group_access_request_webhooks`. Disabled by default. - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/issues/479877) in GitLab 17.5. Feature flag `group_access_request_webhooks` removed. {{< /history >}} Request header: ```plaintext X-Gitlab-Event: Member Hook ``` Payload example: ```json { "created_at": "2020-12-11T04:57:22Z", "updated_at": "2020-12-12T08:52:34Z", "group_name": "webhook-test", "group_path": "webhook-test", "group_id": 100, "user_username": "test_user", "user_name": "Test User", "user_email": "testuser@webhooktest.com", "user_id": 64, "group_access": "Guest", "group_plan": null, "expires_at": "2020-12-14T00:00:00Z", "event_name": "user_access_request_denied_for_group" } ``` ## Project events {{< details >}} - Tier: Premium, Ultimate {{< /details >}} {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/359044) in GitLab 17.6. {{< /history >}} These events are triggered for [group webhooks](webhooks.md#group-webhooks) only. Project events are triggered when: - A [project is created in a group](#create-a-project-in-a-group). - A [project is deleted in a group](#delete-a-project-in-a-group). ### Create a project in a group Request header: ```plaintext X-Gitlab-Event: Project Hook ``` Payload example: ```json { "event_name": "project_create", "created_at": "2024-10-07T10:43:48Z", "updated_at": "2024-10-07T10:43:48Z", "name": "project1", "path": "project1", "path_with_namespace": "group1/project1", "project_id": 22, "project_namespace_id": 32, "owners": [{ "name": "John", "email": "user1@example.com" }], "project_visibility": "private" } ``` ### Delete a project in a group Request header: ```plaintext X-Gitlab-Event: Project Hook ``` Payload example: ```json { "event_name": "project_destroy", "created_at": "2024-10-07T10:43:48Z", "updated_at": "2024-10-07T10:43:48Z", "name": "project1", "path": "project1", "path_with_namespace": "group1/project1", "project_id": 22, "project_namespace_id": 32, "owners": [{ "name": "John", "email": "user1@example.com" }], "project_visibility": "private" } ``` ## Subgroup events {{< details >}} - Tier: Premium, Ultimate {{< /details >}} These events are triggered for [group webhooks](webhooks.md#group-webhooks) only. Subgroup events are triggered when: - A [subgroup is created in a group](#create-a-subgroup-in-a-group). - A [subgroup is removed from a group](#remove-a-subgroup-from-a-group). ### Create a subgroup in a group Request header: ```plaintext X-Gitlab-Event: Subgroup Hook ``` Payload example: ```json { "created_at": "2021-01-20T09:40:12Z", "updated_at": "2021-01-20T09:40:12Z", "event_name": "subgroup_create", "name": "subgroup1", "path": "subgroup1", "full_path": "group1/subgroup1", "group_id": 10, "parent_group_id": 7, "parent_name": "group1", "parent_path": "group1", "parent_full_path": "group1" } ``` ### Remove a subgroup from a group This webhook is not triggered when a [subgroup is transferred to a new parent group](../../group/manage.md#transfer-a-group). Request header: ```plaintext X-Gitlab-Event: Subgroup Hook ``` Payload example: ```json { "created_at": "2021-01-20T09:40:12Z", "updated_at": "2021-01-20T09:40:12Z", "event_name": "subgroup_destroy", "name": "subgroup1", "path": "subgroup1", "full_path": "group1/subgroup1", "group_id": 10, "parent_group_id": 7, "parent_name": "group1", "parent_path": "group1", "parent_full_path": "group1" } ``` ## Feature flag events Feature flag events are triggered when a feature flag is turned on or off. Request header: ```plaintext X-Gitlab-Event: Feature Flag Hook ``` Payload example: ```json { "object_kind": "feature_flag", "project": { "id": 1, "name":"Gitlab Test", "description":"Aut reprehenderit ut est.", "web_url":"http://example.com/gitlabhq/gitlab-test", "avatar_url":null, "git_ssh_url":"git@example.com:gitlabhq/gitlab-test.git", "git_http_url":"http://example.com/gitlabhq/gitlab-test.git", "namespace":"GitlabHQ", "visibility_level":20, "path_with_namespace":"gitlabhq/gitlab-test", "default_branch":"master", "ci_config_path": null, "homepage":"http://example.com/gitlabhq/gitlab-test", "url":"http://example.com/gitlabhq/gitlab-test.git", "ssh_url":"git@example.com:gitlabhq/gitlab-test.git", "http_url":"http://example.com/gitlabhq/gitlab-test.git" }, "user": { "id": 1, "name": "Administrator", "username": "root", "avatar_url": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", "email": "admin@example.com" }, "user_url": "http://example.com/root", "object_attributes": { "id": 6, "name": "test-feature-flag", "description": "test-feature-flag-description", "active": true } } ``` ## Release events {{< history >}} - Delete release event [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/418113) in GitLab 16.5. {{< /history >}} Release events are triggered when a release is created, updated, or deleted. The available values for `object_attributes.action` in the payload are: - `create` - `update` - `delete` Request header: ```plaintext X-Gitlab-Event: Release Hook ``` Payload example: ```json { "id": 1, "created_at": "2020-11-02 12:55:12 UTC", "description": "v1.1 has been released", "name": "v1.1", "released_at": "2020-11-02 12:55:12 UTC", "tag": "v1.1", "object_kind": "release", "project": { "id": 2, "name": "release-webhook-example", "description": "", "web_url": "https://example.com/gitlab-org/release-webhook-example", "avatar_url": null, "git_ssh_url": "ssh://git@example.com/gitlab-org/release-webhook-example.git", "git_http_url": "https://example.com/gitlab-org/release-webhook-example.git", "namespace": "Gitlab", "visibility_level": 0, "path_with_namespace": "gitlab-org/release-webhook-example", "default_branch": "master", "ci_config_path": null, "homepage": "https://example.com/gitlab-org/release-webhook-example", "url": "ssh://git@example.com/gitlab-org/release-webhook-example.git", "ssh_url": "ssh://git@example.com/gitlab-org/release-webhook-example.git", "http_url": "https://example.com/gitlab-org/release-webhook-example.git" }, "url": "https://example.com/gitlab-org/release-webhook-example/-/releases/v1.1", "action": "create", "assets": { "count": 5, "links": [ { "id": 1, "external": true, // deprecated in GitLab 15.9, will be removed in GitLab 16.0. "link_type": "other", "name": "Changelog", "url": "https://example.net/changelog" } ], "sources": [ { "format": "zip", "url": "https://example.com/gitlab-org/release-webhook-example/-/archive/v1.1/release-webhook-example-v1.1.zip" }, { "format": "tar.gz", "url": "https://example.com/gitlab-org/release-webhook-example/-/archive/v1.1/release-webhook-example-v1.1.tar.gz" }, { "format": "tar.bz2", "url": "https://example.com/gitlab-org/release-webhook-example/-/archive/v1.1/release-webhook-example-v1.1.tar.bz2" }, { "format": "tar", "url": "https://example.com/gitlab-org/release-webhook-example/-/archive/v1.1/release-webhook-example-v1.1.tar" } ] }, "commit": { "id": "ee0a3fb31ac16e11b9dbb596ad16d4af654d08f8", "message": "Release v1.1", "title": "Release v1.1", "timestamp": "2020-10-31T14:58:32+11:00", "url": "https://example.com/gitlab-org/release-webhook-example/-/commit/ee0a3fb31ac16e11b9dbb596ad16d4af654d08f8", "author": { "name": "Example User", "email": "user@example.com" } } } ``` ## Milestone events {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/14213) in GitLab 18.2. {{< /history >}} Milestone events are triggered when a milestone is created, closed, reopened, or deleted. The available values for `object_attributes.action` in the payload are: - `create` - `close` - `reopen` Request header: ```plaintext X-Gitlab-Event: Milestone Hook ``` Payload example: ```json { "object_kind": "milestone", "event_type": "milestone", "project": { "id": 1, "name": "Gitlab Test", "description": "Aut reprehenderit ut est.", "web_url": "http://example.com/gitlabhq/gitlab-test", "avatar_url": null, "git_ssh_url": "git@example.com:gitlabhq/gitlab-test.git", "git_http_url": "http://example.com/gitlabhq/gitlab-test.git", "namespace": "GitlabHQ", "visibility_level": 20, "path_with_namespace": "gitlabhq/gitlab-test", "default_branch": "master", "ci_config_path": null, "homepage": "http://example.com/gitlabhq/gitlab-test", "url": "http://example.com/gitlabhq/gitlab-test.git", "ssh_url": "git@example.com:gitlabhq/gitlab-test.git", "http_url": "http://example.com/gitlabhq/gitlab-test.git" }, "object_attributes": { "id": 61, "iid": 10, "title": "v1.0", "description": "First stable release", "state": "active", "created_at": "2025-06-16 14:10:57 UTC", "updated_at": "2025-06-16 14:10:57 UTC", "due_date": "2025-06-30", "start_date": "2025-06-16", "group_id": null, "project_id": 1 }, "action": "create" } ``` ## Emoji events {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/123952) in GitLab 16.2 [with a flag](../../../administration/feature_flags/_index.md) named `emoji_webhooks`. Disabled by default. - [Enabled on GitLab.com](https://gitlab.com/gitlab-org/gitlab/-/issues/417288) in GitLab 16.3. - [Enabled by default](https://gitlab.com/gitlab-org/gitlab/-/issues/417288) in GitLab 16.4. - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/issues/417288) in GitLab 17.5. Feature flag `emoji_webhooks` removed. {{< /history >}} An emoji event is triggered when an [emoji reaction](../../emoji_reactions.md) is added or removed on: - Issues - Merge requests - Project snippets - Comments on: - Issues - Merge requests - Project snippets - Commits The available values for `object_attributes.action` in the payload are: - `award` to add a reaction - `revoke` to remove a reaction Request header: ```plaintext X-Gitlab-Event: Emoji Hook ``` Payload example: ```json { "object_kind": "emoji", "event_type": "award", "user": { "id": 1, "name": "Blake Bergstrom", "username": "root", "avatar_url": "http://example.com/uploads/-/system/user/avatar/1/avatar.png", "email": "[REDACTED]" }, "project_id": 6, "project": { "id": 6, "name": "Flight", "description": "Velit fugit aperiam illum deleniti odio sequi.", "web_url": "http://example.com/flightjs/Flight", "avatar_url": null, "git_ssh_url": "ssh://git@example.com/flightjs/Flight.git", "git_http_url": "http://example.com/flightjs/Flight.git", "namespace": "Flightjs", "visibility_level": 20, "path_with_namespace": "flightjs/Flight", "default_branch": "master", "ci_config_path": null, "homepage": "http://example.com/flightjs/Flight", "url": "ssh://git@example.com/flightjs/Flight.git", "ssh_url": "ssh://git@example.com/flightjs/Flight.git", "http_url": "http://example.com/flightjs/Flight.git" }, "object_attributes": { "user_id": 1, "created_at": "2023-07-04 20:44:11 UTC", "id": 1, "name": "thumbsup", "awardable_type": "Note", "awardable_id": 363, "updated_at": "2023-07-04 20:44:11 UTC", "action": "award", "awarded_on_url": "http://example.com/flightjs/Flight/-/issues/42#note_363" }, "note": { "attachment": null, "author_id": 1, "change_position": null, "commit_id": null, "created_at": "2023-07-04 15:09:55 UTC", "discussion_id": "c3d97fd471f210a5dc8b97a409e3bea95ee06c14", "id": 363, "line_code": null, "note": "Testing 123", "noteable_id": 635, "noteable_type": "Issue", "original_position": null, "position": null, "project_id": 6, "resolved_at": null, "resolved_by_id": null, "resolved_by_push": null, "st_diff": null, "system": false, "type": null, "updated_at": "2023-07-04 19:58:46 UTC", "updated_by_id": null, "description": "Testing 123", "url": "http://example.com/flightjs/Flight/-/issues/42#note_363" }, "issue": { "author_id": 1, "closed_at": null, "confidential": false, "created_at": "2023-07-04 14:59:43 UTC", "description": "Issue description!", "discussion_locked": null, "due_date": null, "id": 635, "iid": 42, "last_edited_at": null, "last_edited_by_id": null, "milestone_id": null, "moved_to_id": null, "duplicated_to_id": null, "project_id": 6, "relative_position": 18981, "state_id": 1, "time_estimate": 0, "title": "New issue!", "updated_at": "2023-07-04 15:09:55 UTC", "updated_by_id": null, "weight": null, "health_status": null, "url": "http://example.com/flightjs/Flight/-/issues/42", "total_time_spent": 0, "time_change": 0, "human_total_time_spent": null, "human_time_change": null, "human_time_estimate": null, "assignee_ids": [ 1 ], "assignee_id": 1, "labels": [ ], "state": "opened", "severity": "unknown" } } ``` ## Project and group access token events {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/141907) in GitLab 16.10 [with a flag](../../../administration/feature_flags/_index.md) named `access_token_webhooks`. Disabled by default. - [Enabled on GitLab.com](https://gitlab.com/gitlab-org/gitlab/-/issues/439379) in GitLab 16.11. - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/issues/454642) in GitLab 16.11. Feature flag `access_token_webhooks` removed. - `full_path` attribute [added](https://gitlab.com/gitlab-org/gitlab/-/issues/465421) in GitLab 17.4. - 60 and 30 day notifications [generally available](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/173792) in GitLab 17.7. {{< /history >}} Access token expiry events trigger before an [access tokens](../../../security/tokens/_index.md) expires. These events trigger: - One day before the token expires - Seven days before the token expires - 30 days before the token expires, if the feature is enabled. - 60 days before the token expires, if the feature is enabled. The available values for `event_name` in the payload are: - `expiring_access_token` Request header: ```plaintext X-Gitlab-Event: Resource Access Token Hook ``` Payload example for project: ```json { "object_kind": "access_token", "project": { "id": 7, "name": "Flight", "description": "Eum dolore maxime atque reprehenderit voluptatem.", "web_url": "https://example.com/flightjs/Flight", "avatar_url": null, "git_ssh_url": "ssh://git@example.com/flightjs/Flight.git", "git_http_url": "https://example.com/flightjs/Flight.git", "namespace": "Flightjs", "visibility_level": 0, "path_with_namespace": "flightjs/Flight", "default_branch": "master", "ci_config_path": null, "homepage": "https://example.com/flightjs/Flight", "url": "ssh://git@example.com/flightjs/Flight.git", "ssh_url": "ssh://git@example.com/flightjs/Flight.git", "http_url": "https://example.com/flightjs/Flight.git" }, "object_attributes": { "user_id": 90, "created_at": "2024-01-24 16:27:40 UTC", "id": 25, "name": "acd", "expires_at": "2024-01-26" }, "event_name": "expiring_access_token" } ``` Payload example for group: ```json { "object_kind": "access_token", "group": { "group_name": "Twitter", "group_path": "twitter", "group_id": 35, "full_path": "twitter" }, "object_attributes": { "user_id": 90, "created_at": "2024-01-24 16:27:40 UTC", "id": 25, "name": "acd", "expires_at": "2024-01-26" }, "event_name": "expiring_access_token" } ``` ## Vulnerability events {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/169701) in GitLab 17.7 [with a flag](../../../administration/feature_flags/_index.md) named `vulnerabilities_as_webhook_events`. Disabled by default. - Creating an event when a vulnerability is created or when an issue is linked to a vulnerability [introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/176064) in GitLab 17.8. - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/issues/528397) in GitLab 17.11. Feature flag `vulnerabilities_as_webhook_events` removed. {{< /history >}} A vulnerability event is triggered when: - A vulnerability is created. - A vulnerability's [status is changed](../../application_security/vulnerabilities/_index.md#vulnerability-status-values). - An issue is linked to a vulnerability. Request header: ```plaintext X-Gitlab-Event: Vulnerability Hook ``` Payload example: ```json { "object_kind": "vulnerability", "object_attributes": { "url": "https://example.com/flightjs/Flight/-/security/vulnerabilities/1", "title": "REXML DoS vulnerability", "state": "confirmed", "project_id": 50, "location": { "file": "Gemfile.lock", "dependency": { "package": { "name": "rexml" }, "version": "3.3.1" } }, "cvss": [ { "vector": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H", "vendor": "NVD" } ], "severity": "high", "severity_overridden": false, "identifiers": [ { "name": "Gemnasium-29dce398-220a-4315-8c84-16cd8b6d9b05", "external_id": "29dce398-220a-4315-8c84-16cd8b6d9b05", "external_type": "gemnasium", "url": "https://gitlab.com/gitlab-org/security-products/gemnasium-db/-/blob/master/gem/rexml/CVE-2024-41123.yml" }, { "name": "CVE-2024-41123", "external_id": "CVE-2024-41123", "external_type": "cve", "url": "https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2024-41123" } ], "issues": [ { "title": "REXML ReDoS vulnerability", "url": "https://example.com/flightjs/Flight/-/issues/1", "created_at": "2025-01-08T00:46:14.429Z", "updated_at": "2025-01-08T00:46:14.429Z" } ], "report_type": "dependency_scanning", "confidence": "unknown", "confidence_overridden": false, "confirmed_at": "2025-01-08T00:46:14.413Z", "confirmed_by_id": 1, "dismissed_at": null, "dismissed_by_id": null, "resolved_on_default_branch": false, "created_at": "2025-01-08T00:46:14.413Z", "updated_at": "2025-01-08T00:46:14.413Z" } } ```
https://docs.gitlab.com/user/project/linear
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/linear.md
2025-08-13
doc/user/project/integrations
[ "doc", "user", "project", "integrations" ]
linear.md
Plan
Project Management
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Linear
null
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/198297) in GitLab 18.3. {{< /history >}} You can use [Linear](https://linear.app/) as an external issue tracker. To enable the Linear integration in a project: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Integrations**. 1. Select **Linear**. 1. Under **Enable integration**, select the **Active** checkbox. 1. Fill in the required fields: - **Workspace URL**: The URL to the Linear Workspace project to link to this GitLab project. 1. Optional. Select **Test settings**. 1. Select **Save changes**. After you have configured and enabled Linear, you see the Linear link on the GitLab project pages, which takes you to your Linear workspace. For example, this is a configuration for a workspace named `example`: - Workspace URL: `https://linear.app/example` You can also disable [GitLab internal issue tracking](../issues/_index.md) in this project. For more information about the steps and consequences of disabling GitLab issues, see Configure project [visibility](../../public_access.md#change-project-visibility), [features, and permissions](../settings/_index.md#configure-project-features-and-permissions). ## Reference Linear issues in GitLab You can reference your Linear issues using: - `<TEAM>-<ID>`, for example `API-123`, where: - `<TEAM>` is a team identifier - `<ID>` is a number.
--- stage: Plan group: Project Management info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments title: Linear breadcrumbs: - doc - user - project - integrations --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/198297) in GitLab 18.3. {{< /history >}} You can use [Linear](https://linear.app/) as an external issue tracker. To enable the Linear integration in a project: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Integrations**. 1. Select **Linear**. 1. Under **Enable integration**, select the **Active** checkbox. 1. Fill in the required fields: - **Workspace URL**: The URL to the Linear Workspace project to link to this GitLab project. 1. Optional. Select **Test settings**. 1. Select **Save changes**. After you have configured and enabled Linear, you see the Linear link on the GitLab project pages, which takes you to your Linear workspace. For example, this is a configuration for a workspace named `example`: - Workspace URL: `https://linear.app/example` You can also disable [GitLab internal issue tracking](../issues/_index.md) in this project. For more information about the steps and consequences of disabling GitLab issues, see Configure project [visibility](../../public_access.md#change-project-visibility), [features, and permissions](../settings/_index.md#configure-project-features-and-permissions). ## Reference Linear issues in GitLab You can reference your Linear issues using: - `<TEAM>-<ID>`, for example `API-123`, where: - `<TEAM>` is a team identifier - `<ID>` is a number.
https://docs.gitlab.com/user/project/asana
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/asana.md
2025-08-13
doc/user/project/integrations
[ "doc", "user", "project", "integrations" ]
asana.md
Plan
Project Management
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Asana
null
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} {{< history >}} - Support for V1 Asana URL format [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/523692) in GitLab 18.3. {{< /history >}} The Asana integration adds commit messages as comments to Asana tasks. Once enabled, commit messages are checked for Asana task URLs (for example, `https://app.asana.com/1/12345/project/67890/task/987654`) or task IDs starting with `#` (for example, `#987654`). Every task ID found gets the commit comment added to it. You can also close a task with a message containing: `fix #123456`. You can use either of these words: - `fix` - `fixed` - `fixes` - `fixing` - `close` - `closes` - `closed` - `closing` See also the [Asana integration API documentation](../../../api/project_integrations.md#asana). ## Setup In Asana, create a personal access token. [Learn about personal access tokens in Asana](https://developers.asana.com/docs/personal-access-token). Complete these steps in GitLab: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Integrations**. 1. Select **Asana**. 1. Ensure that the **Active** toggle is enabled. 1. Paste the token you generated in Asana. 1. Optional. To restrict this setting to specific branches, list them in the **Restrict to branch** field, separated with commas. 1. Optional. Select **Test settings**. 1. Select **Save changes**.
--- stage: Plan group: Project Management info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments title: Asana breadcrumbs: - doc - user - project - integrations --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} {{< history >}} - Support for V1 Asana URL format [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/523692) in GitLab 18.3. {{< /history >}} The Asana integration adds commit messages as comments to Asana tasks. Once enabled, commit messages are checked for Asana task URLs (for example, `https://app.asana.com/1/12345/project/67890/task/987654`) or task IDs starting with `#` (for example, `#987654`). Every task ID found gets the commit comment added to it. You can also close a task with a message containing: `fix #123456`. You can use either of these words: - `fix` - `fixed` - `fixes` - `fixing` - `close` - `closes` - `closed` - `closing` See also the [Asana integration API documentation](../../../api/project_integrations.md#asana). ## Setup In Asana, create a personal access token. [Learn about personal access tokens in Asana](https://developers.asana.com/docs/personal-access-token). Complete these steps in GitLab: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Integrations**. 1. Select **Asana**. 1. Ensure that the **Active** toggle is enabled. 1. Paste the token you generated in Asana. 1. Optional. To restrict this setting to specific branches, list them in the **Restrict to branch** field, separated with commas. 1. Optional. Select **Test settings**. 1. Select **Save changes**.
https://docs.gitlab.com/user/project/harbor
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/harbor.md
2025-08-13
doc/user/project/integrations
[ "doc", "user", "project", "integrations" ]
harbor.md
Package
Container Registry
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Harbor
null
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} You can use Harbor as the container registry for your GitLab project. [Harbor](https://goharbor.io/) is an open-source registry that can help you manage artifacts across cloud-native compute platforms like Kubernetes and Docker. The Harbor integration can help you if you need GitLab CI/CD and a container image repository. ## Prerequisites In the Harbor instance, ensure that: - The project to be integrated has been created. - The authenticated user has permission to pull, push, and edit images in the Harbor project. ## Configure GitLab GitLab supports integrating Harbor projects at the group or project level. Complete these steps in GitLab: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings** > **Integrations**. 1. Select **Harbor**. 1. Under **Enable integration**, select the **Active** checkbox. 1. Provide the Harbor configuration information: - **Harbor URL**: The base URL of Harbor instance which is being linked to this GitLab project. For example, `https://harbor.example.net`. - **Harbor project name**: The project name in the Harbor instance. For example, `testproject`. - **Username**: Your username in the Harbor instance, which should meet the requirements in [prerequisites](#prerequisites). - **Password**: Password of your username. 1. Select **Save changes**. After the Harbor integration is activated: - The global variables `$HARBOR_USERNAME`, `$HARBOR_HOST`, `$HARBOR_OCI`, `$HARBOR_PASSWORD`, `$HARBOR_URL`, and `$HARBOR_PROJECT` are created for CI/CD use. - The project-level integration settings override the group-level integration settings. ## Security considerations ### Secure your requests to the Harbor APIs For each API request through the Harbor integration, the credentials for your connection to the Harbor API use the `username:password` combination. The following are suggestions for safe use: - Use TLS on the Harbor APIs you connect to. - Follow the principle of least privilege (for access on Harbor) with your credentials. - Have a rotation policy on your credentials. ### CI/CD variable security Malicious code pushed to your `.gitlab-ci.yml` file could compromise your variables, including `$HARBOR_PASSWORD`, and send them to a third-party server. For more details, see [CI/CD variable security](../../../ci/variables/_index.md#cicd-variable-security). ## Use Harbor variables ### Push a Helm chart with an OCI registry Helm supports OCI registries by default. OCI is supported in [Harbor 2.0](https://github.com/goharbor/harbor/releases/tag/v2.0.0) and later. Read more about OCI in Helm's [blog](https://helm.sh/blog/storing-charts-in-oci/) and [documentation](https://helm.sh/docs/topics/registries/#enabling-oci-support). ```yaml helm: stage: helm image: name: dtzar/helm-kubectl:latest entrypoint: [''] variables: # Enable OCI support (not required since Helm v3.8.0) HELM_EXPERIMENTAL_OCI: 1 script: # Log in to the Helm registry - helm registry login "${HARBOR_URL}" -u "${HARBOR_USERNAME}" -p "${HARBOR_PASSWORD}" # Package your Helm chart, which is in the `test` directory - helm package test # Your helm chart is created with <chart name>-<chart release>.tgz # You can push all building charts to your Harbor repository - helm push test-*.tgz ${HARBOR_OCI}/${HARBOR_PROJECT} ```
--- stage: Package group: Container Registry info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments title: Harbor breadcrumbs: - doc - user - project - integrations --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} You can use Harbor as the container registry for your GitLab project. [Harbor](https://goharbor.io/) is an open-source registry that can help you manage artifacts across cloud-native compute platforms like Kubernetes and Docker. The Harbor integration can help you if you need GitLab CI/CD and a container image repository. ## Prerequisites In the Harbor instance, ensure that: - The project to be integrated has been created. - The authenticated user has permission to pull, push, and edit images in the Harbor project. ## Configure GitLab GitLab supports integrating Harbor projects at the group or project level. Complete these steps in GitLab: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings** > **Integrations**. 1. Select **Harbor**. 1. Under **Enable integration**, select the **Active** checkbox. 1. Provide the Harbor configuration information: - **Harbor URL**: The base URL of Harbor instance which is being linked to this GitLab project. For example, `https://harbor.example.net`. - **Harbor project name**: The project name in the Harbor instance. For example, `testproject`. - **Username**: Your username in the Harbor instance, which should meet the requirements in [prerequisites](#prerequisites). - **Password**: Password of your username. 1. Select **Save changes**. After the Harbor integration is activated: - The global variables `$HARBOR_USERNAME`, `$HARBOR_HOST`, `$HARBOR_OCI`, `$HARBOR_PASSWORD`, `$HARBOR_URL`, and `$HARBOR_PROJECT` are created for CI/CD use. - The project-level integration settings override the group-level integration settings. ## Security considerations ### Secure your requests to the Harbor APIs For each API request through the Harbor integration, the credentials for your connection to the Harbor API use the `username:password` combination. The following are suggestions for safe use: - Use TLS on the Harbor APIs you connect to. - Follow the principle of least privilege (for access on Harbor) with your credentials. - Have a rotation policy on your credentials. ### CI/CD variable security Malicious code pushed to your `.gitlab-ci.yml` file could compromise your variables, including `$HARBOR_PASSWORD`, and send them to a third-party server. For more details, see [CI/CD variable security](../../../ci/variables/_index.md#cicd-variable-security). ## Use Harbor variables ### Push a Helm chart with an OCI registry Helm supports OCI registries by default. OCI is supported in [Harbor 2.0](https://github.com/goharbor/harbor/releases/tag/v2.0.0) and later. Read more about OCI in Helm's [blog](https://helm.sh/blog/storing-charts-in-oci/) and [documentation](https://helm.sh/docs/topics/registries/#enabling-oci-support). ```yaml helm: stage: helm image: name: dtzar/helm-kubectl:latest entrypoint: [''] variables: # Enable OCI support (not required since Helm v3.8.0) HELM_EXPERIMENTAL_OCI: 1 script: # Log in to the Helm registry - helm registry login "${HARBOR_URL}" -u "${HARBOR_USERNAME}" -p "${HARBOR_PASSWORD}" # Package your Helm chart, which is in the `test` directory - helm package test # Your helm chart is created with <chart name>-<chart release>.tgz # You can push all building charts to your Harbor repository - helm push test-*.tgz ${HARBOR_OCI}/${HARBOR_PROJECT} ```
https://docs.gitlab.com/user/project/slack
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/slack.md
2025-08-13
doc/user/project/integrations
[ "doc", "user", "project", "integrations" ]
slack.md
Plan
Project Management
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Slack notifications (deprecated)
null
<!--- start_remove The following content will be removed on remove_date: '2026-05-16' --> {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} {{< alert type="warning" >}} This feature was [deprecated](https://gitlab.com/gitlab-org/gitlab/-/issues/435909) in GitLab 15.9 and is planned for removal in 19.0. Use the [GitLab for Slack app](gitlab_slack_application.md) instead. This change is a breaking change. {{< /alert >}} The Slack notifications integration enables your GitLab project to send events (such as issue creation) to your existing Slack team as notifications. Setting up Slack notifications requires configuration changes for both Slack and GitLab. You can also use [Slack slash commands](slack_slash_commands.md) to control GitLab from Slack. Slash commands are configured separately. ## Configure Slack 1. Sign in to your Slack team and [start a new Incoming WebHooks configuration](https://my.slack.com/services/new/incoming-webhook). 1. Identify the Slack channel where notifications should be sent to by default. Select **Add Incoming WebHooks integration** to add the configuration. 1. Copy the **Webhook URL** to use later when you configure GitLab. ## Configure GitLab {{< history >}} - [Changed](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/106760) in GitLab 15.9 to limit Slack channels to 10 per event. {{< /history >}} 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Integrations**. 1. Select **Slack notifications**. 1. Under **Enable integration**, select the **Active** checkbox. 1. In the **Trigger** section, select the checkboxes for each type of GitLab event to send to Slack as a notification. For a full list, see [Triggers for Slack notifications](#triggers-for-slack-notifications). By default, messages are sent to the channel you configured during [Slack configuration](#configure-slack). 1. Optional. To send messages to a different channel, multiple channels, or as a direct message: - *To send messages to channels,* enter the Slack channel names, separated by commas. - *To send direct messages,* use the Member ID found in the user's Slack profile. 1. In **Webhook**, enter the webhook URL you copied in the [Slack configuration](#configure-slack) step. 1. Optional. In **Username**, enter the username of the Slack bot that sends the notifications. 1. Select the **Notify only broken pipelines** checkbox to notify only on failures. 1. In the **Branches for which notifications are to be sent** dropdown list, select which types of branches to send notifications for. 1. Leave the **Labels to be notified** field blank to get all notifications, or add labels that the issue or merge request must have to trigger a notification. 1. Optional. Select **Test settings**. 1. Select **Save changes**. Your Slack team now starts receiving GitLab event notifications as configured. ## Triggers for Slack notifications The following triggers are available for Slack notifications: | Trigger name | Trigger event | |--------------------------------------------------------------------------|------------------------------------------------------| | **Push** | A push to the repository. | | **Issue** | An issue is created, closed, or reopened. | | **Incident** | An incident is created, closed, or reopened. | | **Confidential issue** | A confidential issue is created, closed, or reopened.| | **Merge request** | A merge request is created, merged, closed, or reopened.| | **Note** | A comment is added. | | **Confidential note** | An internal note or comment on a confidential issue is added.| | **Tag push** | A new tag is pushed to the repository or removed. | | **Pipeline** | A pipeline status changed. | | **Wiki page** | A wiki page is created or updated. | | **Deployment** | A deployment starts or finishes. | | **Alert** | A new, unique alert is recorded. | | **[Group mention](#trigger-notifications-for-group-mentions) in public** | A group is mentioned in a public context. | | **[Group mention](#trigger-notifications-for-group-mentions) in private** | A group is mentioned in a confidential context. | | [**Vulnerability**](../../application_security/vulnerabilities/_index.md) | A new, unique vulnerability is recorded. | ## Trigger notifications for group mentions {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/417751) in GitLab 16.4. - Restrictions on notification triggers [introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/134677) in GitLab 18.3 [with a feature flag](../../../administration/feature_flags/_index.md) named `group_mention_access_check`. Disabled by default. {{< /history >}} To trigger a [notification event](#triggers-for-slack-notifications) for a group mention, use `@<group_name>` in: - Issue and merge request descriptions - Comments on issues, merge requests, and commits Notifications are triggered only if all direct group members have permission to view the resource (for example, merge request) where the mention is made. A notification will only be sent to at most 3 groups per event. ## Troubleshooting If your Slack integration is not working, start troubleshooting by searching through the [Sidekiq logs](../../../administration/logs/_index.md#sidekiqlog) for errors relating to your Slack service. ### Error: `Something went wrong on our end` You might get this generic error message in the GitLab UI. Review [the logs](../../../administration/logs/_index.md#productionlog) to find the error message and keep troubleshooting from there. ### Error: `certificate verify failed` You might see an entry like the following in your Sidekiq log: ```plaintext 2019-01-10_13:22:08.42572 2019-01-10T13:22:08.425Z 6877 TID-abcdefg Integrations::ExecuteWorker JID-3bade5fb3dd47a85db6d78c5 ERROR: {:class=>"Integrations::ExecuteWorker :integration_class=>"SlackService", :message=>"SSL_connect returned=1 errno=0 state=error: certificate verify failed"} ``` This issue occurs when there is a problem with GitLab communicating with Slack, or GitLab communicating with itself. The former is less likely, as Slack security certificates should always be trusted. To view which of these problems is the cause of the issue: 1. Start a Rails console: ```shell sudo gitlab-rails console -e production # for source installs: bundle exec rails console -e production ``` 1. Run the following commands: ```ruby # replace <SLACK URL> with your actual Slack URL result = Net::HTTP.get(URI('https://<SLACK URL>'));0 # replace <GITLAB URL> with your actual GitLab URL result = Net::HTTP.get(URI('https://<GITLAB URL>'));0 ``` If GitLab does not trust HTTPS connections to itself, [add your certificate to the GitLab trusted certificates](https://docs.gitlab.com/omnibus/settings/ssl/#install-custom-public-certificates). If GitLab does not trust connections to Slack, the GitLab OpenSSL trust store is incorrect. Typical causes are: - Overriding the trust store with `gitlab_rails['env'] = {"SSL_CERT_FILE" => "/path/to/file.pem"}`. - Accidentally modifying the default CA bundle `/opt/gitlab/embedded/ssl/certs/cacert.pem`. ### Bulk update to disable the Slack Notification integration To disable notifications for all projects that have Slack integration enabled, [start a rails console session](../../../administration/operations/rails_console.md#starting-a-rails-console-session) and use a script similar to the following: {{< alert type="warning" >}} Commands that change data can cause damage if not run correctly or under the right conditions. Always run commands in a test environment first and have a backup instance ready to restore. {{< /alert >}} ```ruby # Grab all projects that have the Slack notifications enabled p = Project.find_by_sql("SELECT p.id FROM projects p LEFT JOIN integrations s ON p.id = s.project_id WHERE s.type_new = 'Integrations::Slack' AND s.active = true") # Disable the integration on each of the projects that were found. p.each do |project| project.slack_integration.update!(:active, false) end ``` <!--- end_remove -->
--- stage: Plan group: Project Management info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments title: Slack notifications (deprecated) breadcrumbs: - doc - user - project - integrations --- <!--- start_remove The following content will be removed on remove_date: '2026-05-16' --> {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} {{< alert type="warning" >}} This feature was [deprecated](https://gitlab.com/gitlab-org/gitlab/-/issues/435909) in GitLab 15.9 and is planned for removal in 19.0. Use the [GitLab for Slack app](gitlab_slack_application.md) instead. This change is a breaking change. {{< /alert >}} The Slack notifications integration enables your GitLab project to send events (such as issue creation) to your existing Slack team as notifications. Setting up Slack notifications requires configuration changes for both Slack and GitLab. You can also use [Slack slash commands](slack_slash_commands.md) to control GitLab from Slack. Slash commands are configured separately. ## Configure Slack 1. Sign in to your Slack team and [start a new Incoming WebHooks configuration](https://my.slack.com/services/new/incoming-webhook). 1. Identify the Slack channel where notifications should be sent to by default. Select **Add Incoming WebHooks integration** to add the configuration. 1. Copy the **Webhook URL** to use later when you configure GitLab. ## Configure GitLab {{< history >}} - [Changed](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/106760) in GitLab 15.9 to limit Slack channels to 10 per event. {{< /history >}} 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Integrations**. 1. Select **Slack notifications**. 1. Under **Enable integration**, select the **Active** checkbox. 1. In the **Trigger** section, select the checkboxes for each type of GitLab event to send to Slack as a notification. For a full list, see [Triggers for Slack notifications](#triggers-for-slack-notifications). By default, messages are sent to the channel you configured during [Slack configuration](#configure-slack). 1. Optional. To send messages to a different channel, multiple channels, or as a direct message: - *To send messages to channels,* enter the Slack channel names, separated by commas. - *To send direct messages,* use the Member ID found in the user's Slack profile. 1. In **Webhook**, enter the webhook URL you copied in the [Slack configuration](#configure-slack) step. 1. Optional. In **Username**, enter the username of the Slack bot that sends the notifications. 1. Select the **Notify only broken pipelines** checkbox to notify only on failures. 1. In the **Branches for which notifications are to be sent** dropdown list, select which types of branches to send notifications for. 1. Leave the **Labels to be notified** field blank to get all notifications, or add labels that the issue or merge request must have to trigger a notification. 1. Optional. Select **Test settings**. 1. Select **Save changes**. Your Slack team now starts receiving GitLab event notifications as configured. ## Triggers for Slack notifications The following triggers are available for Slack notifications: | Trigger name | Trigger event | |--------------------------------------------------------------------------|------------------------------------------------------| | **Push** | A push to the repository. | | **Issue** | An issue is created, closed, or reopened. | | **Incident** | An incident is created, closed, or reopened. | | **Confidential issue** | A confidential issue is created, closed, or reopened.| | **Merge request** | A merge request is created, merged, closed, or reopened.| | **Note** | A comment is added. | | **Confidential note** | An internal note or comment on a confidential issue is added.| | **Tag push** | A new tag is pushed to the repository or removed. | | **Pipeline** | A pipeline status changed. | | **Wiki page** | A wiki page is created or updated. | | **Deployment** | A deployment starts or finishes. | | **Alert** | A new, unique alert is recorded. | | **[Group mention](#trigger-notifications-for-group-mentions) in public** | A group is mentioned in a public context. | | **[Group mention](#trigger-notifications-for-group-mentions) in private** | A group is mentioned in a confidential context. | | [**Vulnerability**](../../application_security/vulnerabilities/_index.md) | A new, unique vulnerability is recorded. | ## Trigger notifications for group mentions {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/417751) in GitLab 16.4. - Restrictions on notification triggers [introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/134677) in GitLab 18.3 [with a feature flag](../../../administration/feature_flags/_index.md) named `group_mention_access_check`. Disabled by default. {{< /history >}} To trigger a [notification event](#triggers-for-slack-notifications) for a group mention, use `@<group_name>` in: - Issue and merge request descriptions - Comments on issues, merge requests, and commits Notifications are triggered only if all direct group members have permission to view the resource (for example, merge request) where the mention is made. A notification will only be sent to at most 3 groups per event. ## Troubleshooting If your Slack integration is not working, start troubleshooting by searching through the [Sidekiq logs](../../../administration/logs/_index.md#sidekiqlog) for errors relating to your Slack service. ### Error: `Something went wrong on our end` You might get this generic error message in the GitLab UI. Review [the logs](../../../administration/logs/_index.md#productionlog) to find the error message and keep troubleshooting from there. ### Error: `certificate verify failed` You might see an entry like the following in your Sidekiq log: ```plaintext 2019-01-10_13:22:08.42572 2019-01-10T13:22:08.425Z 6877 TID-abcdefg Integrations::ExecuteWorker JID-3bade5fb3dd47a85db6d78c5 ERROR: {:class=>"Integrations::ExecuteWorker :integration_class=>"SlackService", :message=>"SSL_connect returned=1 errno=0 state=error: certificate verify failed"} ``` This issue occurs when there is a problem with GitLab communicating with Slack, or GitLab communicating with itself. The former is less likely, as Slack security certificates should always be trusted. To view which of these problems is the cause of the issue: 1. Start a Rails console: ```shell sudo gitlab-rails console -e production # for source installs: bundle exec rails console -e production ``` 1. Run the following commands: ```ruby # replace <SLACK URL> with your actual Slack URL result = Net::HTTP.get(URI('https://<SLACK URL>'));0 # replace <GITLAB URL> with your actual GitLab URL result = Net::HTTP.get(URI('https://<GITLAB URL>'));0 ``` If GitLab does not trust HTTPS connections to itself, [add your certificate to the GitLab trusted certificates](https://docs.gitlab.com/omnibus/settings/ssl/#install-custom-public-certificates). If GitLab does not trust connections to Slack, the GitLab OpenSSL trust store is incorrect. Typical causes are: - Overriding the trust store with `gitlab_rails['env'] = {"SSL_CERT_FILE" => "/path/to/file.pem"}`. - Accidentally modifying the default CA bundle `/opt/gitlab/embedded/ssl/certs/cacert.pem`. ### Bulk update to disable the Slack Notification integration To disable notifications for all projects that have Slack integration enabled, [start a rails console session](../../../administration/operations/rails_console.md#starting-a-rails-console-session) and use a script similar to the following: {{< alert type="warning" >}} Commands that change data can cause damage if not run correctly or under the right conditions. Always run commands in a test environment first and have a backup instance ready to restore. {{< /alert >}} ```ruby # Grab all projects that have the Slack notifications enabled p = Project.find_by_sql("SELECT p.id FROM projects p LEFT JOIN integrations s ON p.id = s.project_id WHERE s.type_new = 'Integrations::Slack' AND s.active = true") # Disable the integration on each of the projects that were found. p.each do |project| project.slack_integration.update!(:active, false) end ``` <!--- end_remove -->
https://docs.gitlab.com/user/project/irker
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/irker.md
2025-08-13
doc/user/project/integrations
[ "doc", "user", "project", "integrations" ]
irker.md
Plan
Project Management
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
irker (IRC gateway)
Configure the irker integration to send GitLab push notifications to IRC channels.
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} GitLab provides a way to push update messages to an irker server. After you configure the integration, each push to a project triggers the integration to send data directly to the irker server. See also the [irker integration API documentation](../../../api/project_integrations.md). For more information, see the [irker project homepage](https://gitlab.com/esr/irker). ## Set up an irker daemon You need to set up an irker daemon. To do so: 1. Download the irker code [from its repository](https://gitlab.com/esr/irker): ```shell git clone https://gitlab.com/esr/irker.git ``` 1. Run the Python script named `irkerd`. This is the gateway script. It acts both as an IRC client, for sending messages to an IRC server, and as a TCP server, for receiving messages from the GitLab service. If the irker server runs on the same machine, you are done. If not, you need to follow the first steps of the next section. {{< alert type="warning" >}} irker does **not** have built-in authentication, which makes it vulnerable to spamming IRC channels if it is hosted outside of a firewall. To prevent abuse, make sure you run the daemon on a secured network. For more details, read [Security analysis of irker](http://www.catb.org/~esr/irker/security.html). {{< /alert >}} ## Complete these steps in GitLab 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings** > **Integrations**. 1. Select **irker (IRC gateway)**. 1. Ensure that the **Active** toggle is enabled. 1. Optional. Under **Server host**, enter the server host address where `irkerd` runs. If empty, it defaults to `localhost`. 1. Optional. Under **Server port**, enter the server port of `irkerd`. If empty, it defaults to `6659`. 1. Optional. Under **Default IRC URI**, enter the default IRC URI, in the format `irc[s]://domain.name`. It's prepended to every channel or user provided under **Recipients**, which is not a full URI. 1. Under **Recipients**, enter the users or channels to receive updates, separated by spaces (for example, `#channel1 user1`). For more details, see [Enter irker recipients](#enter-irker-recipients). 1. Optional. To highlight messages, select the **Colorize messages** checkbox. 1. Optional. Select **Test settings**. 1. Select **Save changes**. ## Enter irker recipients If you left the **Default IRC URI** field empty, enter recipients as a full URI: `irc[s]://irc.network.net[:port]/#channel`. If you entered a default IRC URI there, you can use just channel or user names. To send messages: - To a channel (for example, `#chan`), irker accepts channel names of the form `chan` and `#chan`. - To a password-protected channel, append `?key=thesecretpassword` to the channel name, with the channel password instead of `thesecretpassword`. For example, `chan?key=hunter2`. Do **not** put the `#` sign in front of the channel name. If you do, irker tries to join a channel named `#chan?key=password` and so it can leak the channel password through the `/whois` IRC command. This is due to a long-standing irker bug. - In a user query, add `,isnick` after the user name. For example, `UserSmith,isnick`.
--- stage: Plan group: Project Management info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments title: irker (IRC gateway) description: Configure the irker integration to send GitLab push notifications to IRC channels. breadcrumbs: - doc - user - project - integrations --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} GitLab provides a way to push update messages to an irker server. After you configure the integration, each push to a project triggers the integration to send data directly to the irker server. See also the [irker integration API documentation](../../../api/project_integrations.md). For more information, see the [irker project homepage](https://gitlab.com/esr/irker). ## Set up an irker daemon You need to set up an irker daemon. To do so: 1. Download the irker code [from its repository](https://gitlab.com/esr/irker): ```shell git clone https://gitlab.com/esr/irker.git ``` 1. Run the Python script named `irkerd`. This is the gateway script. It acts both as an IRC client, for sending messages to an IRC server, and as a TCP server, for receiving messages from the GitLab service. If the irker server runs on the same machine, you are done. If not, you need to follow the first steps of the next section. {{< alert type="warning" >}} irker does **not** have built-in authentication, which makes it vulnerable to spamming IRC channels if it is hosted outside of a firewall. To prevent abuse, make sure you run the daemon on a secured network. For more details, read [Security analysis of irker](http://www.catb.org/~esr/irker/security.html). {{< /alert >}} ## Complete these steps in GitLab 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings** > **Integrations**. 1. Select **irker (IRC gateway)**. 1. Ensure that the **Active** toggle is enabled. 1. Optional. Under **Server host**, enter the server host address where `irkerd` runs. If empty, it defaults to `localhost`. 1. Optional. Under **Server port**, enter the server port of `irkerd`. If empty, it defaults to `6659`. 1. Optional. Under **Default IRC URI**, enter the default IRC URI, in the format `irc[s]://domain.name`. It's prepended to every channel or user provided under **Recipients**, which is not a full URI. 1. Under **Recipients**, enter the users or channels to receive updates, separated by spaces (for example, `#channel1 user1`). For more details, see [Enter irker recipients](#enter-irker-recipients). 1. Optional. To highlight messages, select the **Colorize messages** checkbox. 1. Optional. Select **Test settings**. 1. Select **Save changes**. ## Enter irker recipients If you left the **Default IRC URI** field empty, enter recipients as a full URI: `irc[s]://irc.network.net[:port]/#channel`. If you entered a default IRC URI there, you can use just channel or user names. To send messages: - To a channel (for example, `#chan`), irker accepts channel names of the form `chan` and `#chan`. - To a password-protected channel, append `?key=thesecretpassword` to the channel name, with the channel password instead of `thesecretpassword`. For example, `chan?key=hunter2`. Do **not** put the `#` sign in front of the channel name. If you do, irker tries to join a channel named `#chan?key=password` and so it can leak the channel password through the `/whois` IRC command. This is due to a long-standing irker bug. - In a user query, add `,isnick` after the user name. For example, `UserSmith,isnick`.
https://docs.gitlab.com/user/project/mock_ci
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/mock_ci.md
2025-08-13
doc/user/project/integrations
[ "doc", "user", "project", "integrations" ]
mock_ci.md
Verify
Pipeline Execution
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Mock CI
null
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} {{< alert type="note" >}} This integration is only available in a development environment. {{< /alert >}} To set up the mock CI service server, respond to the following endpoints: - `commit_status`: `#{project.namespace.path}/#{project.path}/status/#{sha}.json` - Have your service return `200 { status: ['failed'|'canceled'|'running'|'pending'|'success'|'success-with-warnings'|'skipped'|'not_found'] }`. - If the service returns a 404, the service is interpreted as `pending`. - `build_page`: `#{project.namespace.path}/#{project.path}/status/#{sha}` - Where the build is linked to (whether or not it's implemented). For an example Mock CI server, see [`gitlab-org/gitlab-mock-ci-service`](https://gitlab.com/gitlab-org/gitlab-mock-ci-service).
--- stage: Verify group: Pipeline Execution info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments title: Mock CI breadcrumbs: - doc - user - project - integrations --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} {{< alert type="note" >}} This integration is only available in a development environment. {{< /alert >}} To set up the mock CI service server, respond to the following endpoints: - `commit_status`: `#{project.namespace.path}/#{project.path}/status/#{sha}.json` - Have your service return `200 { status: ['failed'|'canceled'|'running'|'pending'|'success'|'success-with-warnings'|'skipped'|'not_found'] }`. - If the service returns a 404, the service is interpreted as `pending`. - `build_page`: `#{project.namespace.path}/#{project.path}/status/#{sha}` - Where the build is linked to (whether or not it's implemented). For an example Mock CI server, see [`gitlab-org/gitlab-mock-ci-service`](https://gitlab.com/gitlab-org/gitlab-mock-ci-service).
https://docs.gitlab.com/user/project/mattermost
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/mattermost.md
2025-08-13
doc/user/project/integrations
[ "doc", "user", "project", "integrations" ]
mattermost.md
Plan
Project Management
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Mattermost notifications
Configure Mattermost notifications to receive notifications from GitLab in Mattermost channels.
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} Use the Mattermost notifications integration to send notifications for GitLab events (for example, `issue created`) to Mattermost. You must configure both [Mattermost](#configure-mattermost-to-receive-gitlab-notifications) and [GitLab](#configure-gitlab-to-send-notifications-to-mattermost). You can also use [Mattermost slash commands](mattermost_slash_commands.md) to control GitLab inside Mattermost. ## Configure Mattermost to receive GitLab notifications To use the Mattermost integration you must create an incoming webhook integration in Mattermost: 1. Sign in to your Mattermost instance. 1. [Enable incoming webhooks](https://docs.mattermost.com/configure/integrations-configuration-settings.html#enable-incoming-webhooks). 1. [Add an incoming webhook](https://developers.mattermost.com/integrate/webhooks/incoming/#create-an-incoming-webhook). 1. Choose a display name, description and channel, those can be overridden on GitLab. 1. Save it and copy the **Webhook URL** because we need this later for GitLab. Incoming Webhooks might be blocked on your Mattermost instance. Ask your Mattermost administrator to enable it on: - **Mattermost System Console > Integrations > Integration Management** in Mattermost versions 5.12 and later. - **Mattermost System Console > Integrations > Custom Integrations** in Mattermost versions 5.11 and earlier. Display name override is not enabled by default, you need to ask your administrator to enable it on that same section. ## Configure GitLab to send notifications to Mattermost {{< history >}} - [Changed](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/106760) in GitLab 15.9 to limit Mattermost channels to 10 per event. {{< /history >}} After the Mattermost instance has an incoming webhook set up, you can set up GitLab to send the notifications: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Integrations**. 1. Select **Mattermost notifications**. 1. Select the GitLab events to generate notifications for. For each event you select, input the Mattermost channel to receive the notification. You do not need to add the hash sign (`#`). 1. Fill in the integration configuration: - **Webhook**: The incoming webhook URL on Mattermost, similar to `http://mattermost.example/hooks/5xo…`. - **Username**: Optional. The username shown in messages sent to Mattermost. To change the bot's username, provide a value. - **Notify only broken pipelines**: If you enable the **Pipeline** event, and you want notifications about failed pipelines only. - **Branches for which notifications are to be sent**: The branches to send notifications for. - **Labels to be notified**: Optional. Labels required for the issue or merge request to trigger a notification. Leave blank to notify for all issues and merge requests. - **Labels to be notified behavior**: When you use the **Labels to be notified** filter, messages are sent when an issue or merge request contains any of the labels specified in the filter. You can also choose to trigger messages only when the issue or merge request contains all the labels defined in the filter.
--- stage: Plan group: Project Management info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments title: Mattermost notifications description: Configure Mattermost notifications to receive notifications from GitLab in Mattermost channels. breadcrumbs: - doc - user - project - integrations --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} Use the Mattermost notifications integration to send notifications for GitLab events (for example, `issue created`) to Mattermost. You must configure both [Mattermost](#configure-mattermost-to-receive-gitlab-notifications) and [GitLab](#configure-gitlab-to-send-notifications-to-mattermost). You can also use [Mattermost slash commands](mattermost_slash_commands.md) to control GitLab inside Mattermost. ## Configure Mattermost to receive GitLab notifications To use the Mattermost integration you must create an incoming webhook integration in Mattermost: 1. Sign in to your Mattermost instance. 1. [Enable incoming webhooks](https://docs.mattermost.com/configure/integrations-configuration-settings.html#enable-incoming-webhooks). 1. [Add an incoming webhook](https://developers.mattermost.com/integrate/webhooks/incoming/#create-an-incoming-webhook). 1. Choose a display name, description and channel, those can be overridden on GitLab. 1. Save it and copy the **Webhook URL** because we need this later for GitLab. Incoming Webhooks might be blocked on your Mattermost instance. Ask your Mattermost administrator to enable it on: - **Mattermost System Console > Integrations > Integration Management** in Mattermost versions 5.12 and later. - **Mattermost System Console > Integrations > Custom Integrations** in Mattermost versions 5.11 and earlier. Display name override is not enabled by default, you need to ask your administrator to enable it on that same section. ## Configure GitLab to send notifications to Mattermost {{< history >}} - [Changed](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/106760) in GitLab 15.9 to limit Mattermost channels to 10 per event. {{< /history >}} After the Mattermost instance has an incoming webhook set up, you can set up GitLab to send the notifications: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Integrations**. 1. Select **Mattermost notifications**. 1. Select the GitLab events to generate notifications for. For each event you select, input the Mattermost channel to receive the notification. You do not need to add the hash sign (`#`). 1. Fill in the integration configuration: - **Webhook**: The incoming webhook URL on Mattermost, similar to `http://mattermost.example/hooks/5xo…`. - **Username**: Optional. The username shown in messages sent to Mattermost. To change the bot's username, provide a value. - **Notify only broken pipelines**: If you enable the **Pipeline** event, and you want notifications about failed pipelines only. - **Branches for which notifications are to be sent**: The branches to send notifications for. - **Labels to be notified**: Optional. Labels required for the issue or merge request to trigger a notification. Leave blank to notify for all issues and merge requests. - **Labels to be notified behavior**: When you use the **Labels to be notified** filter, messages are sent when an issue or merge request contains any of the labels specified in the filter. You can also choose to trigger messages only when the issue or merge request contains all the labels defined in the filter.
https://docs.gitlab.com/user/project/telegram
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/telegram.md
2025-08-13
doc/user/project/integrations
[ "doc", "user", "project", "integrations" ]
telegram.md
Plan
Project Management
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Telegram
Configure the Telegram integration to receive notifications from GitLab in Telegram chats or channels.
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/122879) in GitLab 16.1. {{< /history >}} You can configure GitLab to send notifications to a Telegram chat or channel. To set up the Telegram integration, you must: 1. [Create a Telegram bot](#create-a-telegram-bot). 1. [Configure the Telegram bot](#configure-the-telegram-bot). 1. [Set up the Telegram integration in GitLab](#set-up-the-telegram-integration-in-gitlab). ## Create a Telegram bot To create a bot in Telegram: 1. Start a new chat with `@BotFather`. 1. [Create a new bot](https://core.telegram.org/bots/features#creating-a-new-bot) as described in the Telegram documentation. When you create a bot, `BotFather` provides you with an API token. Keep this token secure as you need it to authenticate the bot in Telegram. ## Configure the Telegram bot To configure the bot in Telegram: 1. Add the bot as an administrator to a new or existing channel. 1. Assign the bot `Post Messages` rights to receive events. 1. Create an identifier for the channel. - For public channels, enter a public link and copy the channel identifier (for example, `https:/t.me/MY_IDENTIFIER`). - For private channels, use the [`getUpdates`](https://telegram-bot-sdk.readme.io/reference/getupdates) method with your API token and copy the channel identifier (for example, `-2241293890657`). ## Set up the Telegram integration in GitLab {{< history >}} - **Message thread ID** [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/441097) in GitLab 16.11. - **Hostname** [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/461313) in GitLab 17.1. {{< /history >}} After you invite the bot to a Telegram channel, you can configure GitLab to send notifications: 1. To enable the integration: - **For your group or project**: 1. On the left sidebar, select **Search or go to** and find your project or group. 1. Select **Settings > Integrations**. - **For your instance**: 1. On the left sidebar, at the bottom, select **Admin**. 1. Select **Settings > Integrations**. 1. Select **Telegram**. 1. Under **Enable integration**, select the **Active** checkbox. 1. Optional. In **Hostname**, enter the hostname of your [local bot API server](https://core.telegram.org/bots/api#using-a-local-bot-api-server). 1. In **Token**, [paste the token value from the Telegram bot](#create-a-telegram-bot). 1. In the **Trigger** section, select the checkboxes for the GitLab events you want to receive in Telegram. 1. In the **Notification settings** section: - In **Channel identifier**, [paste the Telegram channel identifier](#configure-the-telegram-bot). - Optional. In **Message thread ID**, paste the unique identifier for the target message thread (topic in a forum supergroup). - Optional. Select the **Notify only broken pipelines** checkbox to receive notifications for failed pipelines only. - Optional. From the **Branches for which notifications are to be sent** dropdown list, select the branches you want to receive notifications for. 1. Optional. Select **Test settings**. 1. Select **Save changes**. The Telegram channel can now receive all selected GitLab events.
--- stage: Plan group: Project Management info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments title: Telegram description: Configure the Telegram integration to receive notifications from GitLab in Telegram chats or channels. breadcrumbs: - doc - user - project - integrations --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/122879) in GitLab 16.1. {{< /history >}} You can configure GitLab to send notifications to a Telegram chat or channel. To set up the Telegram integration, you must: 1. [Create a Telegram bot](#create-a-telegram-bot). 1. [Configure the Telegram bot](#configure-the-telegram-bot). 1. [Set up the Telegram integration in GitLab](#set-up-the-telegram-integration-in-gitlab). ## Create a Telegram bot To create a bot in Telegram: 1. Start a new chat with `@BotFather`. 1. [Create a new bot](https://core.telegram.org/bots/features#creating-a-new-bot) as described in the Telegram documentation. When you create a bot, `BotFather` provides you with an API token. Keep this token secure as you need it to authenticate the bot in Telegram. ## Configure the Telegram bot To configure the bot in Telegram: 1. Add the bot as an administrator to a new or existing channel. 1. Assign the bot `Post Messages` rights to receive events. 1. Create an identifier for the channel. - For public channels, enter a public link and copy the channel identifier (for example, `https:/t.me/MY_IDENTIFIER`). - For private channels, use the [`getUpdates`](https://telegram-bot-sdk.readme.io/reference/getupdates) method with your API token and copy the channel identifier (for example, `-2241293890657`). ## Set up the Telegram integration in GitLab {{< history >}} - **Message thread ID** [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/441097) in GitLab 16.11. - **Hostname** [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/461313) in GitLab 17.1. {{< /history >}} After you invite the bot to a Telegram channel, you can configure GitLab to send notifications: 1. To enable the integration: - **For your group or project**: 1. On the left sidebar, select **Search or go to** and find your project or group. 1. Select **Settings > Integrations**. - **For your instance**: 1. On the left sidebar, at the bottom, select **Admin**. 1. Select **Settings > Integrations**. 1. Select **Telegram**. 1. Under **Enable integration**, select the **Active** checkbox. 1. Optional. In **Hostname**, enter the hostname of your [local bot API server](https://core.telegram.org/bots/api#using-a-local-bot-api-server). 1. In **Token**, [paste the token value from the Telegram bot](#create-a-telegram-bot). 1. In the **Trigger** section, select the checkboxes for the GitLab events you want to receive in Telegram. 1. In the **Notification settings** section: - In **Channel identifier**, [paste the Telegram channel identifier](#configure-the-telegram-bot). - Optional. In **Message thread ID**, paste the unique identifier for the target message thread (topic in a forum supergroup). - Optional. Select the **Notify only broken pipelines** checkbox to receive notifications for failed pipelines only. - Optional. From the **Branches for which notifications are to be sent** dropdown list, select the branches you want to receive notifications for. 1. Optional. Select **Test settings**. 1. Select **Save changes**. The Telegram channel can now receive all selected GitLab events.
https://docs.gitlab.com/user/project/webhooks_troubleshooting
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/webhooks_troubleshooting.md
2025-08-13
doc/user/project/integrations
[ "doc", "user", "project", "integrations" ]
webhooks_troubleshooting.md
Create
Import
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Troubleshooting webhooks
Custom HTTP callbacks, used to send events.
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} Troubleshoot and resolve common issues with GitLab webhooks. ## Debug webhooks Debug GitLab webhooks and capture payloads using these methods: - [Public webhook inspection tools](#use-public-webhook-inspection-tools) - [Webhook request and response details](webhooks.md#inspect-request-and-response-details) - [GitLab Development Kit (GDK)](#use-the-gitlab-development-kit-gdk) - [Private webhook receiver](#create-a-private-webhook-receiver) For information about webhook events and JSON payloads, see [webhook events](webhook_events.md). ### Use public webhook inspection tools Use public tools to inspect and test webhook payloads. These tools provide catch-all endpoints for HTTP requests and respond with a `200 OK` status code. {{< alert type="warning" >}} Exercise caution when using public tools, as you might send sensitive data to external services. Use test tokens and rotate any secrets inadvertently sent to third parties. For enhanced privacy, [create a private webhook receiver](#create-a-private-webhook-receiver). {{< /alert >}} Public webhook inspection tools include: <!-- vale gitlab_base.Spelling = NO --> - [Beeceptor](https://beeceptor.com): Create a temporary HTTPS endpoint and inspect incoming payloads. <!-- vale gitlab_base.Spelling = YES --> - [Webhook.site](https://webhook.site): Review incoming payloads. - [Webhook Tester](https://webhook-test.com): Inspect and debug incoming payloads. ### Use the GitLab Development Kit (GDK) For a safer development environment, use the [GitLab Development Kit (GDK)](https://gitlab.com/gitlab-org/gitlab-development-kit) to work with GitLab webhooks locally. Use the GDK to send webhooks from your local GitLab instance to a webhook receiver on your machine. To use this approach, install and configure the GDK. ### Create a private webhook receiver Create your own private webhook receiver if you cannot send webhook payloads to a [public receiver](#use-public-webhook-inspection-tools). Prerequisites: - Ruby is installed on your system. To create a private webhook receiver: 1. Save this script as `print_http_body.rb`: ```ruby require 'webrick' server = WEBrick::HTTPServer.new(:Port => ARGV.first) server.mount_proc '/' do |req, res| puts req.body end trap 'INT' do server.shutdown end server.start ``` 1. Choose an unused port (for example, `8000`) and start the script: ```shell ruby print_http_body.rb 8000 ``` 1. In GitLab, [configure the webhook](webhooks.md#configure-webhooks) with your receiver's URL (for example, `http://receiver.example.com:8000/`). 1. Select **Test**. You should see output similar to: ```plaintext {"before":"077a85dd266e6f3573ef7e9ef8ce3343ad659c4e","after":"95cd4a99e93bc4bbabacfa2cd10e6725b1403c60",<SNIP>} example.com - - [14/May/2014:07:45:26 EDT] "POST / HTTP/1.1" 200 0 - -> / ``` {{< alert type="note" >}} To add this receiver, you might need to [allow requests to the local network](../../../security/webhooks.md). {{< /alert >}} ## Resolve SSL certificate verification errors When SSL verification is enabled, GitLab might fail to verify the SSL certificate of the webhook endpoint with the following error: ```plaintext unable to get local issuer certificate ``` This error typically occurs when the root certificate is not issued by a trusted certificate authority as determined by [CAcert.org](http://www.cacert.org/). To resolve this issue: 1. Use [SSL Checker](https://www.sslshopper.com/ssl-checker.html) to identify specific errors. 1. Check for missing intermediate certificates, a common cause of verification failure. ## Webhook not triggered {{< history >}} - Webhooks not triggered in Silent Mode [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/393639) in GitLab 16.3. {{< /history >}} If a webhook is not triggered, verify that: - The webhook is not [disabled automatically](webhooks.md#auto-disabled-webhooks). - The GitLab instance is not in [Silent Mode](../../../administration/silent_mode/_index.md). - The **Push event activities limit** and **Push event hooks limit** settings in the [**Admin** area](../../../administration/settings/push_event_activities_limit.md) are set to a value greater than `0`.
--- stage: Create group: Import info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments description: Custom HTTP callbacks, used to send events. title: Troubleshooting webhooks breadcrumbs: - doc - user - project - integrations --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} Troubleshoot and resolve common issues with GitLab webhooks. ## Debug webhooks Debug GitLab webhooks and capture payloads using these methods: - [Public webhook inspection tools](#use-public-webhook-inspection-tools) - [Webhook request and response details](webhooks.md#inspect-request-and-response-details) - [GitLab Development Kit (GDK)](#use-the-gitlab-development-kit-gdk) - [Private webhook receiver](#create-a-private-webhook-receiver) For information about webhook events and JSON payloads, see [webhook events](webhook_events.md). ### Use public webhook inspection tools Use public tools to inspect and test webhook payloads. These tools provide catch-all endpoints for HTTP requests and respond with a `200 OK` status code. {{< alert type="warning" >}} Exercise caution when using public tools, as you might send sensitive data to external services. Use test tokens and rotate any secrets inadvertently sent to third parties. For enhanced privacy, [create a private webhook receiver](#create-a-private-webhook-receiver). {{< /alert >}} Public webhook inspection tools include: <!-- vale gitlab_base.Spelling = NO --> - [Beeceptor](https://beeceptor.com): Create a temporary HTTPS endpoint and inspect incoming payloads. <!-- vale gitlab_base.Spelling = YES --> - [Webhook.site](https://webhook.site): Review incoming payloads. - [Webhook Tester](https://webhook-test.com): Inspect and debug incoming payloads. ### Use the GitLab Development Kit (GDK) For a safer development environment, use the [GitLab Development Kit (GDK)](https://gitlab.com/gitlab-org/gitlab-development-kit) to work with GitLab webhooks locally. Use the GDK to send webhooks from your local GitLab instance to a webhook receiver on your machine. To use this approach, install and configure the GDK. ### Create a private webhook receiver Create your own private webhook receiver if you cannot send webhook payloads to a [public receiver](#use-public-webhook-inspection-tools). Prerequisites: - Ruby is installed on your system. To create a private webhook receiver: 1. Save this script as `print_http_body.rb`: ```ruby require 'webrick' server = WEBrick::HTTPServer.new(:Port => ARGV.first) server.mount_proc '/' do |req, res| puts req.body end trap 'INT' do server.shutdown end server.start ``` 1. Choose an unused port (for example, `8000`) and start the script: ```shell ruby print_http_body.rb 8000 ``` 1. In GitLab, [configure the webhook](webhooks.md#configure-webhooks) with your receiver's URL (for example, `http://receiver.example.com:8000/`). 1. Select **Test**. You should see output similar to: ```plaintext {"before":"077a85dd266e6f3573ef7e9ef8ce3343ad659c4e","after":"95cd4a99e93bc4bbabacfa2cd10e6725b1403c60",<SNIP>} example.com - - [14/May/2014:07:45:26 EDT] "POST / HTTP/1.1" 200 0 - -> / ``` {{< alert type="note" >}} To add this receiver, you might need to [allow requests to the local network](../../../security/webhooks.md). {{< /alert >}} ## Resolve SSL certificate verification errors When SSL verification is enabled, GitLab might fail to verify the SSL certificate of the webhook endpoint with the following error: ```plaintext unable to get local issuer certificate ``` This error typically occurs when the root certificate is not issued by a trusted certificate authority as determined by [CAcert.org](http://www.cacert.org/). To resolve this issue: 1. Use [SSL Checker](https://www.sslshopper.com/ssl-checker.html) to identify specific errors. 1. Check for missing intermediate certificates, a common cause of verification failure. ## Webhook not triggered {{< history >}} - Webhooks not triggered in Silent Mode [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/393639) in GitLab 16.3. {{< /history >}} If a webhook is not triggered, verify that: - The webhook is not [disabled automatically](webhooks.md#auto-disabled-webhooks). - The GitLab instance is not in [Silent Mode](../../../administration/silent_mode/_index.md). - The **Push event activities limit** and **Push event hooks limit** settings in the [**Admin** area](../../../administration/settings/push_event_activities_limit.md) are set to a value greater than `0`.
https://docs.gitlab.com/user/project/bugzilla
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/bugzilla.md
2025-08-13
doc/user/project/integrations
[ "doc", "user", "project", "integrations" ]
bugzilla.md
Plan
Project Management
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Bugzilla
null
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} [Bugzilla](https://www.bugzilla.org/) is a web-based general-purpose bug tracking system and testing tool. You can configure Bugzilla as an [external issue tracker](../../../integration/external-issue-tracker.md) in GitLab. To enable the Bugzilla integration in a project: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Integrations**. 1. Select **Bugzilla**. 1. Under **Enable integration**, select the **Active** checkbox. 1. Fill in the required fields: - **Project URL**: The URL to the project in Bugzilla. For example, for a product named "Fire Tanuki": `https://bugzilla.example.org/describecomponents.cgi?product=Fire+Tanuki`. - **Issue URL**: The URL to view an issue in the Bugzilla project. The URL must contain `:id`. GitLab replaces `:id` with the issue number (for example, `https://bugzilla.example.org/show_bug.cgi?id=:id`, which becomes `https://bugzilla.example.org/show_bug.cgi?id=123`). - **New issue URL**: The URL to create a new issue in the linked Bugzilla project. For example, for a project named "My Cool App": `https://bugzilla.example.org/enter_bug.cgi#h=dupes%7CMy+Cool+App`. 1. Optional. Select **Test settings**. 1. Select **Save changes**. After you configure and enable Bugzilla, a link appears on the GitLab project pages. This link takes you to the appropriate Bugzilla project. You can also disable [GitLab internal issue tracking](../issues/_index.md) in this project. For more information about the steps and consequences of disabling GitLab issues, see Configure project [visibility](../../public_access.md#change-project-visibility), [features, and permissions](../settings/_index.md#configure-project-features-and-permissions). ## Reference Bugzilla issues in GitLab You can reference issues in Bugzilla using: - `#<ID>`, where `<ID>` is a number (for example, `#143`). - `<PROJECT>-<ID>` (for example `API_32-143`) where: - `<PROJECT>` starts with a capital letter, followed by capital letters, numbers, or underscores. - `<ID>` is a number. The `<PROJECT>` part is ignored in links, which always point to the address specified in **Issue URL**. We suggest using the longer format (`<PROJECT>-<ID>`) if you have both internal and external issue trackers enabled. If you use the shorter format, and an issue with the same ID exists in the internal issue tracker, the internal issue is linked. ## Troubleshooting For recent integration webhook deliveries, check the integration webhook logs.
--- stage: Plan group: Project Management info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments title: Bugzilla breadcrumbs: - doc - user - project - integrations --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} [Bugzilla](https://www.bugzilla.org/) is a web-based general-purpose bug tracking system and testing tool. You can configure Bugzilla as an [external issue tracker](../../../integration/external-issue-tracker.md) in GitLab. To enable the Bugzilla integration in a project: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Integrations**. 1. Select **Bugzilla**. 1. Under **Enable integration**, select the **Active** checkbox. 1. Fill in the required fields: - **Project URL**: The URL to the project in Bugzilla. For example, for a product named "Fire Tanuki": `https://bugzilla.example.org/describecomponents.cgi?product=Fire+Tanuki`. - **Issue URL**: The URL to view an issue in the Bugzilla project. The URL must contain `:id`. GitLab replaces `:id` with the issue number (for example, `https://bugzilla.example.org/show_bug.cgi?id=:id`, which becomes `https://bugzilla.example.org/show_bug.cgi?id=123`). - **New issue URL**: The URL to create a new issue in the linked Bugzilla project. For example, for a project named "My Cool App": `https://bugzilla.example.org/enter_bug.cgi#h=dupes%7CMy+Cool+App`. 1. Optional. Select **Test settings**. 1. Select **Save changes**. After you configure and enable Bugzilla, a link appears on the GitLab project pages. This link takes you to the appropriate Bugzilla project. You can also disable [GitLab internal issue tracking](../issues/_index.md) in this project. For more information about the steps and consequences of disabling GitLab issues, see Configure project [visibility](../../public_access.md#change-project-visibility), [features, and permissions](../settings/_index.md#configure-project-features-and-permissions). ## Reference Bugzilla issues in GitLab You can reference issues in Bugzilla using: - `#<ID>`, where `<ID>` is a number (for example, `#143`). - `<PROJECT>-<ID>` (for example `API_32-143`) where: - `<PROJECT>` starts with a capital letter, followed by capital letters, numbers, or underscores. - `<ID>` is a number. The `<PROJECT>` part is ignored in links, which always point to the address specified in **Issue URL**. We suggest using the longer format (`<PROJECT>-<ID>`) if you have both internal and external issue trackers enabled. If you use the shorter format, and an issue with the same ID exists in the internal issue tracker, the internal issue is linked. ## Troubleshooting For recent integration webhook deliveries, check the integration webhook logs.
https://docs.gitlab.com/user/project/redmine
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/redmine.md
2025-08-13
doc/user/project/integrations
[ "doc", "user", "project", "integrations" ]
redmine.md
Plan
Project Management
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Redmine
null
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} Prerequisites: - You must disable [GitLab internal issue tracking](../issues/_index.md) in the project. For more information about the steps and consequences of disabling GitLab issues, see [Change project visibility](../../public_access.md#change-project-visibility), and also [Configure project features and permissions](../settings/_index.md#configure-project-features-and-permissions). You can use [Redmine](https://www.redmine.org/) as an external issue tracker. To enable the Redmine integration in a project: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Integrations**. 1. Select **Redmine**. 1. Under **Enable integration**, select the **Active** checkbox. 1. Fill in the required fields: - **Project URL**: The URL to the Redmine project to link to this GitLab project. - **Issue URL**: The URL to the Redmine project issue to link to this GitLab project. The URL must contain `:id`. GitLab replaces this ID with the issue number. - **New issue URL**: The URL to use to create a new issue in the Redmine project linked to this GitLab project. <!-- The line below was originally added in January 2018: https://gitlab.com/gitlab-org/gitlab/-/commit/778b231f3a5dd42ebe195d4719a26bf675093350 --> **This URL is not used and removal is planned in a future release**. For more information, see [issue 327503](https://gitlab.com/gitlab-org/gitlab/-/issues/327503). 1. Optional. Select **Test settings**. 1. Select **Save changes**. After you have configured and enabled Redmine, you see the Redmine link on the GitLab project pages, which takes you to your Redmine project. For example, this is a configuration for a project named `gitlab-ci`: - Project URL: `https://redmine.example.com/projects/gitlab-ci` - Issue URL: `https://redmine.example.com/issues/:id` - New issue URL: `https://redmine.example.com/projects/gitlab-ci/issues/new` ## Reference Redmine issues in GitLab You can reference your Redmine issues using: - `#<ID>`, where `<ID>` is a number (example `#143`). - `<PROJECT>-<ID>`, for example `API_32-143`, where: - `<PROJECT>` starts with a capital letter, followed by capital letters, numbers, or underscores. - `<ID>` is a number. In links, the `<PROJECT>` part is ignored, and they always point to the address specified in **Issue URL**. We suggest using the longer format (`<PROJECT>-<ID>`) if you have both internal and external issue trackers enabled. If you use the shorter format, and an issue with the same ID exists in the internal issue tracker, the internal issue is linked.
--- stage: Plan group: Project Management info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments title: Redmine breadcrumbs: - doc - user - project - integrations --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} Prerequisites: - You must disable [GitLab internal issue tracking](../issues/_index.md) in the project. For more information about the steps and consequences of disabling GitLab issues, see [Change project visibility](../../public_access.md#change-project-visibility), and also [Configure project features and permissions](../settings/_index.md#configure-project-features-and-permissions). You can use [Redmine](https://www.redmine.org/) as an external issue tracker. To enable the Redmine integration in a project: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Integrations**. 1. Select **Redmine**. 1. Under **Enable integration**, select the **Active** checkbox. 1. Fill in the required fields: - **Project URL**: The URL to the Redmine project to link to this GitLab project. - **Issue URL**: The URL to the Redmine project issue to link to this GitLab project. The URL must contain `:id`. GitLab replaces this ID with the issue number. - **New issue URL**: The URL to use to create a new issue in the Redmine project linked to this GitLab project. <!-- The line below was originally added in January 2018: https://gitlab.com/gitlab-org/gitlab/-/commit/778b231f3a5dd42ebe195d4719a26bf675093350 --> **This URL is not used and removal is planned in a future release**. For more information, see [issue 327503](https://gitlab.com/gitlab-org/gitlab/-/issues/327503). 1. Optional. Select **Test settings**. 1. Select **Save changes**. After you have configured and enabled Redmine, you see the Redmine link on the GitLab project pages, which takes you to your Redmine project. For example, this is a configuration for a project named `gitlab-ci`: - Project URL: `https://redmine.example.com/projects/gitlab-ci` - Issue URL: `https://redmine.example.com/issues/:id` - New issue URL: `https://redmine.example.com/projects/gitlab-ci/issues/new` ## Reference Redmine issues in GitLab You can reference your Redmine issues using: - `#<ID>`, where `<ID>` is a number (example `#143`). - `<PROJECT>-<ID>`, for example `API_32-143`, where: - `<PROJECT>` starts with a capital letter, followed by capital letters, numbers, or underscores. - `<ID>` is a number. In links, the `<PROJECT>` part is ignored, and they always point to the address specified in **Issue URL**. We suggest using the longer format (`<PROJECT>-<ID>`) if you have both internal and external issue trackers enabled. If you use the shorter format, and an issue with the same ID exists in the internal issue tracker, the internal issue is linked.
https://docs.gitlab.com/user/project/phorge
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/phorge.md
2025-08-13
doc/user/project/integrations
[ "doc", "user", "project", "integrations" ]
phorge.md
Plan
Project Management
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Phorge
null
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/145863) in GitLab 16.11. {{< /history >}} You can use [Phorge](https://we.phorge.it/) as an external issue tracker in GitLab. ## Configure the integration To configure Phorge in a GitLab project: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Integrations**. 1. Select **Phorge**. 1. Under **Enable integration**, select the **Active** checkbox. 1. In **Project URL**, enter the URL to the Phorge project. 1. In **Issue URL**, enter the URL to the Phorge project issue. The URL must contain `:id`. GitLab replaces this token with the Maniphest task ID (for example, `T123`). 1. In **New issue URL**, enter the URL to a new Phorge project issue. To prefill tags related to this project, you can use `?tags=`. 1. Optional. Select **Test settings**. 1. Select **Save changes**. In that GitLab project, you can see a link to your Phorge project. You can now reference your Phorge issues and tasks in GitLab with `T<ID>`, where `<ID>` is a Maniphest task ID (for example, `T123`).
--- stage: Plan group: Project Management info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments title: Phorge breadcrumbs: - doc - user - project - integrations --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/145863) in GitLab 16.11. {{< /history >}} You can use [Phorge](https://we.phorge.it/) as an external issue tracker in GitLab. ## Configure the integration To configure Phorge in a GitLab project: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Integrations**. 1. Select **Phorge**. 1. Under **Enable integration**, select the **Active** checkbox. 1. In **Project URL**, enter the URL to the Phorge project. 1. In **Issue URL**, enter the URL to the Phorge project issue. The URL must contain `:id`. GitLab replaces this token with the Maniphest task ID (for example, `T123`). 1. In **New issue URL**, enter the URL to a new Phorge project issue. To prefill tags related to this project, you can use `?tags=`. 1. Optional. Select **Test settings**. 1. Select **Save changes**. In that GitLab project, you can see a link to your Phorge project. You can now reference your Phorge issues and tasks in GitLab with `T<ID>`, where `<ID>` is a Maniphest task ID (for example, `T123`).
https://docs.gitlab.com/user/project/webex_teams
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/webex_teams.md
2025-08-13
doc/user/project/integrations
[ "doc", "user", "project", "integrations" ]
webex_teams.md
Plan
Project Management
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Webex Teams
Send event notifications from GitLab to Webex Teams spaces with webhooks.
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} You can configure GitLab to send notifications to a Webex Teams space: 1. Create a webhook for the space. 1. Add the webhook to GitLab. ## Create a webhook for the space 1. Go to the [Incoming Webhooks app page](https://apphub.webex.com/applications/incoming-webhooks-cisco-systems-38054-23307-75252). 1. Select **Connect**, and sign in to Webex Teams if required. 1. Enter a name for the webhook and select the space to receive the notifications. 1. Select **ADD**. 1. Copy the **Webhook URL**. ## Configure settings in GitLab After you have a webhook URL for your Webex Teams space, you can configure GitLab to send notifications: 1. To enable integration: - At the project or group level: 1. On the left sidebar, select **Search or go to** and find your project or group. 1. Select **Settings > Integrations**. - At the instance level: 1. On the left sidebar, at the bottom, select **Admin**. 1. Select **Settings > Integrations**. 1. Select the **Webex Teams** integration. 1. Ensure that the **Active** toggle is enabled. 1. Select the checkboxes corresponding to the GitLab events you want to receive in Webex Teams. 1. Paste the **Webhook** URL for the Webex Teams space. 1. Optional. Select **Test settings**. 1. Select **Save changes**. The Webex Teams space begins to receive all applicable GitLab events.
--- stage: Plan group: Project Management info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments title: Webex Teams description: Send event notifications from GitLab to Webex Teams spaces with webhooks. breadcrumbs: - doc - user - project - integrations --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} You can configure GitLab to send notifications to a Webex Teams space: 1. Create a webhook for the space. 1. Add the webhook to GitLab. ## Create a webhook for the space 1. Go to the [Incoming Webhooks app page](https://apphub.webex.com/applications/incoming-webhooks-cisco-systems-38054-23307-75252). 1. Select **Connect**, and sign in to Webex Teams if required. 1. Enter a name for the webhook and select the space to receive the notifications. 1. Select **ADD**. 1. Copy the **Webhook URL**. ## Configure settings in GitLab After you have a webhook URL for your Webex Teams space, you can configure GitLab to send notifications: 1. To enable integration: - At the project or group level: 1. On the left sidebar, select **Search or go to** and find your project or group. 1. Select **Settings > Integrations**. - At the instance level: 1. On the left sidebar, at the bottom, select **Admin**. 1. Select **Settings > Integrations**. 1. Select the **Webex Teams** integration. 1. Ensure that the **Active** toggle is enabled. 1. Select the checkboxes corresponding to the GitLab events you want to receive in Webex Teams. 1. Paste the **Webhook** URL for the Webex Teams space. 1. Optional. Select **Test settings**. 1. Select **Save changes**. The Webex Teams space begins to receive all applicable GitLab events.
https://docs.gitlab.com/user/project/git_guardian
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/git_guardian.md
2025-08-13
doc/user/project/integrations
[ "doc", "user", "project", "integrations" ]
git_guardian.md
Create
Source Code
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
GitGuardian
Integrate GitLab with GitGuardian to get alerts for policy violations and security issues before they can be exploited.
{{< details >}} - Tier: Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/435706) in GitLab 16.9 [with a flag](../../../administration/feature_flags/_index.md) named `git_guardian_integration`. Enabled by default. Disabled on GitLab.com. - [Enabled on GitLab.com](https://gitlab.com/gitlab-org/gitlab/-/issues/438695#note_2226917025) in GitLab 17.7. - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/176391) in GitLab 17.8. Feature flag `git_guardian_integration` removed. {{< /history >}} [GitGuardian](https://www.gitguardian.com/) is a cybersecurity service that detects sensitive data such as API keys and passwords in source code repositories. It scans Git repositories, alerts on policy violations, and helps organizations fix security issues before hackers can exploit them. You can configure GitLab to reject commits based on GitGuardian policies. To set up the GitGuardian integration: 1. [Create a GitGuardian API token](#create-a-gitguardian-api-token). 1. [Set up the GitGuardian integration for your project](#set-up-the-gitguardian-integration-for-your-project). ## Create a GitGuardian API token Prerequisites: - You must have a GitGuardian account. To create an API token: 1. Sign in to your GitGuardian account. 1. Go to the **API** section in the sidebar. 1. In the API section sidebar go to **Personal access tokens** page. 1. Select **Create token**. The token creation dialog opens. 1. Provide your token information: - Give your API token a meaningful name to identify its purpose. For example, `GitLab integration token`. - Select an appropriate expiration. - Select the **scan scope** checkbox. It is the only one needed for the integration. 1. Select **Create token**. 1. After you've generated a token, copy it to your clipboard. This token is sensitive information, so keep it secure. Now you have successfully created a GitGuardian API token that you can use to for our integration. ## Set up the GitGuardian integration for your project Prerequisites: - You must have at least the Maintainer role for the project. After you have created and copied your API token, configure GitLab to reject commits: To enable the integration for your project: 1. On the left sidebar, select **Search or go to** and find your project or group. 1. Select **Settings > Integrations**. 1. Select **GitGuardian**. 1. In **Enable integration**, select the **Active** checkbox. 1. In **API token**, [paste the token value from GitGuardian](#create-a-gitguardian-api-token). 1. Optional. Select **Test settings**. 1. Select **Save changes**. GitLab is now ready to reject commits based on GitGuardian policies. ## Skip secret detection {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/152064) in GitLab 17.0. {{< /history >}} You can skip GitGuardian secret detection, if needed. The options to skip secret detection for all commits in a push are identical to the options for [Native Secret Detection](../../application_security/secret_detection/secret_push_protection/_index.md#skip-secret-push-protection). Either: - Add `[skip secret push protection]` to one of the commit messages. - Use the `secret_push_protection.skip_all` [push option](../../../topics/git/commit.md#push-options-for-gitguardian-integration). ## Known issues - Pushes can be delayed or can time out. With the GitGuardian integration: - Pushes are sent to a third-party. - GitLab has no control over the connection with GitGuardian or the GitGuardian process. - Due to a [GitGuardian API limitation](https://api.gitguardian.com/docs#operation/multiple_scan), the integration ignores files over the size of 1 MB. They are not scanned. - If a pushed file has a name over 256 characters, the push fails. - For more information, see [GitGuardian API documentation](https://api.gitguardian.com/docs#operation/multiple_scan). Troubleshooting steps below show how to mitigate some of these problems. ## Troubleshooting When working with the GitGuardian integration, you might encounter the following issues. ### `500` HTTP errors You might get an HTTP `500` error. This issue occurs for when requests time out for commits with a lot of changed files. If this issue happens when you change more than 50 files in a commit: 1. Split your changes into smaller commits. 1. Push the smaller commits one by one. ### Error: `Filename: ensure this value has at most 256 characters` You might get an HTTP `400` error that states `Filename: ensure this value has at most 256 characters`. This issue occurs when some of the changed files you are pushing in that commit have the filename (not the path) longer then 256 characters. The workaround is to shorten the filename if possible. For example, if the filename cannot be shortened because it was automatically generated by a framework, disable the integration and try to push again. Don't forget to re-enable the integration afterwards if needed.
--- stage: Create group: Source Code info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments description: Integrate GitLab with GitGuardian to get alerts for policy violations and security issues before they can be exploited. title: GitGuardian breadcrumbs: - doc - user - project - integrations --- {{< details >}} - Tier: Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/435706) in GitLab 16.9 [with a flag](../../../administration/feature_flags/_index.md) named `git_guardian_integration`. Enabled by default. Disabled on GitLab.com. - [Enabled on GitLab.com](https://gitlab.com/gitlab-org/gitlab/-/issues/438695#note_2226917025) in GitLab 17.7. - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/176391) in GitLab 17.8. Feature flag `git_guardian_integration` removed. {{< /history >}} [GitGuardian](https://www.gitguardian.com/) is a cybersecurity service that detects sensitive data such as API keys and passwords in source code repositories. It scans Git repositories, alerts on policy violations, and helps organizations fix security issues before hackers can exploit them. You can configure GitLab to reject commits based on GitGuardian policies. To set up the GitGuardian integration: 1. [Create a GitGuardian API token](#create-a-gitguardian-api-token). 1. [Set up the GitGuardian integration for your project](#set-up-the-gitguardian-integration-for-your-project). ## Create a GitGuardian API token Prerequisites: - You must have a GitGuardian account. To create an API token: 1. Sign in to your GitGuardian account. 1. Go to the **API** section in the sidebar. 1. In the API section sidebar go to **Personal access tokens** page. 1. Select **Create token**. The token creation dialog opens. 1. Provide your token information: - Give your API token a meaningful name to identify its purpose. For example, `GitLab integration token`. - Select an appropriate expiration. - Select the **scan scope** checkbox. It is the only one needed for the integration. 1. Select **Create token**. 1. After you've generated a token, copy it to your clipboard. This token is sensitive information, so keep it secure. Now you have successfully created a GitGuardian API token that you can use to for our integration. ## Set up the GitGuardian integration for your project Prerequisites: - You must have at least the Maintainer role for the project. After you have created and copied your API token, configure GitLab to reject commits: To enable the integration for your project: 1. On the left sidebar, select **Search or go to** and find your project or group. 1. Select **Settings > Integrations**. 1. Select **GitGuardian**. 1. In **Enable integration**, select the **Active** checkbox. 1. In **API token**, [paste the token value from GitGuardian](#create-a-gitguardian-api-token). 1. Optional. Select **Test settings**. 1. Select **Save changes**. GitLab is now ready to reject commits based on GitGuardian policies. ## Skip secret detection {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/152064) in GitLab 17.0. {{< /history >}} You can skip GitGuardian secret detection, if needed. The options to skip secret detection for all commits in a push are identical to the options for [Native Secret Detection](../../application_security/secret_detection/secret_push_protection/_index.md#skip-secret-push-protection). Either: - Add `[skip secret push protection]` to one of the commit messages. - Use the `secret_push_protection.skip_all` [push option](../../../topics/git/commit.md#push-options-for-gitguardian-integration). ## Known issues - Pushes can be delayed or can time out. With the GitGuardian integration: - Pushes are sent to a third-party. - GitLab has no control over the connection with GitGuardian or the GitGuardian process. - Due to a [GitGuardian API limitation](https://api.gitguardian.com/docs#operation/multiple_scan), the integration ignores files over the size of 1 MB. They are not scanned. - If a pushed file has a name over 256 characters, the push fails. - For more information, see [GitGuardian API documentation](https://api.gitguardian.com/docs#operation/multiple_scan). Troubleshooting steps below show how to mitigate some of these problems. ## Troubleshooting When working with the GitGuardian integration, you might encounter the following issues. ### `500` HTTP errors You might get an HTTP `500` error. This issue occurs for when requests time out for commits with a lot of changed files. If this issue happens when you change more than 50 files in a commit: 1. Split your changes into smaller commits. 1. Push the smaller commits one by one. ### Error: `Filename: ensure this value has at most 256 characters` You might get an HTTP `400` error that states `Filename: ensure this value has at most 256 characters`. This issue occurs when some of the changed files you are pushing in that commit have the filename (not the path) longer then 256 characters. The workaround is to shorten the filename if possible. For example, if the filename cannot be shortened because it was automatically generated by a framework, disable the integration and try to push again. Don't forget to re-enable the integration afterwards if needed.
https://docs.gitlab.com/user/project/google_artifact_management
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/google_artifact_management.md
2025-08-13
doc/user/project/integrations
[ "doc", "user", "project", "integrations" ]
google_artifact_management.md
Package
Container Registry
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Google Artifact Management
null
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com {{< /details >}} {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/141127) in GitLab 16.10 [with a flag](../../../administration/feature_flags/_index.md) named `google_cloud_support_feature_flag`. This feature is in [beta](../../../policy/development_stages_support.md). - [Enabled on GitLab.com](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/150472) in GitLab 17.1. Feature flag `google_cloud_support_feature_flag` removed. {{< /history >}} You can use the Google Artifact Management integration to configure and connect a [Google Artifact Registry](https://cloud.google.com/artifact-registry) repository to your GitLab project. After you connect the Google Artifact Registry to your project, you can view, push, and pull Docker and [OCI](https://opencontainers.org/) images in a [Google Artifact Registry](https://cloud.google.com/artifact-registry) repository. ## Set up the Google Artifact Registry in a GitLab project Prerequisites: - You must have at least the Maintainer role for the GitLab project. - You must have the [permissions needed](https://cloud.google.com/iam/docs/granting-changing-revoking-access#required-permissions) to manage access to the Google Cloud project with the Artifact Registry repository. - A [workload identity federation](../../../integration/google_cloud_iam.md) (WLIF) pool and provider must be configured to authenticate to Google Cloud. - A [Google Artifact Registry repository](https://cloud.google.com/artifact-registry/docs/repositories) with the following configuration: - [Docker](https://cloud.google.com/artifact-registry/docs/supported-formats) format. - [Standard](https://cloud.google.com/artifact-registry/docs/repositories/create-repos) mode. Other repository formats and modes are not supported. To connect a Google Artifact Registry repository to a GitLab project: 1. In GitLab, on the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Integrations**. 1. Select **Google Artifact Management**. 1. Under **Enable integration**, select the **Active** checkbox. 1. Complete the fields: - **Google Cloud project ID**: The [Google Cloud project ID](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects) where the Artifact Registry repository is located. - **Repository name**: The name of the Artifact Registry repository. - **Repository location**: The [Google Cloud location](https://cloud.google.com/about/locations) of the Artifact Registry repository. 1. Follow the onscreen instructions to set up the Google Cloud Identity and Access Management (IAM) policies. For more information about the types of policies, see [IAM policies](#iam-policies). 1. Select **Save changes**. You should now see a **Google Artifact Registry** entry in the sidebar under **Deploy**. ## View images stored in the Google Artifact Registry Prerequisites: - The Google Artifact Registry must be [configured](google_artifact_management.md#set-up-the-google-artifact-registry-in-a-gitlab-project) in the project. To view the list of images in the connected Artifact Registry repository in the GitLab UI: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Deploy > Google Artifact Registry**. 1. To view the image details, select an image. 1. To view the image in the Google Cloud console, select **Open in Google Cloud**. You must have the [required permissions](https://cloud.google.com/artifact-registry/docs/repositories/list-repos#required_roles) to view that Artifact Registry repository. ## CI/CD ### Predefined variables After the Artifact Registry integration is activated, the following predefined environment variables are available in CI/CD. You can use these environment variables to interact with the Artifact Registry, like pulling or pushing an image to the connected repository. | Variable | GitLab | Runner | Description | |------------------------------------------------|--------|--------|-------------| | `GOOGLE_ARTIFACT_REGISTRY_PROJECT_ID` | 16.10 | 16.10 | The Google Cloud project ID where the Artifact Registry repository is located. | | `GOOGLE_ARTIFACT_REGISTRY_REPOSITORY_NAME` | 16.10 | 16.10 | The name of the connected Artifact Registry repository. | | `GOOGLE_ARTIFACT_REGISTRY_REPOSITORY_LOCATION` | 16.10 | 16.10 | The Google Cloud location of the connected Artifact Registry repository. | ### Authenticate with the Google Artifact Registry You can configure a pipeline to authenticate with the Google Artifact Registry during pipeline execution. GitLab uses the configured [workload identity pool](../../../integration/google_cloud_iam.md) IAM policies and populates the `GOOGLE_APPLICATION_CREDENTIALS` and `CLOUDSDK_AUTH_CREDENTIAL_FILE_OVERRIDE` environment credentials. These environment credentials are automatically detected by client tools, like [gcloud CLI](https://cloud.google.com/sdk/gcloud) and [crane](https://github.com/google/go-containerregistry/blob/main/cmd/crane/README.md). To authenticate with the Google Artifact Registry, in the project's `.gitlab-ci.yml` file, use the [`identity`](../../../ci/yaml/_index.md#identity) keyword set to `google_cloud`. #### IAM policies Your Google Cloud project must have specific IAM policies to use the Google Artifact Management integration. When you [set up this integration](#set-up-the-google-artifact-registry-in-a-gitlab-project), on-screen instructions provide the steps to create the following IAM policies in your Google Cloud project: - Grant [Artifact Registry Reader](https://cloud.google.com/iam/docs/understanding-roles#artifactregistry.reader) role to GitLab project members with [Guest](../../permissions.md#roles) role or above. - Grant [Artifact Registry Writer](https://cloud.google.com/iam/docs/understanding-roles#artifactregistry.writer) role to GitLab project members with [Developer](../../permissions.md#roles) role or above. To create these IAM policies manually, use the following `gcloud` commands. Replace these values: - `<your_google_cloud_project_id>` with the [ID](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects) of the Google Cloud project where the Artifact Registry repository is located. - `<your_workload_identity_pool_id>` with the ID of the workload identity pool. This is the same value used for the [Google Cloud IAM integration](../../../integration/google_cloud_iam.md). - `<your_google_cloud_project_number>` with the [number](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects) of the Google Cloud project where the workload identity pool is located. This is the same value used for the [Google Cloud IAM integration](../../../integration/google_cloud_iam.md). ```shell gcloud projects add-iam-policy-binding '<your_google_cloud_project_id>' \ --member='principalSet://iam.googleapis.com/projects/<your_google_cloud_project_number>/locations/global/workloadIdentityPools/<your_workload_identity_pool_id>/attribute.guest_access/true' \ --role='roles/artifactregistry.reader' gcloud projects add-iam-policy-binding '<your_google_cloud_project_id>' \ --member='principalSet://iam.googleapis.com/projects/<your_google_cloud_project_number>/locations/global/workloadIdentityPools/<your_workload_identity_pool_id>/attribute.developer_access/true' \ --role='roles/artifactregistry.writer' ``` For a list of available claims, see [OIDC custom claims](../../../integration/google_cloud_iam.md#oidc-custom-claims). ### Examples #### Use gcloud CLI to list images ```yaml list-images: image: gcr.io/google.com/cloudsdktool/google-cloud-cli:466.0.0-alpine identity: google_cloud script: - gcloud artifacts docker images list $GOOGLE_ARTIFACT_REGISTRY_REPOSITORY_LOCATION-docker.pkg.dev/$GOOGLE_ARTIFACT_REGISTRY_PROJECT_ID/$GOOGLE_ARTIFACT_REGISTRY_REPOSITORY_NAME/app ``` #### Use crane to list images ```yaml list-images: image: name: gcr.io/go-containerregistry/crane:debug entrypoint: [""] identity: google_cloud before_script: # Temporary workaround for https://github.com/google/go-containerregistry/issues/1886 - wget -q "https://github.com/GoogleCloudPlatform/docker-credential-gcr/releases/download/v2.1.22/docker-credential-gcr_linux_amd64-2.1.22.tar.gz" -O - | tar xz -C /tmp && chmod +x /tmp/docker-credential-gcr && mv /tmp/docker-credential-gcr /usr/bin/ - docker-credential-gcr configure-docker --registries=$GOOGLE_ARTIFACT_REGISTRY_REPOSITORY_LOCATION-docker.pkg.dev script: - crane ls $GOOGLE_ARTIFACT_REGISTRY_REPOSITORY_LOCATION-docker.pkg.dev/$GOOGLE_ARTIFACT_REGISTRY_PROJECT_ID/$GOOGLE_ARTIFACT_REGISTRY_REPOSITORY_NAME/app ``` #### Pull an image with Docker The following example shows how to set up authentication for Docker with the [standalone Docker credential helper](https://cloud.google.com/artifact-registry/docs/docker/authentication#standalone-helper) provided by Google. ```yaml pull-image: image: docker:24.0.5 identity: google_cloud services: - docker:24.0.5-dind variables: # The following two variables ensure that the DinD service starts in TLS # mode and that the Docker CLI is properly configured to communicate with # the API. More details about the importance of this can be found at # https://docs.gitlab.com/ee/ci/docker/using_docker_build.html#use-the-docker-executor-with-docker-in-docker DOCKER_HOST: tcp://docker:2376 DOCKER_TLS_CERTDIR: "/certs" before_script: - wget -q "https://github.com/GoogleCloudPlatform/docker-credential-gcr/releases/download/v2.1.22/docker-credential-gcr_linux_amd64-2.1.22.tar.gz" -O - | tar xz -C /tmp && chmod +x /tmp/docker-credential-gcr && mv /tmp/docker-credential-gcr /usr/bin/ - docker-credential-gcr configure-docker --registries=$GOOGLE_ARTIFACT_REGISTRY_REPOSITORY_LOCATION-docker.pkg.dev script: - docker pull $GOOGLE_ARTIFACT_REGISTRY_REPOSITORY_LOCATION-docker.pkg.dev/$GOOGLE_ARTIFACT_REGISTRY_PROJECT_ID/$GOOGLE_ARTIFACT_REGISTRY_REPOSITORY_NAME/app:v0.1.0 ``` #### Copy an image by using a CI/CD component Google provides the [`upload-artifact-registry`](https://gitlab.com/explore/catalog/google-gitlab-components/artifact-registry) CI/CD component, which you can use to copy an image from the GitLab container registry to Artifact Registry. To use the `upload-artifact-registry` component, add the following to your `.gitlab-ci.yml`: ```yaml include: - component: gitlab.com/google-gitlab-components/artifact-registry/upload-artifact-registry@main inputs: stage: deploy source: $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA target: $GOOGLE_ARTIFACT_REGISTRY_REPOSITORY_LOCATION-docker.pkg.dev/$GOOGLE_ARTIFACT_REGISTRY_PROJECT_ID/$GOOGLE_ARTIFACT_REGISTRY_REPOSITORY_NAME/$CI_PROJECT_NAME:$CI_COMMIT_SHORT_SHA ``` For details, see [the component documentation](https://gitlab.com/explore/catalog/google-gitlab-components/artifact-registry). Using the `upload-artifact-registry` component simplifies copying images to Artifact Registry and is the intended method for this integration. If you want to use Docker or Crane, see the following examples. #### Copy an image by using Docker In the following example, the `gcloud` CLI is used to set up the Docker authentication, as an alternative to the [standalone Docker credential helper](https://cloud.google.com/artifact-registry/docs/docker/authentication#standalone-helper). ```yaml copy-image: image: gcr.io/google.com/cloudsdktool/google-cloud-cli:466.0.0-alpine identity: google_cloud services: - docker:24.0.5-dind variables: SOURCE_IMAGE: $CI_REGISTRY_IMAGE:v0.1.0 TARGET_IMAGE: $GOOGLE_ARTIFACT_REGISTRY_REPOSITORY_LOCATION-docker.pkg.dev/$GOOGLE_ARTIFACT_REGISTRY_PROJECT_ID/$GOOGLE_ARTIFACT_REGISTRY_REPOSITORY_NAME/app:v0.1.0 DOCKER_HOST: tcp://docker:2375 before_script: - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY - gcloud auth configure-docker $GOOGLE_ARTIFACT_REGISTRY_REPOSITORY_LOCATION-docker.pkg.dev script: - docker pull $SOURCE_IMAGE - docker tag $SOURCE_IMAGE $TARGET_IMAGE - docker push $TARGET_IMAGE ``` #### Copy an image by using Crane ```yaml copy-image: image: name: gcr.io/go-containerregistry/crane:debug entrypoint: [""] identity: google_cloud variables: SOURCE_IMAGE: $CI_REGISTRY_IMAGE:v0.1.0 TARGET_IMAGE: $GOOGLE_ARTIFACT_REGISTRY_REPOSITORY_LOCATION-docker.pkg.dev/$GOOGLE_ARTIFACT_REGISTRY_PROJECT_ID/$GOOGLE_ARTIFACT_REGISTRY_REPOSITORY_NAME/app:v0.1.0 before_script: # Temporary workaround for https://github.com/google/go-containerregistry/issues/1886 - wget -q "https://github.com/GoogleCloudPlatform/docker-credential-gcr/releases/download/v2.1.22/docker-credential-gcr_linux_amd64-2.1.22.tar.gz" -O - | tar xz -C /tmp && chmod +x /tmp/docker-credential-gcr && mv /tmp/docker-credential-gcr /usr/bin/ - docker-credential-gcr configure-docker --registries=$GOOGLE_ARTIFACT_REGISTRY_REPOSITORY_LOCATION-docker.pkg.dev script: - crane auth login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY - crane copy $SOURCE_IMAGE $TARGET_IMAGE ```
--- stage: Package group: Container Registry info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments title: Google Artifact Management breadcrumbs: - doc - user - project - integrations --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com {{< /details >}} {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/141127) in GitLab 16.10 [with a flag](../../../administration/feature_flags/_index.md) named `google_cloud_support_feature_flag`. This feature is in [beta](../../../policy/development_stages_support.md). - [Enabled on GitLab.com](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/150472) in GitLab 17.1. Feature flag `google_cloud_support_feature_flag` removed. {{< /history >}} You can use the Google Artifact Management integration to configure and connect a [Google Artifact Registry](https://cloud.google.com/artifact-registry) repository to your GitLab project. After you connect the Google Artifact Registry to your project, you can view, push, and pull Docker and [OCI](https://opencontainers.org/) images in a [Google Artifact Registry](https://cloud.google.com/artifact-registry) repository. ## Set up the Google Artifact Registry in a GitLab project Prerequisites: - You must have at least the Maintainer role for the GitLab project. - You must have the [permissions needed](https://cloud.google.com/iam/docs/granting-changing-revoking-access#required-permissions) to manage access to the Google Cloud project with the Artifact Registry repository. - A [workload identity federation](../../../integration/google_cloud_iam.md) (WLIF) pool and provider must be configured to authenticate to Google Cloud. - A [Google Artifact Registry repository](https://cloud.google.com/artifact-registry/docs/repositories) with the following configuration: - [Docker](https://cloud.google.com/artifact-registry/docs/supported-formats) format. - [Standard](https://cloud.google.com/artifact-registry/docs/repositories/create-repos) mode. Other repository formats and modes are not supported. To connect a Google Artifact Registry repository to a GitLab project: 1. In GitLab, on the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Integrations**. 1. Select **Google Artifact Management**. 1. Under **Enable integration**, select the **Active** checkbox. 1. Complete the fields: - **Google Cloud project ID**: The [Google Cloud project ID](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects) where the Artifact Registry repository is located. - **Repository name**: The name of the Artifact Registry repository. - **Repository location**: The [Google Cloud location](https://cloud.google.com/about/locations) of the Artifact Registry repository. 1. Follow the onscreen instructions to set up the Google Cloud Identity and Access Management (IAM) policies. For more information about the types of policies, see [IAM policies](#iam-policies). 1. Select **Save changes**. You should now see a **Google Artifact Registry** entry in the sidebar under **Deploy**. ## View images stored in the Google Artifact Registry Prerequisites: - The Google Artifact Registry must be [configured](google_artifact_management.md#set-up-the-google-artifact-registry-in-a-gitlab-project) in the project. To view the list of images in the connected Artifact Registry repository in the GitLab UI: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Deploy > Google Artifact Registry**. 1. To view the image details, select an image. 1. To view the image in the Google Cloud console, select **Open in Google Cloud**. You must have the [required permissions](https://cloud.google.com/artifact-registry/docs/repositories/list-repos#required_roles) to view that Artifact Registry repository. ## CI/CD ### Predefined variables After the Artifact Registry integration is activated, the following predefined environment variables are available in CI/CD. You can use these environment variables to interact with the Artifact Registry, like pulling or pushing an image to the connected repository. | Variable | GitLab | Runner | Description | |------------------------------------------------|--------|--------|-------------| | `GOOGLE_ARTIFACT_REGISTRY_PROJECT_ID` | 16.10 | 16.10 | The Google Cloud project ID where the Artifact Registry repository is located. | | `GOOGLE_ARTIFACT_REGISTRY_REPOSITORY_NAME` | 16.10 | 16.10 | The name of the connected Artifact Registry repository. | | `GOOGLE_ARTIFACT_REGISTRY_REPOSITORY_LOCATION` | 16.10 | 16.10 | The Google Cloud location of the connected Artifact Registry repository. | ### Authenticate with the Google Artifact Registry You can configure a pipeline to authenticate with the Google Artifact Registry during pipeline execution. GitLab uses the configured [workload identity pool](../../../integration/google_cloud_iam.md) IAM policies and populates the `GOOGLE_APPLICATION_CREDENTIALS` and `CLOUDSDK_AUTH_CREDENTIAL_FILE_OVERRIDE` environment credentials. These environment credentials are automatically detected by client tools, like [gcloud CLI](https://cloud.google.com/sdk/gcloud) and [crane](https://github.com/google/go-containerregistry/blob/main/cmd/crane/README.md). To authenticate with the Google Artifact Registry, in the project's `.gitlab-ci.yml` file, use the [`identity`](../../../ci/yaml/_index.md#identity) keyword set to `google_cloud`. #### IAM policies Your Google Cloud project must have specific IAM policies to use the Google Artifact Management integration. When you [set up this integration](#set-up-the-google-artifact-registry-in-a-gitlab-project), on-screen instructions provide the steps to create the following IAM policies in your Google Cloud project: - Grant [Artifact Registry Reader](https://cloud.google.com/iam/docs/understanding-roles#artifactregistry.reader) role to GitLab project members with [Guest](../../permissions.md#roles) role or above. - Grant [Artifact Registry Writer](https://cloud.google.com/iam/docs/understanding-roles#artifactregistry.writer) role to GitLab project members with [Developer](../../permissions.md#roles) role or above. To create these IAM policies manually, use the following `gcloud` commands. Replace these values: - `<your_google_cloud_project_id>` with the [ID](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects) of the Google Cloud project where the Artifact Registry repository is located. - `<your_workload_identity_pool_id>` with the ID of the workload identity pool. This is the same value used for the [Google Cloud IAM integration](../../../integration/google_cloud_iam.md). - `<your_google_cloud_project_number>` with the [number](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects) of the Google Cloud project where the workload identity pool is located. This is the same value used for the [Google Cloud IAM integration](../../../integration/google_cloud_iam.md). ```shell gcloud projects add-iam-policy-binding '<your_google_cloud_project_id>' \ --member='principalSet://iam.googleapis.com/projects/<your_google_cloud_project_number>/locations/global/workloadIdentityPools/<your_workload_identity_pool_id>/attribute.guest_access/true' \ --role='roles/artifactregistry.reader' gcloud projects add-iam-policy-binding '<your_google_cloud_project_id>' \ --member='principalSet://iam.googleapis.com/projects/<your_google_cloud_project_number>/locations/global/workloadIdentityPools/<your_workload_identity_pool_id>/attribute.developer_access/true' \ --role='roles/artifactregistry.writer' ``` For a list of available claims, see [OIDC custom claims](../../../integration/google_cloud_iam.md#oidc-custom-claims). ### Examples #### Use gcloud CLI to list images ```yaml list-images: image: gcr.io/google.com/cloudsdktool/google-cloud-cli:466.0.0-alpine identity: google_cloud script: - gcloud artifacts docker images list $GOOGLE_ARTIFACT_REGISTRY_REPOSITORY_LOCATION-docker.pkg.dev/$GOOGLE_ARTIFACT_REGISTRY_PROJECT_ID/$GOOGLE_ARTIFACT_REGISTRY_REPOSITORY_NAME/app ``` #### Use crane to list images ```yaml list-images: image: name: gcr.io/go-containerregistry/crane:debug entrypoint: [""] identity: google_cloud before_script: # Temporary workaround for https://github.com/google/go-containerregistry/issues/1886 - wget -q "https://github.com/GoogleCloudPlatform/docker-credential-gcr/releases/download/v2.1.22/docker-credential-gcr_linux_amd64-2.1.22.tar.gz" -O - | tar xz -C /tmp && chmod +x /tmp/docker-credential-gcr && mv /tmp/docker-credential-gcr /usr/bin/ - docker-credential-gcr configure-docker --registries=$GOOGLE_ARTIFACT_REGISTRY_REPOSITORY_LOCATION-docker.pkg.dev script: - crane ls $GOOGLE_ARTIFACT_REGISTRY_REPOSITORY_LOCATION-docker.pkg.dev/$GOOGLE_ARTIFACT_REGISTRY_PROJECT_ID/$GOOGLE_ARTIFACT_REGISTRY_REPOSITORY_NAME/app ``` #### Pull an image with Docker The following example shows how to set up authentication for Docker with the [standalone Docker credential helper](https://cloud.google.com/artifact-registry/docs/docker/authentication#standalone-helper) provided by Google. ```yaml pull-image: image: docker:24.0.5 identity: google_cloud services: - docker:24.0.5-dind variables: # The following two variables ensure that the DinD service starts in TLS # mode and that the Docker CLI is properly configured to communicate with # the API. More details about the importance of this can be found at # https://docs.gitlab.com/ee/ci/docker/using_docker_build.html#use-the-docker-executor-with-docker-in-docker DOCKER_HOST: tcp://docker:2376 DOCKER_TLS_CERTDIR: "/certs" before_script: - wget -q "https://github.com/GoogleCloudPlatform/docker-credential-gcr/releases/download/v2.1.22/docker-credential-gcr_linux_amd64-2.1.22.tar.gz" -O - | tar xz -C /tmp && chmod +x /tmp/docker-credential-gcr && mv /tmp/docker-credential-gcr /usr/bin/ - docker-credential-gcr configure-docker --registries=$GOOGLE_ARTIFACT_REGISTRY_REPOSITORY_LOCATION-docker.pkg.dev script: - docker pull $GOOGLE_ARTIFACT_REGISTRY_REPOSITORY_LOCATION-docker.pkg.dev/$GOOGLE_ARTIFACT_REGISTRY_PROJECT_ID/$GOOGLE_ARTIFACT_REGISTRY_REPOSITORY_NAME/app:v0.1.0 ``` #### Copy an image by using a CI/CD component Google provides the [`upload-artifact-registry`](https://gitlab.com/explore/catalog/google-gitlab-components/artifact-registry) CI/CD component, which you can use to copy an image from the GitLab container registry to Artifact Registry. To use the `upload-artifact-registry` component, add the following to your `.gitlab-ci.yml`: ```yaml include: - component: gitlab.com/google-gitlab-components/artifact-registry/upload-artifact-registry@main inputs: stage: deploy source: $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA target: $GOOGLE_ARTIFACT_REGISTRY_REPOSITORY_LOCATION-docker.pkg.dev/$GOOGLE_ARTIFACT_REGISTRY_PROJECT_ID/$GOOGLE_ARTIFACT_REGISTRY_REPOSITORY_NAME/$CI_PROJECT_NAME:$CI_COMMIT_SHORT_SHA ``` For details, see [the component documentation](https://gitlab.com/explore/catalog/google-gitlab-components/artifact-registry). Using the `upload-artifact-registry` component simplifies copying images to Artifact Registry and is the intended method for this integration. If you want to use Docker or Crane, see the following examples. #### Copy an image by using Docker In the following example, the `gcloud` CLI is used to set up the Docker authentication, as an alternative to the [standalone Docker credential helper](https://cloud.google.com/artifact-registry/docs/docker/authentication#standalone-helper). ```yaml copy-image: image: gcr.io/google.com/cloudsdktool/google-cloud-cli:466.0.0-alpine identity: google_cloud services: - docker:24.0.5-dind variables: SOURCE_IMAGE: $CI_REGISTRY_IMAGE:v0.1.0 TARGET_IMAGE: $GOOGLE_ARTIFACT_REGISTRY_REPOSITORY_LOCATION-docker.pkg.dev/$GOOGLE_ARTIFACT_REGISTRY_PROJECT_ID/$GOOGLE_ARTIFACT_REGISTRY_REPOSITORY_NAME/app:v0.1.0 DOCKER_HOST: tcp://docker:2375 before_script: - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY - gcloud auth configure-docker $GOOGLE_ARTIFACT_REGISTRY_REPOSITORY_LOCATION-docker.pkg.dev script: - docker pull $SOURCE_IMAGE - docker tag $SOURCE_IMAGE $TARGET_IMAGE - docker push $TARGET_IMAGE ``` #### Copy an image by using Crane ```yaml copy-image: image: name: gcr.io/go-containerregistry/crane:debug entrypoint: [""] identity: google_cloud variables: SOURCE_IMAGE: $CI_REGISTRY_IMAGE:v0.1.0 TARGET_IMAGE: $GOOGLE_ARTIFACT_REGISTRY_REPOSITORY_LOCATION-docker.pkg.dev/$GOOGLE_ARTIFACT_REGISTRY_PROJECT_ID/$GOOGLE_ARTIFACT_REGISTRY_REPOSITORY_NAME/app:v0.1.0 before_script: # Temporary workaround for https://github.com/google/go-containerregistry/issues/1886 - wget -q "https://github.com/GoogleCloudPlatform/docker-credential-gcr/releases/download/v2.1.22/docker-credential-gcr_linux_amd64-2.1.22.tar.gz" -O - | tar xz -C /tmp && chmod +x /tmp/docker-credential-gcr && mv /tmp/docker-credential-gcr /usr/bin/ - docker-credential-gcr configure-docker --registries=$GOOGLE_ARTIFACT_REGISTRY_REPOSITORY_LOCATION-docker.pkg.dev script: - crane auth login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY - crane copy $SOURCE_IMAGE $TARGET_IMAGE ```
https://docs.gitlab.com/user/project/microsoft_teams
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/microsoft_teams.md
2025-08-13
doc/user/project/integrations
[ "doc", "user", "project", "integrations" ]
microsoft_teams.md
Plan
Project Management
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Microsoft Teams notifications
Configure the Microsoft Teams integration to receive notifications from GitLab in Microsoft Teams.
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} You can integrate Microsoft Teams notifications with GitLab and display notifications about GitLab projects in Microsoft Teams. To integrate the services, you must: 1. [Configure Microsoft Teams](#configure-microsoft-teams) to enable a webhook to listen for changes. 1. [Configure your GitLab project](#configure-your-gitlab-project) to push notifications to the Microsoft Teams webhook. ## Configure Microsoft Teams {{< alert type="warning" >}} New Microsoft Teams integrations using Microsoft Connectors can no longer be created and existing integrations must be transitioned to workflow apps by December 2025. Microsoft [announced](https://devblogs.microsoft.com/microsoft365dev/retirement-of-office-365-connectors-within-microsoft-teams/) the retirement of Microsoft Teams integrations using Microsoft Connectors. {{< /alert >}} To configure Microsoft Teams to listen for notifications from GitLab: 1. In Microsoft Teams, find and select the workflow template "Post to a channel when a webhook request is received". ![Selecting a workflow webhook in Microsoft Teams](img/microsoft_teams_select_webhook_workflow_v17_4.png) 1. Enter a name for the webhook. The name is displayed next to every message that comes in through the webhook. Select **Next**. 1. Select the team and channel you want to add the integration to, then select **Add workflow**. 1. Copy the webhook URL, as you need it to configure GitLab. ## Configure your GitLab project After you configure Microsoft Teams to receive notifications, you must configure GitLab to send the notifications: 1. Sign in to GitLab as an administrator. 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Integrations**. 1. Select **Microsoft Teams notifications**. 1. To enable the integration, select **Active**. 1. In the **Trigger** section, select the checkbox next to each event to enable it: - Push - Issue - Confidential issue - Merge request - Note - Confidential note - Tag push - Pipeline - Wiki page 1. In **Webhook**, paste the URL you copied when you [configured Microsoft Teams](#configure-microsoft-teams). 1. Optional. If you enable the pipeline trigger, select the **Notify only broken pipelines** checkbox to push notifications only when pipelines break. 1. Select the branches you want to send notifications for. 1. Select **Save changes**. ## Related topics - [Setting up an incoming webhook on Microsoft Teams](https://learn.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/connectors-using#setting-up-a-custom-incoming-webhook)
--- stage: Plan group: Project Management info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments title: Microsoft Teams notifications description: Configure the Microsoft Teams integration to receive notifications from GitLab in Microsoft Teams. breadcrumbs: - doc - user - project - integrations --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} You can integrate Microsoft Teams notifications with GitLab and display notifications about GitLab projects in Microsoft Teams. To integrate the services, you must: 1. [Configure Microsoft Teams](#configure-microsoft-teams) to enable a webhook to listen for changes. 1. [Configure your GitLab project](#configure-your-gitlab-project) to push notifications to the Microsoft Teams webhook. ## Configure Microsoft Teams {{< alert type="warning" >}} New Microsoft Teams integrations using Microsoft Connectors can no longer be created and existing integrations must be transitioned to workflow apps by December 2025. Microsoft [announced](https://devblogs.microsoft.com/microsoft365dev/retirement-of-office-365-connectors-within-microsoft-teams/) the retirement of Microsoft Teams integrations using Microsoft Connectors. {{< /alert >}} To configure Microsoft Teams to listen for notifications from GitLab: 1. In Microsoft Teams, find and select the workflow template "Post to a channel when a webhook request is received". ![Selecting a workflow webhook in Microsoft Teams](img/microsoft_teams_select_webhook_workflow_v17_4.png) 1. Enter a name for the webhook. The name is displayed next to every message that comes in through the webhook. Select **Next**. 1. Select the team and channel you want to add the integration to, then select **Add workflow**. 1. Copy the webhook URL, as you need it to configure GitLab. ## Configure your GitLab project After you configure Microsoft Teams to receive notifications, you must configure GitLab to send the notifications: 1. Sign in to GitLab as an administrator. 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Integrations**. 1. Select **Microsoft Teams notifications**. 1. To enable the integration, select **Active**. 1. In the **Trigger** section, select the checkbox next to each event to enable it: - Push - Issue - Confidential issue - Merge request - Note - Confidential note - Tag push - Pipeline - Wiki page 1. In **Webhook**, paste the URL you copied when you [configured Microsoft Teams](#configure-microsoft-teams). 1. Optional. If you enable the pipeline trigger, select the **Notify only broken pipelines** checkbox to push notifications only when pipelines break. 1. Select the branches you want to send notifications for. 1. Select **Save changes**. ## Related topics - [Setting up an incoming webhook on Microsoft Teams](https://learn.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/connectors-using#setting-up-a-custom-incoming-webhook)
https://docs.gitlab.com/user/project/bamboo
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/bamboo.md
2025-08-13
doc/user/project/integrations
[ "doc", "user", "project", "integrations" ]
bamboo.md
Verify
Pipeline Execution
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Atlassian Bamboo
null
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} You can automatically trigger builds in Atlassian Bamboo when you push changes to your project in GitLab. Bamboo doesn't provide the same features as a traditional build system when accepting webhooks and commit data. You must configure a Bamboo build plan before you configure the integration in GitLab. ## Configure Bamboo 1. In Bamboo, go to a build plan and choose **Actions > Configure plan**. 1. Select the **Triggers** tab. 1. Select **Add trigger**. 1. Enter a description like `GitLab trigger`. 1. Select **Repository triggers the build when changes are committed**. 1. Select the checkbox for one or more repositories. 1. Enter the GitLab IP address in **Trigger IP addresses**. These IP addresses are allowed to trigger Bamboo builds. 1. Save the trigger. 1. In the left pane, select a build stage. If you have multiple build stages, select the last stage that contains the Git checkout task. 1. Select the **Miscellaneous** tab. 1. Under **Pattern Match Labeling** enter `${bamboo.repository.revision.number}` in **Labels**. 1. Select **Save**. Bamboo is ready to accept triggers from GitLab. Next, set up the Bamboo integration in GitLab. ## Configure GitLab 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Integrations**. 1. Select **Atlassian Bamboo**. 1. Ensure the **Active** checkbox is selected. 1. Enter the base URL of your Bamboo server. For example, `https://bamboo.example.com`. 1. Optional. Clear the **Enable SSL verification** checkbox to disable [SSL verification](_index.md#ssl-verification). 1. Enter the [build key](#identify-the-bamboo-build-plan-build-key) from your Bamboo build plan. 1. If necessary, enter a username and password for a Bamboo user that has access to trigger the build plan. Leave these fields blank if you do not require authentication. 1. Optional. Select **Test settings**. 1. Select **Save changes**. ### Identify the Bamboo build plan build key A build key is a unique identifier typically made up from the project key and plan key. Build keys are short, all uppercase, and separated with a dash (`-`), for example `PROJ-PLAN`. The build key is included in the browser URL when you view a plan in Bamboo. For example, `https://bamboo.example.com/browse/PROJ-PLAN`. ## Update Bamboo build status in GitLab You can use a script that uses the [commit status API](../../../api/commits.md#set-the-pipeline-status-of-a-commit) and Bamboo build variables to: - Update the commit with the build status. - Add the Bamboo build plan URL as the commit's `target_url`. For example: 1. Create an [access token](../../../api/rest/authentication.md#personalprojectgroup-access-tokens) in GitLab with `:api` permissions. 1. Save the token as a `$GITLAB_TOKEN` variable in Bamboo. 1. Add the following script as a final task to the Bamboo plan's jobs: ```shell #!/bin/bash # Script to update CI status on GitLab. # Add this script as final inline script task in a Bamboo job. # # General documentation: https://docs.gitlab.com/ee/user/project/integrations/bamboo.html # Fix inspired from https://gitlab.com/gitlab-org/gitlab/-/issues/34744 # Stop at first error set -e # Access token. Set this as a CI variable in Bamboo. #GITLAB_TOKEN= # Status cistatus="failed" if [ "${bamboo_buildFailed}" = "false" ]; then cistatus="success" fi repo_url="${bamboo_planRepository_repositoryUrl}" # Check if we use SSH or HTTPS protocol=${repo_url::4} if [ "$protocol" == "git@" ]; then repo=${repo_url:${#protocol}}; gitlab_url=${repo%%:*}; else protocol="https://" repo=${repo_url:${#protocol}}; gitlab_url=${repo%%/*}; fi start=$((${#gitlab_url} + 1)) # +1 for the / (https) or : (ssh) end=$((${#repo} - $start -4)) # -4 for the .git repo=${repo:$start:$end} repo=$(echo "$repo" | sed "s/\//%2F/g") # Send request url="https://${gitlab_url}/api/v4/projects/${repo}/statuses/${bamboo_planRepository_revision}?state=${cistatus}&target_url=${bamboo_buildResultsUrl}" echo "Sending request to $url" curl --fail --request POST --header "PRIVATE-TOKEN: $GITLAB_TOKEN" "$url" ``` ## Troubleshooting ### Builds not triggered If builds are not triggered, ensure you entered the right GitLab IP address in Bamboo under **Trigger IP addresses**. Also, check the integration webhook logs for request failures. ### Advanced Atlassian Bamboo features not available in GitLab UI Advanced Atlassian Bamboo features are not compatible with GitLab. These features include, but are not limited to, the ability to watch the build logs from the GitLab UI.
--- stage: Verify group: Pipeline Execution info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments title: Atlassian Bamboo breadcrumbs: - doc - user - project - integrations --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} You can automatically trigger builds in Atlassian Bamboo when you push changes to your project in GitLab. Bamboo doesn't provide the same features as a traditional build system when accepting webhooks and commit data. You must configure a Bamboo build plan before you configure the integration in GitLab. ## Configure Bamboo 1. In Bamboo, go to a build plan and choose **Actions > Configure plan**. 1. Select the **Triggers** tab. 1. Select **Add trigger**. 1. Enter a description like `GitLab trigger`. 1. Select **Repository triggers the build when changes are committed**. 1. Select the checkbox for one or more repositories. 1. Enter the GitLab IP address in **Trigger IP addresses**. These IP addresses are allowed to trigger Bamboo builds. 1. Save the trigger. 1. In the left pane, select a build stage. If you have multiple build stages, select the last stage that contains the Git checkout task. 1. Select the **Miscellaneous** tab. 1. Under **Pattern Match Labeling** enter `${bamboo.repository.revision.number}` in **Labels**. 1. Select **Save**. Bamboo is ready to accept triggers from GitLab. Next, set up the Bamboo integration in GitLab. ## Configure GitLab 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Integrations**. 1. Select **Atlassian Bamboo**. 1. Ensure the **Active** checkbox is selected. 1. Enter the base URL of your Bamboo server. For example, `https://bamboo.example.com`. 1. Optional. Clear the **Enable SSL verification** checkbox to disable [SSL verification](_index.md#ssl-verification). 1. Enter the [build key](#identify-the-bamboo-build-plan-build-key) from your Bamboo build plan. 1. If necessary, enter a username and password for a Bamboo user that has access to trigger the build plan. Leave these fields blank if you do not require authentication. 1. Optional. Select **Test settings**. 1. Select **Save changes**. ### Identify the Bamboo build plan build key A build key is a unique identifier typically made up from the project key and plan key. Build keys are short, all uppercase, and separated with a dash (`-`), for example `PROJ-PLAN`. The build key is included in the browser URL when you view a plan in Bamboo. For example, `https://bamboo.example.com/browse/PROJ-PLAN`. ## Update Bamboo build status in GitLab You can use a script that uses the [commit status API](../../../api/commits.md#set-the-pipeline-status-of-a-commit) and Bamboo build variables to: - Update the commit with the build status. - Add the Bamboo build plan URL as the commit's `target_url`. For example: 1. Create an [access token](../../../api/rest/authentication.md#personalprojectgroup-access-tokens) in GitLab with `:api` permissions. 1. Save the token as a `$GITLAB_TOKEN` variable in Bamboo. 1. Add the following script as a final task to the Bamboo plan's jobs: ```shell #!/bin/bash # Script to update CI status on GitLab. # Add this script as final inline script task in a Bamboo job. # # General documentation: https://docs.gitlab.com/ee/user/project/integrations/bamboo.html # Fix inspired from https://gitlab.com/gitlab-org/gitlab/-/issues/34744 # Stop at first error set -e # Access token. Set this as a CI variable in Bamboo. #GITLAB_TOKEN= # Status cistatus="failed" if [ "${bamboo_buildFailed}" = "false" ]; then cistatus="success" fi repo_url="${bamboo_planRepository_repositoryUrl}" # Check if we use SSH or HTTPS protocol=${repo_url::4} if [ "$protocol" == "git@" ]; then repo=${repo_url:${#protocol}}; gitlab_url=${repo%%:*}; else protocol="https://" repo=${repo_url:${#protocol}}; gitlab_url=${repo%%/*}; fi start=$((${#gitlab_url} + 1)) # +1 for the / (https) or : (ssh) end=$((${#repo} - $start -4)) # -4 for the .git repo=${repo:$start:$end} repo=$(echo "$repo" | sed "s/\//%2F/g") # Send request url="https://${gitlab_url}/api/v4/projects/${repo}/statuses/${bamboo_planRepository_revision}?state=${cistatus}&target_url=${bamboo_buildResultsUrl}" echo "Sending request to $url" curl --fail --request POST --header "PRIVATE-TOKEN: $GITLAB_TOKEN" "$url" ``` ## Troubleshooting ### Builds not triggered If builds are not triggered, ensure you entered the right GitLab IP address in Bamboo under **Trigger IP addresses**. Also, check the integration webhook logs for request failures. ### Advanced Atlassian Bamboo features not available in GitLab UI Advanced Atlassian Bamboo features are not compatible with GitLab. These features include, but are not limited to, the ability to watch the build logs from the GitLab UI.
https://docs.gitlab.com/user/project/slack_slash_commands
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/slack_slash_commands.md
2025-08-13
doc/user/project/integrations
[ "doc", "user", "project", "integrations" ]
slack_slash_commands.md
Create
Import
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Slack slash commands
Configure Slack slash commands for GitLab Self-Managed instances.
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab Self-Managed, GitLab Dedicated {{< /details >}} {{< alert type="note" >}} This feature is only configurable on GitLab Self-Managed. For GitLab.com, use the [GitLab for Slack app](gitlab_slack_application.md) instead. {{< /alert >}} You can use [slash commands](gitlab_slack_application.md#slash-commands) to run common GitLab operations, like creating an issue, from a [Slack](https://slack.com/) chat environment. To run slash commands in Slack, you must configure both Slack and GitLab. GitLab can also send events (such as `issue created`) to Slack as part of [Slack notifications](gitlab_slack_application.md#slack-notifications). For a list of available slash commands, see [Slash commands](gitlab_slack_application.md#slash-commands). ## Configure the integration Slack slash commands are scoped to a project. To configure Slack slash commands: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Integrations**. 1. Select **Slack slash commands** and leave this browser tab open. 1. In a new browser tab, sign in to Slack and [add a new slash command](https://my.slack.com/services/new/slash-commands). 1. Enter a trigger name for the slash command. You could use the project name. 1. Select **Add Slash Command Integration**. 1. In the Slack browser tab: 1. Complete the fields with information from the GitLab browser tab. 1. Select **Save Integration** and copy the **Token** value. 1. In the GitLab browser tab: 1. Paste the token and ensure the **Active** checkbox is selected. 1. Select **Save changes**. You can now run slash commands in Slack.
--- stage: Create group: Import info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments title: Slack slash commands description: Configure Slack slash commands for GitLab Self-Managed instances. breadcrumbs: - doc - user - project - integrations --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab Self-Managed, GitLab Dedicated {{< /details >}} {{< alert type="note" >}} This feature is only configurable on GitLab Self-Managed. For GitLab.com, use the [GitLab for Slack app](gitlab_slack_application.md) instead. {{< /alert >}} You can use [slash commands](gitlab_slack_application.md#slash-commands) to run common GitLab operations, like creating an issue, from a [Slack](https://slack.com/) chat environment. To run slash commands in Slack, you must configure both Slack and GitLab. GitLab can also send events (such as `issue created`) to Slack as part of [Slack notifications](gitlab_slack_application.md#slack-notifications). For a list of available slash commands, see [Slash commands](gitlab_slack_application.md#slash-commands). ## Configure the integration Slack slash commands are scoped to a project. To configure Slack slash commands: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Integrations**. 1. Select **Slack slash commands** and leave this browser tab open. 1. In a new browser tab, sign in to Slack and [add a new slash command](https://my.slack.com/services/new/slash-commands). 1. Enter a trigger name for the slash command. You could use the project name. 1. Select **Add Slash Command Integration**. 1. In the Slack browser tab: 1. Complete the fields with information from the GitLab browser tab. 1. Select **Save Integration** and copy the **Token** value. 1. In the GitLab browser tab: 1. Paste the token and ensure the **Active** checkbox is selected. 1. Select **Save changes**. You can now run slash commands in Slack.
https://docs.gitlab.com/user/project/webhooks
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/webhooks.md
2025-08-13
doc/user/project/integrations
[ "doc", "user", "project", "integrations" ]
webhooks.md
Create
Import
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Webhooks
Configure and manage project and group webhooks in GitLab.
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} Webhooks connect GitLab to your other tools and systems through real-time notifications. When important events happen in GitLab, webhooks send that information directly to your external applications. Build automation workflows by reacting to merge requests, code pushes, and issue updates. With webhooks, your team stays synchronized as changes occur: - External issue trackers update automatically when GitLab issues change. - Chat applications notify team members about pipeline completions. - Custom scripts deploy applications when code reaches the main branch. - Monitoring systems track development activity across your entire organization. ## Webhook events Various events in GitLab can trigger webhooks. For example: - Pushing code to a repository. - Posting a comment on an issue. - Creating a merge request. For a complete list of events and the JSON data sent in the webhook payload, see [webhook events](webhook_events.md). ## Webhook limits GitLab.com enforces [webhook limits](../../gitlab_com/_index.md#webhooks), including: - Maximum number of webhooks per project or group. - Number of webhook calls per minute. - Webhook timeout duration. For GitLab Self-Managed, administrators can modify these limits. ## Group webhooks {{< details >}} - Tier: Premium, Ultimate {{< /details >}} Group webhooks are custom HTTP callbacks that send notifications for events across all projects in a group and its subgroups. ### Types of group webhook events You can configure group webhooks to listen for: - All events that occur in projects in the group and subgroups. - Group-specific events: - [Group member events](webhook_events.md#group-member-events). - [Project events](webhook_events.md#project-events) - [Subgroup events](webhook_events.md#subgroup-events). ### Webhooks in both a project and a group If you configure identical webhooks in both a group and a project in that group, both webhooks are triggered for events in that project. This allows for flexible event handling at different levels of your GitLab organization. ## Configure webhooks Create and configure webhooks in GitLab to integrate with your project's workflow. Use these features to set up webhooks that meet your specific requirements. ### Create a webhook {{< history >}} - **Name** and **Description** [introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/141977) in GitLab 16.9. {{< /history >}} Create a webhook to send notifications about events in your project or group. Prerequisites: - For project webhooks, you must have at least the Maintainer role for the project. - For group webhooks, you must have the Owner role for the group. To create a webhook: 1. On the left sidebar, select **Search or go to** and find your project or group. 1. Select **Settings > Webhooks**. 1. Select **Add new webhook**. 1. In **URL**, enter the URL of the webhook endpoint. Use percent-encoding for special characters. 1. Optional. Enter a **Name** and **Description** for the webhook. 1. Optional. In **Secret token**, enter a token to validate requests. 1. In the **Trigger** section, select the [events](webhook_events.md) to trigger the webhook. 1. Optional. To disable [SSL verification](_index.md#ssl-verification), clear the **Enable SSL verification** checkbox. 1. Select **Add webhook**. The secret token is sent with the webhook request in the `X-Gitlab-Token` HTTP header. Your webhook endpoint can use this token to verify the legitimacy of the request. ### Mask sensitive portions of webhook URLs {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/99995) in GitLab 15.5 [with a flag](../../../administration/feature_flags/_index.md) named `webhook_form_mask_url`. Disabled by default. - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/issues/376106) in GitLab 15.7. Feature flag `webhook_form_mask_url` removed. {{< /history >}} Mask sensitive portions of webhook URLs to enhance security. Masked portions are replaced with configured values when webhooks are executed, are not logged, and are encrypted at rest in the database. To mask sensitive portions of a webhook URL: 1. On the left sidebar, select **Search or go to** and find your project or group. 1. Select **Settings > Webhooks**. 1. In **URL**, enter the full URL of the webhook. 1. To define masked portions, select **Add URL masking**. 1. In **Sensitive portion of URL**, enter the part of the URL you want to mask. 1. In **How it looks in the UI**, enter the value to display instead of the masked portion. Variable names must contain only lowercase letters (`a-z`), numbers (`0-9`), or underscores (`_`). 1. Select **Save changes**. The masked values appear hidden in the UI. For example, if you've defined variables `path` and `value`, the webhook URL can look like this: ```plaintext https://webhook.example.com/{path}?key={value} ``` ### Custom headers {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/146702) in GitLab 16.11 [with a flag](../../../administration/feature_flags/_index.md) named `custom_webhook_headers`. Enabled by default. - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/issues/448604) in GitLab 17.0. Feature flag `custom_webhook_headers` removed. {{< /history >}} Add custom headers to webhook requests for authentication to external services. You can configure up to 20 custom headers per webhook. Custom headers must: - Not override the values of [delivery headers](#delivery-headers). - Contain only alphanumeric characters, periods, dashes, or underscores. - Start with a letter and end with a letter or number. - Have no consecutive periods, dashes, or underscores. Custom headers show in [**Recent events**](#view-webhook-request-history) with masked values. ### Custom webhook template {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/142738) in GitLab 16.10 [with a flag](../../../administration/feature_flags/_index.md) named `custom_webhook_template`. Enabled by default. - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/issues/439610) in GitLab 17.0. Feature flag `custom_webhook_template` removed. {{< /history >}} Create a custom payload template for your webhook to control the data sent in the request body. #### Create a custom webhook template - For project webhooks, you must have at least the Maintainer role for the project. - For group webhooks, you must have the Owner role for the group. To create a custom webhook template: 1. Go to your webhook configuration. 1. Set a custom webhook template. 1. Ensure the template renders as valid JSON. Use fields from the [payload of an event](webhook_events.md) in your template. For example: - `{{build_name}}` for a job event - `{{deployable_url}}` for a deployment event To access nested properties, use periods to separate path segments. #### Example custom webhook template For this custom payload template: ```json { "event": "{{object_kind}}", "project_name": "{{project.name}}" } ``` The resulting request payload for a `push` event is: ```json { "event": "push", "project_name": "Example" } ``` Custom webhook templates cannot access properties in arrays. Support for this feature is proposed in [issue 463332](https://gitlab.com/gitlab-org/gitlab/-/issues/463332). ### Filter push events by branch Filter `push` events sent to your webhook endpoint by the branch name. Use one of these filtering options: - **All branches**: Receive push events from all branches. - **Wildcard pattern**: Receive push events from branches that match a wildcard pattern. - **Regular expression**: Receive push events from branches that match a regular expression (regex). #### Use a wildcard pattern To filter by using a wildcard pattern: 1. In the webhook configuration, select **Wildcard pattern**. 1. Enter a pattern. For example: - `*-stable` to match branches ending with `-stable`. - `production/*` to match branches in the `production/` namespace. #### Use a regular expression To filter by using a regular expression: 1. In the webhook configuration, select **Regular expression**. 1. Enter a regex pattern that follows the [RE2 syntax](https://github.com/google/re2/wiki/Syntax). For example, to exclude the `main` branch, use: ```plaintext \b(?:m(?!ain\b)|ma(?!in\b)|mai(?!n\b)|[a-l]|[n-z])\w*|\b\w{1,3}\b|\W+ ``` ### Configure webhooks to support mutual TLS {{< details >}} - Offering: GitLab Self-Managed {{< /details >}} {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/27450) in GitLab 16.9. {{< /history >}} Configure webhooks to support mutual TLS by setting a global client certificate in PEM format. Prerequisites: - You must be a GitLab administrator. To configure mutual TLS for webhooks: 1. Prepare a client certificate in PEM format. 1. Optional: Protect the certificate with a PEM passphrase. 1. Configure GitLab to use the certificate. {{< tabs >}} {{< tab title="Linux package (Omnibus)" >}} 1. Edit `/etc/gitlab/gitlab.rb`: ```ruby gitlab_rails['http_client']['tls_client_cert_file'] = '<PATH TO CLIENT PEM FILE>' gitlab_rails['http_client']['tls_client_cert_password'] = '<OPTIONAL PASSWORD>' ``` 1. Save the file and reconfigure GitLab: ```shell sudo gitlab-ctl reconfigure ``` {{< /tab >}} {{< tab title="Docker" >}} 1. Edit `docker-compose.yml`: ```yaml version: "3.6" services: gitlab: image: 'gitlab/gitlab-ee:latest' restart: always hostname: 'gitlab.example.com' environment: GITLAB_OMNIBUS_CONFIG: | gitlab_rails['http_client']['tls_client_cert_file'] = '<PATH TO CLIENT PEM FILE>' gitlab_rails['http_client']['tls_client_cert_password'] = '<OPTIONAL PASSWORD>' ``` 1. Save the file and restart GitLab: ```shell docker compose up -d ``` {{< /tab >}} {{< tab title="Self-compiled (source)" >}} 1. Edit `/home/git/gitlab/config/gitlab.yml`: ```yaml production: &base http_client: tls_client_cert_file: '<PATH TO CLIENT PEM FILE>' tls_client_cert_password: '<OPTIONAL PASSWORD>' ``` 1. Save the file and restart GitLab: ```shell # For systems running systemd sudo systemctl restart gitlab.target # For systems running SysV init sudo service gitlab restart ``` {{< /tab >}} {{< /tabs >}} After configuration, GitLab presents this certificate to the server during TLS handshakes for webhook connections. ### Configure firewalls for webhook traffic Configure firewalls for webhook traffic based on how GitLab sends webhooks: - Asynchronously from Sidekiq nodes (most common) - Synchronously from Rails nodes (in specific cases) Webhooks are sent synchronously from Rails nodes when: - [Testing a webhook](#test-a-webhook) in the UI - [Retrying a webhook](#inspect-request-and-response-details) in the UI When configuring firewalls, ensure both Sidekiq and Rails nodes can send webhook traffic. ## Manage webhooks Monitor and maintain your configured webhooks in GitLab. ### View webhook request history {{< history >}} - **Recent events** for group webhooks [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/325642) in GitLab 15.3. {{< /history >}} View the history of webhook requests to monitor their performance and troubleshoot issues. Prerequisites: - For project webhooks, you must have at least the Maintainer role for the project. - For group webhooks, you must have the Owner role for the group. To view the request history for a webhook: 1. On the left sidebar, select **Search or go to** and find your project or group. 1. Select **Settings > Webhooks**. 1. Select **Edit** for the webhook. 1. Go to the **Recent events** section. The **Recent events** section displays all requests made to a webhook in the last two days. The table includes: - HTTP status code: - Green for `200`-`299` codes - Red for other codes - `internal error` for failed deliveries - Triggered event - Elapsed time of the request - Relative time the request was made ![Recent deliveries](img/webhook_logs_v14_4.png) #### Inspect request and response details Prerequisites: - For project webhooks, you must have at least the Maintainer role for the project. - For group webhooks, you must have the Owner role for the group. Each webhook request in [**Recent events**](#view-webhook-request-history) has a **Request details** page. This page contains the body and headers of: - The response GitLab received from the webhook receiver endpoint - The webhook request GitLab sent To inspect the request and response details of a webhook event: 1. On the left sidebar, select **Search or go to** and find your project or group. 1. Select **Settings > Webhooks**. 1. Select **Edit** for the webhook. 1. Go to the **Recent events** section. 1. Select **View details** for the event. To send the request again with the same data and the same [`Idempotency-Key` header](#delivery-headers)), select **Resend Request**. If the webhook URL has changed, you cannot resend the request. For resending programmatically, refer to our [API documentation](../../../api/project_webhooks.md#resend-a-project-webhook-event). ### Test a webhook Test a webhook to ensure it's working properly or to re-enable a [disabled webhook](#re-enable-disabled-webhooks). Prerequisites: - For project webhooks, you must have at least the Maintainer role for the project. - For group webhooks, you must have the Owner role for the group. - To test `push events`, your project must have at least one commit. To test a webhook: 1. On the left sidebar, select **Search or go to** and find your project or group. 1. Select **Settings > Webhooks**. 1. In the list of configured webhooks, locate the webhook you want to test. 1. From the **Test** dropdown list, select the type of event to test. Alternatively, you can test a webhook from its edit page. ![Webhook testing](img/webhook_testing_v9_4.png) Testing is not supported for some types of events for project and group webhooks. For more information, see [issue 379201](https://gitlab.com/gitlab-org/gitlab/-/issues/379201). ## Webhook reference Use this technical reference to: - Understand how GitLab webhooks work. - Integrate webhooks with your systems. - Set up, troubleshoot, and optimize your webhook configurations. ### Webhook receiver requirements Implement fast and stable webhook receiver endpoints to ensure reliable webhook delivery. Slow, unstable, or incorrectly configured receivers may be [disabled automatically](#auto-disabled-webhooks). Invalid HTTP responses are treated as failed requests. To optimize your webhook receivers: 1. Respond quickly with a `200` or `201` status: - Avoid processing webhooks in the same request. - Use a queue to handle webhooks after receiving them. - Respond before the [timeout limit](../../gitlab_com/_index.md#other-limits) to prevent automatic disabling on GitLab.com. 1. Handle potential duplicate events: - Prepare for duplicate events if a webhook times out. - Ensure your endpoint is consistently fast and stable. 1. Minimize response headers and body: - GitLab stores response headers and body for [later inspection](#inspect-request-and-response-details). - Limit the number and size of returned headers. - Consider responding with an empty body. 1. Use appropriate status codes: - Return client error status responses (`4xx` range) only for misconfigured webhooks. - For unsupported events, return `400` or ignore the payload. - Avoid `500` server error responses for handled events. ### Auto-disabled webhooks {{< history >}} - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/issues/329849) for project webhooks in GitLab 15.7. Feature flag `web_hooks_disable_failed` removed. - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/385902) for group webhooks in GitLab 15.10. - [Disabled on GitLab Self-Managed](https://gitlab.com/gitlab-org/gitlab/-/issues/390157) in GitLab 15.10 [with a flag](../../../administration/feature_flags/_index.md) named `auto_disabling_web_hooks`. - **Fails to connect** and **Failing to connect** [renamed](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/166329) to **Disabled** and **Temporarily disabled** in GitLab 17.11. - [Changed](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/166329) to become permanently disabled after 40 consecutive failures in GitLab 17.11. {{< /history >}} {{< alert type="flag" >}} The availability of this feature is controlled by a feature flag. For more information, see the history. {{< /alert >}} GitLab automatically disables project or group webhooks that fail four consecutive times. To view auto-disabled webhooks: 1. On the left sidebar, select **Search or go to** and find your project or group. 1. Select **Settings > Webhooks**. In the webhook list, auto-disabled webhooks display as: - **Temporarily disabled** for [temporarily disabled](#temporarily-disabled-webhooks) webhooks - **Disabled** for [permanently disabled](#permanently-disabled-webhooks) webhooks ![Badges on failing webhooks](img/failed_badges_v17_11.png) #### Temporarily disabled webhooks Webhooks are temporarily disabled if they fail four consecutive times. If webhooks fail 40 consecutive times, they become [permanently disabled](#permanently-disabled-webhooks). Failure occurs when: - The [webhook receiver](#webhook-receiver-requirements) returns a response code in the `4xx` or `5xx` range. - The webhook experiences a [timeout](../../gitlab_com/_index.md#webhooks) when attempting to connect to the webhook receiver. - The webhook encounters other HTTP errors. Temporarily disabled webhooks are initially disabled for one minute, with the duration extending on subsequent failures up to 24 hours. After this period has elapsed, these webhooks are automatically re-enabled. #### Permanently disabled webhooks Webhooks are permanently disabled if they fail 40 consecutive times. Unlike [temporarily disabled webhooks](#temporarily-disabled-webhooks), these webhooks are not automatically re-enabled. Webhooks that were permanently disabled in GitLab 17.10 and earlier underwent a data migration. These webhooks might display four failures in [**Recent events**](#view-webhook-request-history) even though the UI might state they have 40 failures. #### Re-enable disabled webhooks {{< history >}} - Introduced in GitLab 15.2 [with a flag](../../../administration/feature_flags/_index.md) named `webhooks_failed_callout`. Disabled by default. - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/issues/365535) in GitLab 15.7. Feature flag `webhooks_failed_callout` removed. {{< /history >}} To re-enable a disabled webhook, [send a test request](#test-a-webhook). The webhook is re-enabled if the test request returns a response code in the `2xx` range. ### Delivery headers {{< history >}} - `X-Gitlab-Event-UUID` header [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/329743) in GitLab 14.8. - `X-Gitlab-Instance` header [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/31333) in GitLab 15.5. - `X-Gitlab-Webhook-UUID` header [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/230830) in GitLab 16.2. - `Idempotency-Key` header [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/388692) in GitLab 17.4. {{< /history >}} GitLab includes the following headers in webhook requests to your endpoint: | Header | Description | Example | | ----------------------- | ------------------------------------------------------- | ------- | | `User-Agent` | User agent in the format `"Gitlab/<VERSION>"`. | `"GitLab/15.5.0-pre"` | | `X-Gitlab-Instance` | Hostname of the GitLab instance that sent the webhook. | `"https://gitlab.com"` | | `X-Gitlab-Webhook-UUID` | Unique ID for each webhook. | `"02affd2d-2cba-4033-917d-ec22d5dc4b38"` | | `X-Gitlab-Event` | Webhook type name. Corresponds to [event types](webhook_events.md) in the format `"<EVENT> Hook"`. | `"Push Hook"` | | `X-Gitlab-Event-UUID` | Unique ID for non-recursive webhooks. Recursive webhooks (triggered by earlier webhooks) share the same value. | `"13792a34-cac6-4fda-95a8-c58e00a3954e"` | | `Idempotency-Key` | Unique ID consistent across webhook retries. Use to ensure idempotency in integrations. | `"f5e5f430-f57b-4e6e-9fac-d9128cd7232f"` | ### Image URL display in webhook body GitLab rewrites relative image references to absolute URLs in webhook bodies. #### Image URL rewriting example If the original image reference in a merge request, comment, or wiki page is: ```markdown ![image](/uploads/$sha/image.png) ``` The rewritten image reference in the webhook body would be: ```markdown ![image](https://gitlab.example.com/-/project/:id/uploads/<SHA>/image.png) ``` This example assumes: - GitLab is installed at `gitlab.example.com`. - The project ID is at `123`. #### Exceptions to image URL rewriting GitLab does not rewrite image URLs when: - They already use HTTP, HTTPS, or protocol-relative URLs. - They use advanced Markdown features, such as link labels. ## Related topics - [Webhook events and webhook JSON payloads](webhook_events.md) - [Project webhooks API](../../../api/project_webhooks.md) - [Group webhooks API](../../../api/group_webhooks.md) - [System hooks API](../../../api/system_hooks.md) - [Troubleshooting](webhooks_troubleshooting.md) - [Send SMS alerts with webhooks and Twilio](https://www.datadoghq.com/blog/send-alerts-sms-customizable-webhooks-twilio/) - [Applying GitLab labels automatically](https://about.gitlab.com/blog/2016/08/19/applying-gitlab-labels-automatically/)
--- stage: Create group: Import info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments title: Webhooks description: Configure and manage project and group webhooks in GitLab. breadcrumbs: - doc - user - project - integrations --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} Webhooks connect GitLab to your other tools and systems through real-time notifications. When important events happen in GitLab, webhooks send that information directly to your external applications. Build automation workflows by reacting to merge requests, code pushes, and issue updates. With webhooks, your team stays synchronized as changes occur: - External issue trackers update automatically when GitLab issues change. - Chat applications notify team members about pipeline completions. - Custom scripts deploy applications when code reaches the main branch. - Monitoring systems track development activity across your entire organization. ## Webhook events Various events in GitLab can trigger webhooks. For example: - Pushing code to a repository. - Posting a comment on an issue. - Creating a merge request. For a complete list of events and the JSON data sent in the webhook payload, see [webhook events](webhook_events.md). ## Webhook limits GitLab.com enforces [webhook limits](../../gitlab_com/_index.md#webhooks), including: - Maximum number of webhooks per project or group. - Number of webhook calls per minute. - Webhook timeout duration. For GitLab Self-Managed, administrators can modify these limits. ## Group webhooks {{< details >}} - Tier: Premium, Ultimate {{< /details >}} Group webhooks are custom HTTP callbacks that send notifications for events across all projects in a group and its subgroups. ### Types of group webhook events You can configure group webhooks to listen for: - All events that occur in projects in the group and subgroups. - Group-specific events: - [Group member events](webhook_events.md#group-member-events). - [Project events](webhook_events.md#project-events) - [Subgroup events](webhook_events.md#subgroup-events). ### Webhooks in both a project and a group If you configure identical webhooks in both a group and a project in that group, both webhooks are triggered for events in that project. This allows for flexible event handling at different levels of your GitLab organization. ## Configure webhooks Create and configure webhooks in GitLab to integrate with your project's workflow. Use these features to set up webhooks that meet your specific requirements. ### Create a webhook {{< history >}} - **Name** and **Description** [introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/141977) in GitLab 16.9. {{< /history >}} Create a webhook to send notifications about events in your project or group. Prerequisites: - For project webhooks, you must have at least the Maintainer role for the project. - For group webhooks, you must have the Owner role for the group. To create a webhook: 1. On the left sidebar, select **Search or go to** and find your project or group. 1. Select **Settings > Webhooks**. 1. Select **Add new webhook**. 1. In **URL**, enter the URL of the webhook endpoint. Use percent-encoding for special characters. 1. Optional. Enter a **Name** and **Description** for the webhook. 1. Optional. In **Secret token**, enter a token to validate requests. 1. In the **Trigger** section, select the [events](webhook_events.md) to trigger the webhook. 1. Optional. To disable [SSL verification](_index.md#ssl-verification), clear the **Enable SSL verification** checkbox. 1. Select **Add webhook**. The secret token is sent with the webhook request in the `X-Gitlab-Token` HTTP header. Your webhook endpoint can use this token to verify the legitimacy of the request. ### Mask sensitive portions of webhook URLs {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/99995) in GitLab 15.5 [with a flag](../../../administration/feature_flags/_index.md) named `webhook_form_mask_url`. Disabled by default. - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/issues/376106) in GitLab 15.7. Feature flag `webhook_form_mask_url` removed. {{< /history >}} Mask sensitive portions of webhook URLs to enhance security. Masked portions are replaced with configured values when webhooks are executed, are not logged, and are encrypted at rest in the database. To mask sensitive portions of a webhook URL: 1. On the left sidebar, select **Search or go to** and find your project or group. 1. Select **Settings > Webhooks**. 1. In **URL**, enter the full URL of the webhook. 1. To define masked portions, select **Add URL masking**. 1. In **Sensitive portion of URL**, enter the part of the URL you want to mask. 1. In **How it looks in the UI**, enter the value to display instead of the masked portion. Variable names must contain only lowercase letters (`a-z`), numbers (`0-9`), or underscores (`_`). 1. Select **Save changes**. The masked values appear hidden in the UI. For example, if you've defined variables `path` and `value`, the webhook URL can look like this: ```plaintext https://webhook.example.com/{path}?key={value} ``` ### Custom headers {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/146702) in GitLab 16.11 [with a flag](../../../administration/feature_flags/_index.md) named `custom_webhook_headers`. Enabled by default. - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/issues/448604) in GitLab 17.0. Feature flag `custom_webhook_headers` removed. {{< /history >}} Add custom headers to webhook requests for authentication to external services. You can configure up to 20 custom headers per webhook. Custom headers must: - Not override the values of [delivery headers](#delivery-headers). - Contain only alphanumeric characters, periods, dashes, or underscores. - Start with a letter and end with a letter or number. - Have no consecutive periods, dashes, or underscores. Custom headers show in [**Recent events**](#view-webhook-request-history) with masked values. ### Custom webhook template {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/142738) in GitLab 16.10 [with a flag](../../../administration/feature_flags/_index.md) named `custom_webhook_template`. Enabled by default. - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/issues/439610) in GitLab 17.0. Feature flag `custom_webhook_template` removed. {{< /history >}} Create a custom payload template for your webhook to control the data sent in the request body. #### Create a custom webhook template - For project webhooks, you must have at least the Maintainer role for the project. - For group webhooks, you must have the Owner role for the group. To create a custom webhook template: 1. Go to your webhook configuration. 1. Set a custom webhook template. 1. Ensure the template renders as valid JSON. Use fields from the [payload of an event](webhook_events.md) in your template. For example: - `{{build_name}}` for a job event - `{{deployable_url}}` for a deployment event To access nested properties, use periods to separate path segments. #### Example custom webhook template For this custom payload template: ```json { "event": "{{object_kind}}", "project_name": "{{project.name}}" } ``` The resulting request payload for a `push` event is: ```json { "event": "push", "project_name": "Example" } ``` Custom webhook templates cannot access properties in arrays. Support for this feature is proposed in [issue 463332](https://gitlab.com/gitlab-org/gitlab/-/issues/463332). ### Filter push events by branch Filter `push` events sent to your webhook endpoint by the branch name. Use one of these filtering options: - **All branches**: Receive push events from all branches. - **Wildcard pattern**: Receive push events from branches that match a wildcard pattern. - **Regular expression**: Receive push events from branches that match a regular expression (regex). #### Use a wildcard pattern To filter by using a wildcard pattern: 1. In the webhook configuration, select **Wildcard pattern**. 1. Enter a pattern. For example: - `*-stable` to match branches ending with `-stable`. - `production/*` to match branches in the `production/` namespace. #### Use a regular expression To filter by using a regular expression: 1. In the webhook configuration, select **Regular expression**. 1. Enter a regex pattern that follows the [RE2 syntax](https://github.com/google/re2/wiki/Syntax). For example, to exclude the `main` branch, use: ```plaintext \b(?:m(?!ain\b)|ma(?!in\b)|mai(?!n\b)|[a-l]|[n-z])\w*|\b\w{1,3}\b|\W+ ``` ### Configure webhooks to support mutual TLS {{< details >}} - Offering: GitLab Self-Managed {{< /details >}} {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/27450) in GitLab 16.9. {{< /history >}} Configure webhooks to support mutual TLS by setting a global client certificate in PEM format. Prerequisites: - You must be a GitLab administrator. To configure mutual TLS for webhooks: 1. Prepare a client certificate in PEM format. 1. Optional: Protect the certificate with a PEM passphrase. 1. Configure GitLab to use the certificate. {{< tabs >}} {{< tab title="Linux package (Omnibus)" >}} 1. Edit `/etc/gitlab/gitlab.rb`: ```ruby gitlab_rails['http_client']['tls_client_cert_file'] = '<PATH TO CLIENT PEM FILE>' gitlab_rails['http_client']['tls_client_cert_password'] = '<OPTIONAL PASSWORD>' ``` 1. Save the file and reconfigure GitLab: ```shell sudo gitlab-ctl reconfigure ``` {{< /tab >}} {{< tab title="Docker" >}} 1. Edit `docker-compose.yml`: ```yaml version: "3.6" services: gitlab: image: 'gitlab/gitlab-ee:latest' restart: always hostname: 'gitlab.example.com' environment: GITLAB_OMNIBUS_CONFIG: | gitlab_rails['http_client']['tls_client_cert_file'] = '<PATH TO CLIENT PEM FILE>' gitlab_rails['http_client']['tls_client_cert_password'] = '<OPTIONAL PASSWORD>' ``` 1. Save the file and restart GitLab: ```shell docker compose up -d ``` {{< /tab >}} {{< tab title="Self-compiled (source)" >}} 1. Edit `/home/git/gitlab/config/gitlab.yml`: ```yaml production: &base http_client: tls_client_cert_file: '<PATH TO CLIENT PEM FILE>' tls_client_cert_password: '<OPTIONAL PASSWORD>' ``` 1. Save the file and restart GitLab: ```shell # For systems running systemd sudo systemctl restart gitlab.target # For systems running SysV init sudo service gitlab restart ``` {{< /tab >}} {{< /tabs >}} After configuration, GitLab presents this certificate to the server during TLS handshakes for webhook connections. ### Configure firewalls for webhook traffic Configure firewalls for webhook traffic based on how GitLab sends webhooks: - Asynchronously from Sidekiq nodes (most common) - Synchronously from Rails nodes (in specific cases) Webhooks are sent synchronously from Rails nodes when: - [Testing a webhook](#test-a-webhook) in the UI - [Retrying a webhook](#inspect-request-and-response-details) in the UI When configuring firewalls, ensure both Sidekiq and Rails nodes can send webhook traffic. ## Manage webhooks Monitor and maintain your configured webhooks in GitLab. ### View webhook request history {{< history >}} - **Recent events** for group webhooks [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/325642) in GitLab 15.3. {{< /history >}} View the history of webhook requests to monitor their performance and troubleshoot issues. Prerequisites: - For project webhooks, you must have at least the Maintainer role for the project. - For group webhooks, you must have the Owner role for the group. To view the request history for a webhook: 1. On the left sidebar, select **Search or go to** and find your project or group. 1. Select **Settings > Webhooks**. 1. Select **Edit** for the webhook. 1. Go to the **Recent events** section. The **Recent events** section displays all requests made to a webhook in the last two days. The table includes: - HTTP status code: - Green for `200`-`299` codes - Red for other codes - `internal error` for failed deliveries - Triggered event - Elapsed time of the request - Relative time the request was made ![Recent deliveries](img/webhook_logs_v14_4.png) #### Inspect request and response details Prerequisites: - For project webhooks, you must have at least the Maintainer role for the project. - For group webhooks, you must have the Owner role for the group. Each webhook request in [**Recent events**](#view-webhook-request-history) has a **Request details** page. This page contains the body and headers of: - The response GitLab received from the webhook receiver endpoint - The webhook request GitLab sent To inspect the request and response details of a webhook event: 1. On the left sidebar, select **Search or go to** and find your project or group. 1. Select **Settings > Webhooks**. 1. Select **Edit** for the webhook. 1. Go to the **Recent events** section. 1. Select **View details** for the event. To send the request again with the same data and the same [`Idempotency-Key` header](#delivery-headers)), select **Resend Request**. If the webhook URL has changed, you cannot resend the request. For resending programmatically, refer to our [API documentation](../../../api/project_webhooks.md#resend-a-project-webhook-event). ### Test a webhook Test a webhook to ensure it's working properly or to re-enable a [disabled webhook](#re-enable-disabled-webhooks). Prerequisites: - For project webhooks, you must have at least the Maintainer role for the project. - For group webhooks, you must have the Owner role for the group. - To test `push events`, your project must have at least one commit. To test a webhook: 1. On the left sidebar, select **Search or go to** and find your project or group. 1. Select **Settings > Webhooks**. 1. In the list of configured webhooks, locate the webhook you want to test. 1. From the **Test** dropdown list, select the type of event to test. Alternatively, you can test a webhook from its edit page. ![Webhook testing](img/webhook_testing_v9_4.png) Testing is not supported for some types of events for project and group webhooks. For more information, see [issue 379201](https://gitlab.com/gitlab-org/gitlab/-/issues/379201). ## Webhook reference Use this technical reference to: - Understand how GitLab webhooks work. - Integrate webhooks with your systems. - Set up, troubleshoot, and optimize your webhook configurations. ### Webhook receiver requirements Implement fast and stable webhook receiver endpoints to ensure reliable webhook delivery. Slow, unstable, or incorrectly configured receivers may be [disabled automatically](#auto-disabled-webhooks). Invalid HTTP responses are treated as failed requests. To optimize your webhook receivers: 1. Respond quickly with a `200` or `201` status: - Avoid processing webhooks in the same request. - Use a queue to handle webhooks after receiving them. - Respond before the [timeout limit](../../gitlab_com/_index.md#other-limits) to prevent automatic disabling on GitLab.com. 1. Handle potential duplicate events: - Prepare for duplicate events if a webhook times out. - Ensure your endpoint is consistently fast and stable. 1. Minimize response headers and body: - GitLab stores response headers and body for [later inspection](#inspect-request-and-response-details). - Limit the number and size of returned headers. - Consider responding with an empty body. 1. Use appropriate status codes: - Return client error status responses (`4xx` range) only for misconfigured webhooks. - For unsupported events, return `400` or ignore the payload. - Avoid `500` server error responses for handled events. ### Auto-disabled webhooks {{< history >}} - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/issues/329849) for project webhooks in GitLab 15.7. Feature flag `web_hooks_disable_failed` removed. - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/385902) for group webhooks in GitLab 15.10. - [Disabled on GitLab Self-Managed](https://gitlab.com/gitlab-org/gitlab/-/issues/390157) in GitLab 15.10 [with a flag](../../../administration/feature_flags/_index.md) named `auto_disabling_web_hooks`. - **Fails to connect** and **Failing to connect** [renamed](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/166329) to **Disabled** and **Temporarily disabled** in GitLab 17.11. - [Changed](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/166329) to become permanently disabled after 40 consecutive failures in GitLab 17.11. {{< /history >}} {{< alert type="flag" >}} The availability of this feature is controlled by a feature flag. For more information, see the history. {{< /alert >}} GitLab automatically disables project or group webhooks that fail four consecutive times. To view auto-disabled webhooks: 1. On the left sidebar, select **Search or go to** and find your project or group. 1. Select **Settings > Webhooks**. In the webhook list, auto-disabled webhooks display as: - **Temporarily disabled** for [temporarily disabled](#temporarily-disabled-webhooks) webhooks - **Disabled** for [permanently disabled](#permanently-disabled-webhooks) webhooks ![Badges on failing webhooks](img/failed_badges_v17_11.png) #### Temporarily disabled webhooks Webhooks are temporarily disabled if they fail four consecutive times. If webhooks fail 40 consecutive times, they become [permanently disabled](#permanently-disabled-webhooks). Failure occurs when: - The [webhook receiver](#webhook-receiver-requirements) returns a response code in the `4xx` or `5xx` range. - The webhook experiences a [timeout](../../gitlab_com/_index.md#webhooks) when attempting to connect to the webhook receiver. - The webhook encounters other HTTP errors. Temporarily disabled webhooks are initially disabled for one minute, with the duration extending on subsequent failures up to 24 hours. After this period has elapsed, these webhooks are automatically re-enabled. #### Permanently disabled webhooks Webhooks are permanently disabled if they fail 40 consecutive times. Unlike [temporarily disabled webhooks](#temporarily-disabled-webhooks), these webhooks are not automatically re-enabled. Webhooks that were permanently disabled in GitLab 17.10 and earlier underwent a data migration. These webhooks might display four failures in [**Recent events**](#view-webhook-request-history) even though the UI might state they have 40 failures. #### Re-enable disabled webhooks {{< history >}} - Introduced in GitLab 15.2 [with a flag](../../../administration/feature_flags/_index.md) named `webhooks_failed_callout`. Disabled by default. - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/issues/365535) in GitLab 15.7. Feature flag `webhooks_failed_callout` removed. {{< /history >}} To re-enable a disabled webhook, [send a test request](#test-a-webhook). The webhook is re-enabled if the test request returns a response code in the `2xx` range. ### Delivery headers {{< history >}} - `X-Gitlab-Event-UUID` header [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/329743) in GitLab 14.8. - `X-Gitlab-Instance` header [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/31333) in GitLab 15.5. - `X-Gitlab-Webhook-UUID` header [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/230830) in GitLab 16.2. - `Idempotency-Key` header [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/388692) in GitLab 17.4. {{< /history >}} GitLab includes the following headers in webhook requests to your endpoint: | Header | Description | Example | | ----------------------- | ------------------------------------------------------- | ------- | | `User-Agent` | User agent in the format `"Gitlab/<VERSION>"`. | `"GitLab/15.5.0-pre"` | | `X-Gitlab-Instance` | Hostname of the GitLab instance that sent the webhook. | `"https://gitlab.com"` | | `X-Gitlab-Webhook-UUID` | Unique ID for each webhook. | `"02affd2d-2cba-4033-917d-ec22d5dc4b38"` | | `X-Gitlab-Event` | Webhook type name. Corresponds to [event types](webhook_events.md) in the format `"<EVENT> Hook"`. | `"Push Hook"` | | `X-Gitlab-Event-UUID` | Unique ID for non-recursive webhooks. Recursive webhooks (triggered by earlier webhooks) share the same value. | `"13792a34-cac6-4fda-95a8-c58e00a3954e"` | | `Idempotency-Key` | Unique ID consistent across webhook retries. Use to ensure idempotency in integrations. | `"f5e5f430-f57b-4e6e-9fac-d9128cd7232f"` | ### Image URL display in webhook body GitLab rewrites relative image references to absolute URLs in webhook bodies. #### Image URL rewriting example If the original image reference in a merge request, comment, or wiki page is: ```markdown ![image](/uploads/$sha/image.png) ``` The rewritten image reference in the webhook body would be: ```markdown ![image](https://gitlab.example.com/-/project/:id/uploads/<SHA>/image.png) ``` This example assumes: - GitLab is installed at `gitlab.example.com`. - The project ID is at `123`. #### Exceptions to image URL rewriting GitLab does not rewrite image URLs when: - They already use HTTP, HTTPS, or protocol-relative URLs. - They use advanced Markdown features, such as link labels. ## Related topics - [Webhook events and webhook JSON payloads](webhook_events.md) - [Project webhooks API](../../../api/project_webhooks.md) - [Group webhooks API](../../../api/group_webhooks.md) - [System hooks API](../../../api/system_hooks.md) - [Troubleshooting](webhooks_troubleshooting.md) - [Send SMS alerts with webhooks and Twilio](https://www.datadoghq.com/blog/send-alerts-sms-customizable-webhooks-twilio/) - [Applying GitLab labels automatically](https://about.gitlab.com/blog/2016/08/19/applying-gitlab-labels-automatically/)
https://docs.gitlab.com/user/project/apple_app_store
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/apple_app_store.md
2025-08-13
doc/user/project/integrations
[ "doc", "user", "project", "integrations" ]
apple_app_store.md
none
unassigned
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Apple App Store Connect
null
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/104888) in GitLab 15.8 [with a flag](../../../administration/feature_flags/_index.md) named `apple_app_store_integration`. Disabled by default. - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/issues/385335) in GitLab 15.10. Feature flag `apple_app_store_integration` removed. {{< /history >}} This feature is part of [Mobile DevOps](../../../ci/mobile_devops/_index.md) developed by GitLab. The feature is still in development, but you can: - [Request a feature](https://gitlab.com/gitlab-org/incubation-engineering/mobile-devops/feedback/-/issues/new?issuable_template=feature_request). - [Report a bug](https://gitlab.com/gitlab-org/incubation-engineering/mobile-devops/feedback/-/issues/new?issuable_template=report_bug). - [Share feedback](https://gitlab.com/gitlab-org/incubation-engineering/mobile-devops/feedback/-/issues/new?issuable_template=general_feedback). Use the Apple App Store Connect integration to configure your CI/CD pipelines to connect to [App Store Connect](https://appstoreconnect.apple.com). With this integration, you can build and release apps for iOS, iPadOS, macOS, tvOS, and watchOS. The Apple App Store Connect integration works out of the box with [fastlane](https://fastlane.tools/). You can also use this integration with other build tools. ## Enable the integration in GitLab Prerequisites: - You must have an Apple ID enrolled in the [Apple Developer Program](https://developer.apple.com/programs/enroll/). - You must [generate a new private key](https://developer.apple.com/documentation/appstoreconnectapi/creating_api_keys_for_app_store_connect_api) for your project in the Apple App Store Connect portal. To enable the Apple App Store Connect integration in GitLab: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Integrations**. 1. Select **Apple App Store Connect**. 1. Under **Enable integration**, select the **Active** checkbox. 1. Provide the Apple App Store Connect configuration information: - **Issuer ID**: The Apple App Store Connect issuer ID. - **Key ID**: The key ID of the generated private key. - **Private key**: The generated private key. You can download this key only once. - **Protected branches and tags only**: Enable to set variables on protected branches and tags only. 1. Select **Save changes**. After you enable the integration: - The global variables `$APP_STORE_CONNECT_API_KEY_ISSUER_ID`, `$APP_STORE_CONNECT_API_KEY_KEY_ID`, `$APP_STORE_CONNECT_API_KEY_KEY`, and `$APP_STORE_CONNECT_API_KEY_IS_KEY_CONTENT_BASE64` are created for CI/CD use. - `$APP_STORE_CONNECT_API_KEY_KEY` contains the Base64-encoded private key. - `$APP_STORE_CONNECT_API_KEY_IS_KEY_CONTENT_BASE64` is always `true`. ## Security considerations ### CI/CD variable security Malicious code pushed to your `.gitlab-ci.yml` file could compromise your variables, including `$APP_STORE_CONNECT_API_KEY_KEY`, and send them to a third-party server. For more information, see [CI/CD variable security](../../../ci/variables/_index.md#cicd-variable-security). ## Enable the integration in fastlane To enable the integration in fastlane and upload a TestFlight or public App Store release, you can add the following code to your app's `fastlane/Fastfile`: ```ruby app_store_connect_api_key ```
--- stage: none group: unassigned info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments title: Apple App Store Connect breadcrumbs: - doc - user - project - integrations --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/104888) in GitLab 15.8 [with a flag](../../../administration/feature_flags/_index.md) named `apple_app_store_integration`. Disabled by default. - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/issues/385335) in GitLab 15.10. Feature flag `apple_app_store_integration` removed. {{< /history >}} This feature is part of [Mobile DevOps](../../../ci/mobile_devops/_index.md) developed by GitLab. The feature is still in development, but you can: - [Request a feature](https://gitlab.com/gitlab-org/incubation-engineering/mobile-devops/feedback/-/issues/new?issuable_template=feature_request). - [Report a bug](https://gitlab.com/gitlab-org/incubation-engineering/mobile-devops/feedback/-/issues/new?issuable_template=report_bug). - [Share feedback](https://gitlab.com/gitlab-org/incubation-engineering/mobile-devops/feedback/-/issues/new?issuable_template=general_feedback). Use the Apple App Store Connect integration to configure your CI/CD pipelines to connect to [App Store Connect](https://appstoreconnect.apple.com). With this integration, you can build and release apps for iOS, iPadOS, macOS, tvOS, and watchOS. The Apple App Store Connect integration works out of the box with [fastlane](https://fastlane.tools/). You can also use this integration with other build tools. ## Enable the integration in GitLab Prerequisites: - You must have an Apple ID enrolled in the [Apple Developer Program](https://developer.apple.com/programs/enroll/). - You must [generate a new private key](https://developer.apple.com/documentation/appstoreconnectapi/creating_api_keys_for_app_store_connect_api) for your project in the Apple App Store Connect portal. To enable the Apple App Store Connect integration in GitLab: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Integrations**. 1. Select **Apple App Store Connect**. 1. Under **Enable integration**, select the **Active** checkbox. 1. Provide the Apple App Store Connect configuration information: - **Issuer ID**: The Apple App Store Connect issuer ID. - **Key ID**: The key ID of the generated private key. - **Private key**: The generated private key. You can download this key only once. - **Protected branches and tags only**: Enable to set variables on protected branches and tags only. 1. Select **Save changes**. After you enable the integration: - The global variables `$APP_STORE_CONNECT_API_KEY_ISSUER_ID`, `$APP_STORE_CONNECT_API_KEY_KEY_ID`, `$APP_STORE_CONNECT_API_KEY_KEY`, and `$APP_STORE_CONNECT_API_KEY_IS_KEY_CONTENT_BASE64` are created for CI/CD use. - `$APP_STORE_CONNECT_API_KEY_KEY` contains the Base64-encoded private key. - `$APP_STORE_CONNECT_API_KEY_IS_KEY_CONTENT_BASE64` is always `true`. ## Security considerations ### CI/CD variable security Malicious code pushed to your `.gitlab-ci.yml` file could compromise your variables, including `$APP_STORE_CONNECT_API_KEY_KEY`, and send them to a third-party server. For more information, see [CI/CD variable security](../../../ci/variables/_index.md#cicd-variable-security). ## Enable the integration in fastlane To enable the integration in fastlane and upload a TestFlight or public App Store release, you can add the following code to your app's `fastlane/Fastfile`: ```ruby app_store_connect_api_key ```
https://docs.gitlab.com/user/project/ewm
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/ewm.md
2025-08-13
doc/user/project/integrations
[ "doc", "user", "project", "integrations" ]
ewm.md
Plan
Project Management
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Engineering Workflow Management (EWM)
null
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} The EWM integration allows you to go from GitLab to EWM work items mentioned in merge request descriptions and commit messages. Each work item reference is automatically converted to a link to the work item. This IBM product was [formerly named Rational Team Concert (RTC)](https://jazz.net/blog/index.php/2019/04/23/renaming-the-ibm-continuous-engineering-portfolio/). This integration is compatible with all versions of RTC and EWM. To enable the EWM integration, in a project: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Integrations**. 1. Select **EWM**. 1. Under **Enable integration**, select the **Active** checkbox. 1. Fill in the required fields: - **Project URL**: The URL to the EWM project area. To obtain your project area URL, go to the path `/ccm/web/projects` and copy the listed project's URL. For example, `https://example.com/ccm/web/Example%20Project`. - **Issue URL**: The URL to the work item editor in the EWM project area. The format is `<your-server-url>/resource/itemName/com.ibm.team.workitem.WorkItem/:id`. GitLab replaces `:id` with the issue number (for example, `https://example.com/ccm/resource/itemName/com.ibm.team.workitem.WorkItem/:id`, which becomes `https://example.com/ccm/resource/itemName/com.ibm.team.workitem.WorkItem/123`). - **New issue URL**: URL to create a new work item in the EWM project area. Append the following fragment to your project area URL: `#action=com.ibm.team.workitem.newWorkItem`. For example, `https://example.com/ccm/web/projects/JKE%20Banking#action=com.ibm.team.workitem.newWorkItem`. 1. Optional. Select **Test settings**. 1. Select **Save changes**. ## Reference EWM work items in commit messages To refer to work items, you can use any keywords supported by the EWM Git Integration Toolkit. Use the format: `<keyword> <id>`. You can use the following keywords: - `bug` - `defect` - `rtcwi` - `task` - `work item` - `workitem` Avoid using the keyword `#`. For more information, see [Creating links from commit comments](https://www.ibm.com/docs/en/elm/7.0.0?topic=commits-creating-links-from-commit-comments).
--- stage: Plan group: Project Management info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments title: Engineering Workflow Management (EWM) breadcrumbs: - doc - user - project - integrations --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} The EWM integration allows you to go from GitLab to EWM work items mentioned in merge request descriptions and commit messages. Each work item reference is automatically converted to a link to the work item. This IBM product was [formerly named Rational Team Concert (RTC)](https://jazz.net/blog/index.php/2019/04/23/renaming-the-ibm-continuous-engineering-portfolio/). This integration is compatible with all versions of RTC and EWM. To enable the EWM integration, in a project: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Integrations**. 1. Select **EWM**. 1. Under **Enable integration**, select the **Active** checkbox. 1. Fill in the required fields: - **Project URL**: The URL to the EWM project area. To obtain your project area URL, go to the path `/ccm/web/projects` and copy the listed project's URL. For example, `https://example.com/ccm/web/Example%20Project`. - **Issue URL**: The URL to the work item editor in the EWM project area. The format is `<your-server-url>/resource/itemName/com.ibm.team.workitem.WorkItem/:id`. GitLab replaces `:id` with the issue number (for example, `https://example.com/ccm/resource/itemName/com.ibm.team.workitem.WorkItem/:id`, which becomes `https://example.com/ccm/resource/itemName/com.ibm.team.workitem.WorkItem/123`). - **New issue URL**: URL to create a new work item in the EWM project area. Append the following fragment to your project area URL: `#action=com.ibm.team.workitem.newWorkItem`. For example, `https://example.com/ccm/web/projects/JKE%20Banking#action=com.ibm.team.workitem.newWorkItem`. 1. Optional. Select **Test settings**. 1. Select **Save changes**. ## Reference EWM work items in commit messages To refer to work items, you can use any keywords supported by the EWM Git Integration Toolkit. Use the format: `<keyword> <id>`. You can use the following keywords: - `bug` - `defect` - `rtcwi` - `task` - `work item` - `workitem` Avoid using the keyword `#`. For more information, see [Creating links from commit comments](https://www.ibm.com/docs/en/elm/7.0.0?topic=commits-creating-links-from-commit-comments).
https://docs.gitlab.com/user/project/pipeline_status_emails
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/pipeline_status_emails.md
2025-08-13
doc/user/project/integrations
[ "doc", "user", "project", "integrations" ]
pipeline_status_emails.md
Verify
Pipeline Execution
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Pipeline status emails
null
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} You can send notifications about pipeline status changes in a group or project to a list of email addresses. Pipeline notifications triggered by blocked users are not delivered. ## Enable pipeline status email notifications To enable pipeline status emails: 1. In your project or group, on the left sidebar, select **Settings > Integrations**. 1. Select **Pipeline status emails**. 1. Ensure the **Active** checkbox is selected. 1. In **Recipients**, enter a comma-separated list of email addresses. Invalid email addresses are automatically filtered out and will not receive notifications. 1. Optional. To receive notifications for broken pipelines only, select **Notify only broken pipelines**. 1. Select the branches to send notifications for. 1. Select **Save changes**.
--- stage: Verify group: Pipeline Execution info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments title: Pipeline status emails breadcrumbs: - doc - user - project - integrations --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} You can send notifications about pipeline status changes in a group or project to a list of email addresses. Pipeline notifications triggered by blocked users are not delivered. ## Enable pipeline status email notifications To enable pipeline status emails: 1. In your project or group, on the left sidebar, select **Settings > Integrations**. 1. Select **Pipeline status emails**. 1. Ensure the **Active** checkbox is selected. 1. In **Recipients**, enter a comma-separated list of email addresses. Invalid email addresses are automatically filtered out and will not receive notifications. 1. Optional. To receive notifications for broken pipelines only, select **Notify only broken pipelines**. 1. Select the branches to send notifications for. 1. Select **Save changes**.
https://docs.gitlab.com/user/project/unify_circuit
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/unify_circuit.md
2025-08-13
doc/user/project/integrations
[ "doc", "user", "project", "integrations" ]
unify_circuit.md
Plan
Project Management
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Unify Circuit
Configure GitLab to send event notifications to Unify Circuit conversations.
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} The Unify Circuit integration sends notifications from GitLab to a Circuit conversation. ## Set up Unify Circuit In Unify Circuit, [add a webhook](https://www.circuit.com/unifyportalfaqdetail?articleId=164448) and copy its URL. In GitLab: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Integrations**. 1. Select **Unify Circuit**. 1. Turn on the **Active** toggle. 1. Select the checkboxes corresponding to the GitLab events you want to receive in Unify Circuit. 1. Paste the **Webhook URL** that you copied from the Unify Circuit configuration step. 1. Select the **Notify only broken pipelines** checkbox to notify only on failures. 1. In the **Branches for which notifications are to be sent** dropdown list, select which types of branches to send notifications for. 1. Optional. Select **Test settings**. 1. Select **Save changes**. Your Unify Circuit conversation now starts receiving GitLab event notifications.
--- stage: Plan group: Project Management info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments title: Unify Circuit description: Configure GitLab to send event notifications to Unify Circuit conversations. breadcrumbs: - doc - user - project - integrations --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} The Unify Circuit integration sends notifications from GitLab to a Circuit conversation. ## Set up Unify Circuit In Unify Circuit, [add a webhook](https://www.circuit.com/unifyportalfaqdetail?articleId=164448) and copy its URL. In GitLab: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Integrations**. 1. Select **Unify Circuit**. 1. Turn on the **Active** toggle. 1. Select the checkboxes corresponding to the GitLab events you want to receive in Unify Circuit. 1. Paste the **Webhook URL** that you copied from the Unify Circuit configuration step. 1. Select the **Notify only broken pipelines** checkbox to notify only on failures. 1. In the **Branches for which notifications are to be sent** dropdown list, select which types of branches to send notifications for. 1. Optional. Select **Test settings**. 1. Select **Save changes**. Your Unify Circuit conversation now starts receiving GitLab event notifications.
https://docs.gitlab.com/user/project/emails_on_push
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/emails_on_push.md
2025-08-13
doc/user/project/integrations
[ "doc", "user", "project", "integrations" ]
emails_on_push.md
Create
Source Code
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Emails on push
null
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} Use emails on push to receive email notifications for changes pushed to your GitLab project. You can select the push events that trigger these notifications. With emails on push, you can specify a list of email addresses to receive commits and diffs for each push. ## Set up the integration To set up emails on push: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Integrations**. 1. Select **Emails on push**. 1. Under **Enable integration**, select the **Active** checkbox. 1. In **Recipients**, enter a list of email addresses separated by spaces or newlines. Invalid email addresses are automatically filtered out and do not receive notifications. 1. Configure the following options: - **Push events** - Email is triggered when a push event is received. - **Tag push events** - Email is triggered when a tag is created and pushed. - **Send from committer** - Send notifications from the committer's email address if the domain matches the domain used by your GitLab instance (such as `user@gitlab.com`). - **Disable code diffs** - Don't include possibly sensitive code diffs in notification body.
--- stage: Create group: Source Code info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments title: Emails on push breadcrumbs: - doc - user - project - integrations --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} Use emails on push to receive email notifications for changes pushed to your GitLab project. You can select the push events that trigger these notifications. With emails on push, you can specify a list of email addresses to receive commits and diffs for each push. ## Set up the integration To set up emails on push: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Integrations**. 1. Select **Emails on push**. 1. Under **Enable integration**, select the **Active** checkbox. 1. In **Recipients**, enter a list of email addresses separated by spaces or newlines. Invalid email addresses are automatically filtered out and do not receive notifications. 1. Configure the following options: - **Push events** - Email is triggered when a push event is received. - **Tag push events** - Email is triggered when a tag is created and pushed. - **Send from committer** - Send notifications from the committer's email address if the domain matches the domain used by your GitLab instance (such as `user@gitlab.com`). - **Disable code diffs** - Don't include possibly sensitive code diffs in notification body.
https://docs.gitlab.com/user/project/pumble
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/pumble.md
2025-08-13
doc/user/project/integrations
[ "doc", "user", "project", "integrations" ]
pumble.md
Plan
Project Management
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Pumble
Configure GitLab to send notifications to a Pumble channel.
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/93623) in GitLab 15.3. {{< /history >}} You can configure GitLab to send notifications to a Pumble channel: 1. Create a webhook for the channel. 1. Add the webhook to GitLab. ## Create a webhook for your Pumble channel 1. Follow the steps in [Incoming Webhooks for Pumble](https://pumble.com/help/integrations/add-pumble-apps/incoming-webhooks-for-pumble/) in the Pumble documentation. 1. Copy the webhook URL. ## Configure settings in GitLab After you have a webhook URL for your Pumble channel, configure GitLab to send notifications: 1. To enable the integration for your group or project: 1. In your group or project, on the left sidebar, select **Settings > Integrations**. 1. To enable the integration for your instance: 1. On the left sidebar, at the bottom, select **Admin**. 1. On the left sidebar, select **Settings > Integrations**. 1. Select the **Pumble** integration. 1. Ensure that the **Active** toggle is enabled. 1. Select the checkboxes corresponding to the GitLab events you want to receive in Pumble. 1. Paste the **Webhook** URL for the Pumble channel. 1. Configure the remaining options. 1. Optional. Select **Test settings**. 1. Select **Save changes**. The Pumble channel begins to receive all applicable GitLab events.
--- stage: Plan group: Project Management info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments title: Pumble description: Configure GitLab to send notifications to a Pumble channel. breadcrumbs: - doc - user - project - integrations --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/93623) in GitLab 15.3. {{< /history >}} You can configure GitLab to send notifications to a Pumble channel: 1. Create a webhook for the channel. 1. Add the webhook to GitLab. ## Create a webhook for your Pumble channel 1. Follow the steps in [Incoming Webhooks for Pumble](https://pumble.com/help/integrations/add-pumble-apps/incoming-webhooks-for-pumble/) in the Pumble documentation. 1. Copy the webhook URL. ## Configure settings in GitLab After you have a webhook URL for your Pumble channel, configure GitLab to send notifications: 1. To enable the integration for your group or project: 1. In your group or project, on the left sidebar, select **Settings > Integrations**. 1. To enable the integration for your instance: 1. On the left sidebar, at the bottom, select **Admin**. 1. On the left sidebar, select **Settings > Integrations**. 1. Select the **Pumble** integration. 1. Ensure that the **Active** toggle is enabled. 1. Select the checkboxes corresponding to the GitLab events you want to receive in Pumble. 1. Paste the **Webhook** URL for the Pumble channel. 1. Configure the remaining options. 1. Optional. Select **Test settings**. 1. Select **Save changes**. The Pumble channel begins to receive all applicable GitLab events.
https://docs.gitlab.com/user/project/squash_tm
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/squash_tm.md
2025-08-13
doc/user/project/integrations
[ "doc", "user", "project", "integrations" ]
squash_tm.md
Plan
Product Planning
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Squash TM
null
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab Self-Managed, GitLab Dedicated {{< /details >}} {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/337855) in GitLab 15.10. {{< /history >}} When [Squash TM](https://www.squashtest.com/en/squash-gitlab-platform) (Test Management) integration is enabled and configured in GitLab, issues (typically user stories) created in GitLab are synchronized as requirements in Squash TM and test progress is reported in GitLab issues. <i class="fa fa-youtube-play youtube" aria-hidden="true"></i> For an overview of optimizing your DevSecOps workflow with the Squash TM and GitLab integration, see [Leverage Requirements and Test management in your SDLC](https://www.youtube.com/watch?v=XAiNUmBiqm4). <!-- Video published on 2024-05-15 --> ## Configure Squash TM 1. Optional. Ask your system administrator to [configure a token in the properties file](https://tm-en.doc.squashtest.com/latest/redirect/gitlab-integration-token.html). 1. Follow the [Squash TM documentation](https://tm-en.doc.squashtest.com/latest/redirect/gitlab-integration-configuration.html) to: 1. Create a GitLab server. 1. Enable the `Xsquash4GitLab` plugin 1. Configure a synchronization. 1. From the **Real-time synchronization** panel, copy the following fields to use later in GitLab: - **Webhook URL**. - **Secret token** if your Squash TM system administrator configured one at step 1. ## Configure GitLab 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Integrations**. 1. Select **Squash TM**. 1. Ensure that the **Active** toggle is enabled. 1. In the **Trigger** section, indicate which type of issue is concerned by the real-time synchronization. 1. Complete the fields: - Enter the **Squash TM webhook URL**, - Enter the **secret token** if your Squash TM system administrator configured it earlier.
--- stage: Plan group: Product Planning info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments title: Squash TM breadcrumbs: - doc - user - project - integrations --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab Self-Managed, GitLab Dedicated {{< /details >}} {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/337855) in GitLab 15.10. {{< /history >}} When [Squash TM](https://www.squashtest.com/en/squash-gitlab-platform) (Test Management) integration is enabled and configured in GitLab, issues (typically user stories) created in GitLab are synchronized as requirements in Squash TM and test progress is reported in GitLab issues. <i class="fa fa-youtube-play youtube" aria-hidden="true"></i> For an overview of optimizing your DevSecOps workflow with the Squash TM and GitLab integration, see [Leverage Requirements and Test management in your SDLC](https://www.youtube.com/watch?v=XAiNUmBiqm4). <!-- Video published on 2024-05-15 --> ## Configure Squash TM 1. Optional. Ask your system administrator to [configure a token in the properties file](https://tm-en.doc.squashtest.com/latest/redirect/gitlab-integration-token.html). 1. Follow the [Squash TM documentation](https://tm-en.doc.squashtest.com/latest/redirect/gitlab-integration-configuration.html) to: 1. Create a GitLab server. 1. Enable the `Xsquash4GitLab` plugin 1. Configure a synchronization. 1. From the **Real-time synchronization** panel, copy the following fields to use later in GitLab: - **Webhook URL**. - **Secret token** if your Squash TM system administrator configured one at step 1. ## Configure GitLab 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Integrations**. 1. Select **Squash TM**. 1. Ensure that the **Active** toggle is enabled. 1. In the **Trigger** section, indicate which type of issue is concerned by the real-time synchronization. 1. Complete the fields: - Enter the **Squash TM webhook URL**, - Enter the **secret token** if your Squash TM system administrator configured it earlier.
https://docs.gitlab.com/user/project/confluence
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/confluence.md
2025-08-13
doc/user/project/integrations
[ "doc", "user", "project", "integrations" ]
confluence.md
Plan
Knowledge
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Confluence Workspace
null
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} Use a Confluence Cloud Workspace as your project wiki. This integration adds a link to a Confluence wiki instead of the [GitLab wiki](../wiki/_index.md). Any content you have in Confluence is not displayed in GitLab. When you turn on the integration: - A new menu item is added to the left sidebar: **Plan > Confluence**. It links to your Confluence wiki. - The **Plan > Wiki** menu item is hidden. To access the GitLab wiki for the project, use its URL: `<example_project_URL>/-/wikis/home`. To bring back the **Plan > Wiki** menu item, turn off this integration. Creating a more comprehensive integration with Confluence Cloud is tracked in [epic 3629](https://gitlab.com/groups/gitlab-org/-/epics/3629). ## Set up the integration This integration can be turned on for a project or for all projects in a group or instance. ### For your project or all projects in a group Prerequisites: - You must have at least the Maintainer role for the project. - You must use a Confluence Cloud URL (`https://example.atlassian.net/wiki/`). To set up the integration for your project or group: 1. On the left sidebar, select **Search or go to** and find your project or group. 1. Select **Settings > Integrations**. 1. Next to **Confluence Workspace**, select **Configure**. 1. Under **Enable integration**, select the **Active** checkbox. 1. In **Confluence Workspace URL**, enter your Confluence Workspace URL. 1. Select **Save changes**. If the integration has been turned on for the group, you can still turn it off for individual projects. ### For all projects on the instance {{< details >}} - Offering: GitLab Self-Managed {{< /details >}} Prerequisites: - You must have administrator access to the instance. - You must use a Confluence Cloud URL (`https://example.atlassian.net/wiki/`). To set up the integration for your instance: 1. On the left sidebar, at the bottom, select **Admin Area**. 1. Select **Settings > Integrations**. 1. Next to **Confluence Workspace**, select **Configure**. 1. Under **Enable integration**, select the **Active** checkbox. 1. In **Confluence Workspace URL**, enter your Confluence Workspace URL. 1. Select **Save changes**. ## Access your Confluence Workspace from GitLab Prerequisites: - You must set up the integration [for your project, group](#for-your-project-or-all-projects-in-a-group), or [for your instance](#for-all-projects-on-the-instance). To access your Confluence Workspace from a GitLab project: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Plan > Confluence**. 1. Select **Go to Confluence**.
--- stage: Plan group: Knowledge info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments title: Confluence Workspace breadcrumbs: - doc - user - project - integrations --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} Use a Confluence Cloud Workspace as your project wiki. This integration adds a link to a Confluence wiki instead of the [GitLab wiki](../wiki/_index.md). Any content you have in Confluence is not displayed in GitLab. When you turn on the integration: - A new menu item is added to the left sidebar: **Plan > Confluence**. It links to your Confluence wiki. - The **Plan > Wiki** menu item is hidden. To access the GitLab wiki for the project, use its URL: `<example_project_URL>/-/wikis/home`. To bring back the **Plan > Wiki** menu item, turn off this integration. Creating a more comprehensive integration with Confluence Cloud is tracked in [epic 3629](https://gitlab.com/groups/gitlab-org/-/epics/3629). ## Set up the integration This integration can be turned on for a project or for all projects in a group or instance. ### For your project or all projects in a group Prerequisites: - You must have at least the Maintainer role for the project. - You must use a Confluence Cloud URL (`https://example.atlassian.net/wiki/`). To set up the integration for your project or group: 1. On the left sidebar, select **Search or go to** and find your project or group. 1. Select **Settings > Integrations**. 1. Next to **Confluence Workspace**, select **Configure**. 1. Under **Enable integration**, select the **Active** checkbox. 1. In **Confluence Workspace URL**, enter your Confluence Workspace URL. 1. Select **Save changes**. If the integration has been turned on for the group, you can still turn it off for individual projects. ### For all projects on the instance {{< details >}} - Offering: GitLab Self-Managed {{< /details >}} Prerequisites: - You must have administrator access to the instance. - You must use a Confluence Cloud URL (`https://example.atlassian.net/wiki/`). To set up the integration for your instance: 1. On the left sidebar, at the bottom, select **Admin Area**. 1. Select **Settings > Integrations**. 1. Next to **Confluence Workspace**, select **Configure**. 1. Under **Enable integration**, select the **Active** checkbox. 1. In **Confluence Workspace URL**, enter your Confluence Workspace URL. 1. Select **Save changes**. ## Access your Confluence Workspace from GitLab Prerequisites: - You must set up the integration [for your project, group](#for-your-project-or-all-projects-in-a-group), or [for your instance](#for-all-projects-on-the-instance). To access your Confluence Workspace from a GitLab project: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Plan > Confluence**. 1. Select **Go to Confluence**.
https://docs.gitlab.com/user/project/aws_codepipeline
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/aws_codepipeline.md
2025-08-13
doc/user/project/integrations
[ "doc", "user", "project", "integrations" ]
aws_codepipeline.md
none
unassigned
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
AWS CodePipeline
null
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com {{< /details >}} {{< history >}} - [Introduced](https://gitlab.com/gitlab-com/alliances/aws/wip/aws-cs-collab/aws-gitlab-collaboration/-/issues/25) in GitLab 16.5. {{< /history >}} You can use your GitLab project to build, test, and deploy code changes using [AWS CodePipeline](https://aws.amazon.com/codepipeline/). To do so, you use: - AWS CodeStar Connections to connect your GitLab.com account to AWS. - That connection to automatically start a pipeline based on changes to your code. ## Create a connection from AWS CodePipeline to GitLab Prerequisites: - You must have the Owner role on the GitLab project that you are connecting with AWS CodePipeline. - You must have the appropriate permissions to create a connection in AWS. - You must use a supported AWS region. Unsupported regions (also listed in the [AWS documentation](https://docs.aws.amazon.com/codepipeline/latest/userguide/connections-gitlab.html)) are: - Asia Pacific (Hong Kong). - Africa (Cape Town). - Middle East (Bahrain). - Europe (Zurich). - AWS GovCloud (US-West and US-East). To create a connection to a project on GitLab.com, you can use either the AWS Management Console, or the AWS Command Line Interface (AWS CLI). ### Use the AWS Management Console To connect a new or existing pipeline in AWS CodePipeline with GitLab.com, first authorize the AWS connection to use your GitLab account. 1. Sign in to the AWS Management Console, and open the [AWS Developer Tools console](https://console.aws.amazon.com/codesuite/settings/connections). 1. Select **Settings** > **Connections** > **Create connection**. 1. In **Select a provider**, select **GitLab**. 1. In **Connection name**, enter the name for the connection that you want to create and select **Connect to GitLab**. 1. In the GitLab sign-in page, enter your credentials and select **Sign in**. 1. An authorization page displays with a message requesting authorization for the connection to access your GitLab account. Select **Authorize**. 1. The browser returns to the connections console page. In the **Create GitLab connection** section, the new connection is shown in **Connection name**. 1. Select **Connect to GitLab**. After the connection is created successfully, a success banner displays. The connection details are shown on the **Connection settings** page. Now you've connected AWS CodeSuite to GitLab.com, you can create or edit a pipeline in AWS CodePipeline that leverages your GitLab projects. 1. Sign in to the [AWS CodePipeline console](https://console.aws.amazon.com/codesuite/codepipeline/start). 1. Create or edit a pipeline: - If you are creating a pipeline: - Complete the fields in the first screen and select **Next**. - On the **Source** page, in the **Source Provider** section, select **GitLab**. - If you are editing an existing pipeline: - Select **Edit** > **Edit stage** to add or edit your source action. - On the **Edit action** page, in the **Action name** section, enter the name for your action. - In **Action provider**, select **GitLab**. 1. In **Connection**, select the connection you created earlier. 1. In **Repository name**, to choose the name of your GitLab project, specify the full project path with the namespace and all subgroups. For example, for a group-level project, enter the project name in the following format: `group-name/subgroup-name/project-name`. The project path with the namespace is in the URL in GitLab. Do not copy URLs from the Web IDE or raw views as they contain other special URL segments. You can also pick an option from the dialog, or type a new path manually. For more information about the: - Path and namespace, see the `path_with_namespace` field in the [projects API](../../../api/projects.md#get-a-single-project). - Namespace in GitLab, see [namespaces](../../namespace/_index.md). 1. In **Branch name**, select the branch where you want your pipeline to detect source changes. If the branch name does not populate automatically, this might be because of one of the following: - You do not have the Owner role for the project. - The project name is not valid. - The connection used does not have access to the project. 1. In **Output artifact format**, select the format for your artifacts. To store: - Output artifacts from the GitLab action using the default method, select **CodePipeline default**. The action accesses the files from the GitLab repository and stores the artifacts in a ZIP file in the pipeline artifact store. - A JSON file that contains a URL reference to the repository so that downstream actions can perform Git commands directly, select **Full clone**. This option can only be used by CodeBuild downstream actions. To choose this option: - [Update the permissions for your CodeBuild project service role](https://docs.aws.amazon.com/codepipeline/latest/userguide/troubleshooting.html#codebuild-role-connections). - Follow the [AWS CodePipeline tutorial on how to use full clone with a GitHub pipeline source](https://docs.aws.amazon.com/codepipeline/latest/userguide/tutorials-github-gitclone.html). 1. Save the source action and continue. ### Use the AWS CLI To use the AWS CLI to create a connection: - Use the `create-connection` command. - Go to the AWS Console to authenticate with your GitLab.com account. - Connect your GitLab project to AWS CodePipeline. To use the `create-connection` command: 1. Open a terminal (Linux, macOS, or Unix) or command prompt (Windows). Use the AWS CLI to run the `create-connection` command, specifying the `--provider-type` and `--connection-name` for your connection. In this example, the third-party provider name is `GitLab` and the specified connection name is `MyConnection`. ```shell aws codestar-connections create-connection --provider-type GitLab --connection-name MyConnection ``` If successful, this command returns the connection's Amazon Resource Name (ARN) information. For example: ```json { "ConnectionArn": "arn:aws:codestar-connections:us-west-2:account_id:connection/aEXAMPLE-8aad-4d5d-8878-dfcab0bc441f" } ``` 1. The new connection is created with a `PENDING` status by default. Use the console to change the connection's status to `AVAILABLE`. 1. [Use the AWS Console to complete the connection](#use-the-aws-management-console). Make sure you select your pending GitLab connection. Do not select **Create connection**. ## Related topics - [Announcement that AWS CodePipeline supports GitLab](https://aws.amazon.com/about-aws/whats-new/2023/08/aws-codepipeline-supports-gitlab/) - [GitLab connections - AWS CodePipeline](https://docs.aws.amazon.com/codepipeline/latest/userguide/connections-gitlab.html) - [Create a connection to GitLab - Developer Tools console](https://docs.aws.amazon.com/dtconsole/latest/userguide/connections-create-gitlab.html) - [CodeStarSourceConnection for Bitbucket, GitHub, GitHub Enterprise Server, and GitLab actions - AWS CodePipeline](https://docs.aws.amazon.com/codepipeline/latest/userguide/action-reference-CodestarConnectionSource.html)
--- stage: none group: unassigned info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments title: AWS CodePipeline breadcrumbs: - doc - user - project - integrations --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com {{< /details >}} {{< history >}} - [Introduced](https://gitlab.com/gitlab-com/alliances/aws/wip/aws-cs-collab/aws-gitlab-collaboration/-/issues/25) in GitLab 16.5. {{< /history >}} You can use your GitLab project to build, test, and deploy code changes using [AWS CodePipeline](https://aws.amazon.com/codepipeline/). To do so, you use: - AWS CodeStar Connections to connect your GitLab.com account to AWS. - That connection to automatically start a pipeline based on changes to your code. ## Create a connection from AWS CodePipeline to GitLab Prerequisites: - You must have the Owner role on the GitLab project that you are connecting with AWS CodePipeline. - You must have the appropriate permissions to create a connection in AWS. - You must use a supported AWS region. Unsupported regions (also listed in the [AWS documentation](https://docs.aws.amazon.com/codepipeline/latest/userguide/connections-gitlab.html)) are: - Asia Pacific (Hong Kong). - Africa (Cape Town). - Middle East (Bahrain). - Europe (Zurich). - AWS GovCloud (US-West and US-East). To create a connection to a project on GitLab.com, you can use either the AWS Management Console, or the AWS Command Line Interface (AWS CLI). ### Use the AWS Management Console To connect a new or existing pipeline in AWS CodePipeline with GitLab.com, first authorize the AWS connection to use your GitLab account. 1. Sign in to the AWS Management Console, and open the [AWS Developer Tools console](https://console.aws.amazon.com/codesuite/settings/connections). 1. Select **Settings** > **Connections** > **Create connection**. 1. In **Select a provider**, select **GitLab**. 1. In **Connection name**, enter the name for the connection that you want to create and select **Connect to GitLab**. 1. In the GitLab sign-in page, enter your credentials and select **Sign in**. 1. An authorization page displays with a message requesting authorization for the connection to access your GitLab account. Select **Authorize**. 1. The browser returns to the connections console page. In the **Create GitLab connection** section, the new connection is shown in **Connection name**. 1. Select **Connect to GitLab**. After the connection is created successfully, a success banner displays. The connection details are shown on the **Connection settings** page. Now you've connected AWS CodeSuite to GitLab.com, you can create or edit a pipeline in AWS CodePipeline that leverages your GitLab projects. 1. Sign in to the [AWS CodePipeline console](https://console.aws.amazon.com/codesuite/codepipeline/start). 1. Create or edit a pipeline: - If you are creating a pipeline: - Complete the fields in the first screen and select **Next**. - On the **Source** page, in the **Source Provider** section, select **GitLab**. - If you are editing an existing pipeline: - Select **Edit** > **Edit stage** to add or edit your source action. - On the **Edit action** page, in the **Action name** section, enter the name for your action. - In **Action provider**, select **GitLab**. 1. In **Connection**, select the connection you created earlier. 1. In **Repository name**, to choose the name of your GitLab project, specify the full project path with the namespace and all subgroups. For example, for a group-level project, enter the project name in the following format: `group-name/subgroup-name/project-name`. The project path with the namespace is in the URL in GitLab. Do not copy URLs from the Web IDE or raw views as they contain other special URL segments. You can also pick an option from the dialog, or type a new path manually. For more information about the: - Path and namespace, see the `path_with_namespace` field in the [projects API](../../../api/projects.md#get-a-single-project). - Namespace in GitLab, see [namespaces](../../namespace/_index.md). 1. In **Branch name**, select the branch where you want your pipeline to detect source changes. If the branch name does not populate automatically, this might be because of one of the following: - You do not have the Owner role for the project. - The project name is not valid. - The connection used does not have access to the project. 1. In **Output artifact format**, select the format for your artifacts. To store: - Output artifacts from the GitLab action using the default method, select **CodePipeline default**. The action accesses the files from the GitLab repository and stores the artifacts in a ZIP file in the pipeline artifact store. - A JSON file that contains a URL reference to the repository so that downstream actions can perform Git commands directly, select **Full clone**. This option can only be used by CodeBuild downstream actions. To choose this option: - [Update the permissions for your CodeBuild project service role](https://docs.aws.amazon.com/codepipeline/latest/userguide/troubleshooting.html#codebuild-role-connections). - Follow the [AWS CodePipeline tutorial on how to use full clone with a GitHub pipeline source](https://docs.aws.amazon.com/codepipeline/latest/userguide/tutorials-github-gitclone.html). 1. Save the source action and continue. ### Use the AWS CLI To use the AWS CLI to create a connection: - Use the `create-connection` command. - Go to the AWS Console to authenticate with your GitLab.com account. - Connect your GitLab project to AWS CodePipeline. To use the `create-connection` command: 1. Open a terminal (Linux, macOS, or Unix) or command prompt (Windows). Use the AWS CLI to run the `create-connection` command, specifying the `--provider-type` and `--connection-name` for your connection. In this example, the third-party provider name is `GitLab` and the specified connection name is `MyConnection`. ```shell aws codestar-connections create-connection --provider-type GitLab --connection-name MyConnection ``` If successful, this command returns the connection's Amazon Resource Name (ARN) information. For example: ```json { "ConnectionArn": "arn:aws:codestar-connections:us-west-2:account_id:connection/aEXAMPLE-8aad-4d5d-8878-dfcab0bc441f" } ``` 1. The new connection is created with a `PENDING` status by default. Use the console to change the connection's status to `AVAILABLE`. 1. [Use the AWS Console to complete the connection](#use-the-aws-management-console). Make sure you select your pending GitLab connection. Do not select **Create connection**. ## Related topics - [Announcement that AWS CodePipeline supports GitLab](https://aws.amazon.com/about-aws/whats-new/2023/08/aws-codepipeline-supports-gitlab/) - [GitLab connections - AWS CodePipeline](https://docs.aws.amazon.com/codepipeline/latest/userguide/connections-gitlab.html) - [Create a connection to GitLab - Developer Tools console](https://docs.aws.amazon.com/dtconsole/latest/userguide/connections-create-gitlab.html) - [CodeStarSourceConnection for Bitbucket, GitHub, GitHub Enterprise Server, and GitLab actions - AWS CodePipeline](https://docs.aws.amazon.com/codepipeline/latest/userguide/action-reference-CodestarConnectionSource.html)
https://docs.gitlab.com/user/project/gitlab_slack_application
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/gitlab_slack_application.md
2025-08-13
doc/user/project/integrations
[ "doc", "user", "project", "integrations" ]
gitlab_slack_application.md
Create
Import
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
GitLab for Slack app
Configure the GitLab for Slack app to use slash commands and receive notifications from GitLab in your Slack workspace.
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/358872) for GitLab Self-Managed in GitLab 16.2. {{< /history >}} {{< alert type="note" >}} This page contains user documentation for the GitLab for Slack app. For administrator documentation, see [GitLab for Slack app administration](../../../administration/settings/slack_app.md). {{< /alert >}} The GitLab for Slack app is a native Slack app that provides [slash commands](#slash-commands) and [notifications](#slack-notifications) in your Slack workspace. GitLab links your Slack user with your GitLab user so that any command you run in Slack is run by your linked GitLab user. ## Install the GitLab for Slack app Prerequisites: - You must have the [appropriate permissions to add apps to your Slack workspace](https://slack.com/help/articles/202035138-Add-apps-to-your-Slack-workspace). - On GitLab Self-Managed, an administrator must [enable the integration](../../../administration/settings/slack_app.md). In GitLab 15.0 and later, the GitLab for Slack app uses [granular permissions](https://medium.com/slack-developer-blog/more-precision-less-restrictions-a3550006f9c3). Although functionality has not changed, you should [reinstall the app](#reinstall-the-gitlab-for-slack-app). ### From the project or group settings {{< history >}} - Installation at the group level [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/391526) in GitLab 16.10 [with a flag](../../../administration/feature_flags/_index.md) named `gitlab_for_slack_app_instance_and_group_level`. Disabled by default. - [Enabled on GitLab.com, GitLab Self-Managed, and GitLab Dedicated](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/147820) in GitLab 16.11. - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/175803) in GitLab 17.8. Feature flag `gitlab_for_slack_app_instance_and_group_level` removed. {{< /history >}} To install the GitLab for Slack app from the project or group settings: 1. On the left sidebar, select **Search or go to** and find your project or group. 1. Select **Settings > Integrations**. 1. Select **GitLab for Slack app**. 1. Select **Install GitLab for Slack app**. You're redirected to the Slack confirmation page. 1. On the Slack confirmation page: 1. Optional. If you're signed in to more than one Slack workspace, in the upper right, from the dropdown list, select the workspace you want to install the app in. On GitLab Self-Managed and GitLab Dedicated, an administrator must first [enable support for multiple workspaces](../../../administration/settings/slack_app.md#enable-support-for-multiple-workspaces) for the dropdown list to appear. 1. Select **Allow**. ### From the Slack App Directory {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com {{< /details >}} On GitLab.com, you can also install the GitLab for Slack app from the [Slack App Directory](https://slack-platform.slack.com/apps/A676ADMV5-gitlab). To install the GitLab for Slack app from the Slack App Directory: 1. Go to the [GitLab for Slack page](https://gitlab.com/-/profile/slack/edit). 1. Select a GitLab project to link with your Slack workspace. ## Reinstall the GitLab for Slack app When GitLab releases new features for the GitLab for Slack app, you might have to reinstall the app to use these features. To reinstall the GitLab for Slack app: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Integrations**. 1. Select **GitLab for Slack app**. 1. Select **Install GitLab for Slack app**. You're redirected to the Slack confirmation page. 1. On the Slack confirmation page: 1. Optional. If you're signed in to more than one Slack workspace, in the upper right, from the dropdown list, select the workspace you want to reinstall the app in. On GitLab Self-Managed and GitLab Dedicated, an administrator must first [enable support for multiple workspaces](../../../administration/settings/slack_app.md#enable-support-for-multiple-workspaces) for the dropdown list to appear. 1. Select **Allow**. The GitLab for Slack app is updated for all projects that use the integration. Alternatively, you can [configure the integration](https://about.gitlab.com/solutions/slack/) again. ## Slash commands You can use slash commands to run common GitLab operations. For the GitLab for Slack app: - You must authorize your Slack user when you run your first slash command. - You can replace `<project>` with a project full path or [create a project alias](#create-a-project-alias) for slash commands. If you use [Slack slash commands](slack_slash_commands.md) or [Mattermost slash commands](mattermost_slash_commands.md) instead: - Replace `/gitlab` with the trigger name you've configured for these integrations. - Remove `<project>`. The following slash commands are available for GitLab: | Command | Description | | ------- | ----------- | | `/gitlab help` | Shows all available slash commands. | | `/gitlab <project> issue show <id>` | Shows the issue with the ID `<id>`. | | `/gitlab <project> issue new <title>` <kbd>Shift</kbd>+<kbd>Enter</kbd> `<description>` | Creates an issue with the title `<title>` and description `<description>`. | | `/gitlab <project> issue search <query>` | Shows up to five issues that match `<query>`. | | `/gitlab <project> issue move <id> to <project>` | Moves the issue with the ID `<id>` to `<project>`. | | `/gitlab <project> issue close <id>` | Closes the issue with the ID `<id>`. | | `/gitlab <project> issue comment <id>` <kbd>Shift</kbd>+<kbd>Enter</kbd> `<comment>` | Adds a comment with the comment body `<comment>` to the issue with the ID `<id>`. | | `/gitlab <project> deploy <from> to <to>` | [Deploys](#deploy-command) from the `<from>` environment to the `<to>` environment. | | `/gitlab <project> run <job name> <arguments>` | Executes the [ChatOps](../../../ci/chatops/_index.md) job `<job name>` on the default branch. | | `/gitlab incident declare` | Opens a dialog to [create an incident from Slack](../../../operations/incident_management/slack.md). | ### `deploy` command To deploy to an environment, GitLab tries to find a manual deployment action in the pipeline. If only one deployment action is defined for an environment, that action is triggered. If more than one deployment action is defined, GitLab tries to find an action name that matches the environment name. The command returns an error if GitLab cannot find a matching deployment action. ### Create a project alias In the GitLab for Slack app, slash commands use a project full path by default. You can use a project alias instead. To create a project alias for slash commands in the GitLab for Slack app: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Integrations**. 1. Select **GitLab for Slack app**. 1. Next to the project path or alias, select **Edit**. 1. Enter the new alias and select **Save changes**. ## Slack notifications {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/381012) in GitLab 15.9. {{< /history >}} You can receive notifications to Slack channels for certain GitLab [events](#notification-events). ### Configure notifications To configure Slack notifications: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Integrations**. 1. Select **GitLab for Slack app**. 1. In the **Trigger** section: - Select the checkbox for each GitLab [event](#notification-events) you want to receive notifications for in Slack. - For each checkbox you select, enter the names of the Slack channels you want to receive notifications. You can enter up to 10 channel names separated by commas (for example, `#channel-one, #channel-two`). {{< alert type="note" >}} If the Slack channel is private, you must [add the GitLab for Slack app to the channel](#receive-notifications-to-a-private-channel). {{< /alert >}} 1. Optional. In the **Notification settings** section: - Select the **Notify only broken pipelines** checkbox to receive notifications for failed pipelines only. - From the **Branches for which notifications are to be sent** dropdown list, select the branches you want to receive notifications for. Notifications for vulnerabilities are only triggered by the default branch, regardless of the selected branches. For more details, see [issue 469373](https://gitlab.com/gitlab-org/gitlab/-/issues/469373). - For **Labels to be notified**, enter any or all of the labels a GitLab issue, merge request, or comment must have to receive notifications for. Leave blank to receive notifications for all events. 1. Optional. Select **Test settings**. 1. Select **Save changes**. ### Receive notifications to a private channel To receive notifications to a private Slack channel, you must add the GitLab for Slack app to the channel: 1. Mention the app in the channel by entering `@GitLab`. 1. Select **Add to Channel**. ### Notification events The following GitLab events can trigger notifications in Slack: | Event | Description | |-----------------------------------------------------------------------|---------------------------------------------------------------| | Push | A push is made to the repository. | | Issue | An issue is created, closed, or reopened. | | Confidential issue | A confidential issue is created, closed, or reopened. | | Merge request | A merge request is created, merged, closed, or reopened. | | Note | A comment is added. | | Confidential note | An internal note or comment on a confidential issue is added. | | Tag push | A tag is pushed to the repository or removed. | | Pipeline | A pipeline status changes. | | Wiki page | A wiki page is created or updated. | | Deployment | A deployment is started or finished. | | [Group mention](#trigger-notifications-for-group-mentions) in public | A group is mentioned in a public channel. | | [Group mention](#trigger-notifications-for-group-mentions) in private | A group is mentioned in a private channel. | | [Incident](../../../operations/incident_management/slack.md) | An incident is created, closed, or reopened. | | [Vulnerability](../../application_security/vulnerabilities/_index.md) | A new, unique vulnerability is recorded on the default branch.| | Alert | A new, unique alert is recorded. | ### Trigger notifications for group mentions {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/391526) in GitLab 16.10 [with a flag](../../../administration/feature_flags/_index.md) named `gitlab_for_slack_app_instance_and_group_level`. Disabled by default. - [Enabled on GitLab.com, GitLab Self-Managed, and GitLab Dedicated](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/147820) in GitLab 16.11. - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/175803) in GitLab 17.8. Feature flag `gitlab_for_slack_app_instance_and_group_level` removed. {{< /history >}} To trigger a [notification event](#notification-events) for a group mention, use `@<group_name>` in: - Issue and merge request descriptions - Comments on issues, merge requests, and commits
--- stage: Create group: Import info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments title: GitLab for Slack app description: Configure the GitLab for Slack app to use slash commands and receive notifications from GitLab in your Slack workspace. breadcrumbs: - doc - user - project - integrations --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/358872) for GitLab Self-Managed in GitLab 16.2. {{< /history >}} {{< alert type="note" >}} This page contains user documentation for the GitLab for Slack app. For administrator documentation, see [GitLab for Slack app administration](../../../administration/settings/slack_app.md). {{< /alert >}} The GitLab for Slack app is a native Slack app that provides [slash commands](#slash-commands) and [notifications](#slack-notifications) in your Slack workspace. GitLab links your Slack user with your GitLab user so that any command you run in Slack is run by your linked GitLab user. ## Install the GitLab for Slack app Prerequisites: - You must have the [appropriate permissions to add apps to your Slack workspace](https://slack.com/help/articles/202035138-Add-apps-to-your-Slack-workspace). - On GitLab Self-Managed, an administrator must [enable the integration](../../../administration/settings/slack_app.md). In GitLab 15.0 and later, the GitLab for Slack app uses [granular permissions](https://medium.com/slack-developer-blog/more-precision-less-restrictions-a3550006f9c3). Although functionality has not changed, you should [reinstall the app](#reinstall-the-gitlab-for-slack-app). ### From the project or group settings {{< history >}} - Installation at the group level [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/391526) in GitLab 16.10 [with a flag](../../../administration/feature_flags/_index.md) named `gitlab_for_slack_app_instance_and_group_level`. Disabled by default. - [Enabled on GitLab.com, GitLab Self-Managed, and GitLab Dedicated](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/147820) in GitLab 16.11. - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/175803) in GitLab 17.8. Feature flag `gitlab_for_slack_app_instance_and_group_level` removed. {{< /history >}} To install the GitLab for Slack app from the project or group settings: 1. On the left sidebar, select **Search or go to** and find your project or group. 1. Select **Settings > Integrations**. 1. Select **GitLab for Slack app**. 1. Select **Install GitLab for Slack app**. You're redirected to the Slack confirmation page. 1. On the Slack confirmation page: 1. Optional. If you're signed in to more than one Slack workspace, in the upper right, from the dropdown list, select the workspace you want to install the app in. On GitLab Self-Managed and GitLab Dedicated, an administrator must first [enable support for multiple workspaces](../../../administration/settings/slack_app.md#enable-support-for-multiple-workspaces) for the dropdown list to appear. 1. Select **Allow**. ### From the Slack App Directory {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com {{< /details >}} On GitLab.com, you can also install the GitLab for Slack app from the [Slack App Directory](https://slack-platform.slack.com/apps/A676ADMV5-gitlab). To install the GitLab for Slack app from the Slack App Directory: 1. Go to the [GitLab for Slack page](https://gitlab.com/-/profile/slack/edit). 1. Select a GitLab project to link with your Slack workspace. ## Reinstall the GitLab for Slack app When GitLab releases new features for the GitLab for Slack app, you might have to reinstall the app to use these features. To reinstall the GitLab for Slack app: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Integrations**. 1. Select **GitLab for Slack app**. 1. Select **Install GitLab for Slack app**. You're redirected to the Slack confirmation page. 1. On the Slack confirmation page: 1. Optional. If you're signed in to more than one Slack workspace, in the upper right, from the dropdown list, select the workspace you want to reinstall the app in. On GitLab Self-Managed and GitLab Dedicated, an administrator must first [enable support for multiple workspaces](../../../administration/settings/slack_app.md#enable-support-for-multiple-workspaces) for the dropdown list to appear. 1. Select **Allow**. The GitLab for Slack app is updated for all projects that use the integration. Alternatively, you can [configure the integration](https://about.gitlab.com/solutions/slack/) again. ## Slash commands You can use slash commands to run common GitLab operations. For the GitLab for Slack app: - You must authorize your Slack user when you run your first slash command. - You can replace `<project>` with a project full path or [create a project alias](#create-a-project-alias) for slash commands. If you use [Slack slash commands](slack_slash_commands.md) or [Mattermost slash commands](mattermost_slash_commands.md) instead: - Replace `/gitlab` with the trigger name you've configured for these integrations. - Remove `<project>`. The following slash commands are available for GitLab: | Command | Description | | ------- | ----------- | | `/gitlab help` | Shows all available slash commands. | | `/gitlab <project> issue show <id>` | Shows the issue with the ID `<id>`. | | `/gitlab <project> issue new <title>` <kbd>Shift</kbd>+<kbd>Enter</kbd> `<description>` | Creates an issue with the title `<title>` and description `<description>`. | | `/gitlab <project> issue search <query>` | Shows up to five issues that match `<query>`. | | `/gitlab <project> issue move <id> to <project>` | Moves the issue with the ID `<id>` to `<project>`. | | `/gitlab <project> issue close <id>` | Closes the issue with the ID `<id>`. | | `/gitlab <project> issue comment <id>` <kbd>Shift</kbd>+<kbd>Enter</kbd> `<comment>` | Adds a comment with the comment body `<comment>` to the issue with the ID `<id>`. | | `/gitlab <project> deploy <from> to <to>` | [Deploys](#deploy-command) from the `<from>` environment to the `<to>` environment. | | `/gitlab <project> run <job name> <arguments>` | Executes the [ChatOps](../../../ci/chatops/_index.md) job `<job name>` on the default branch. | | `/gitlab incident declare` | Opens a dialog to [create an incident from Slack](../../../operations/incident_management/slack.md). | ### `deploy` command To deploy to an environment, GitLab tries to find a manual deployment action in the pipeline. If only one deployment action is defined for an environment, that action is triggered. If more than one deployment action is defined, GitLab tries to find an action name that matches the environment name. The command returns an error if GitLab cannot find a matching deployment action. ### Create a project alias In the GitLab for Slack app, slash commands use a project full path by default. You can use a project alias instead. To create a project alias for slash commands in the GitLab for Slack app: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Integrations**. 1. Select **GitLab for Slack app**. 1. Next to the project path or alias, select **Edit**. 1. Enter the new alias and select **Save changes**. ## Slack notifications {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/381012) in GitLab 15.9. {{< /history >}} You can receive notifications to Slack channels for certain GitLab [events](#notification-events). ### Configure notifications To configure Slack notifications: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Integrations**. 1. Select **GitLab for Slack app**. 1. In the **Trigger** section: - Select the checkbox for each GitLab [event](#notification-events) you want to receive notifications for in Slack. - For each checkbox you select, enter the names of the Slack channels you want to receive notifications. You can enter up to 10 channel names separated by commas (for example, `#channel-one, #channel-two`). {{< alert type="note" >}} If the Slack channel is private, you must [add the GitLab for Slack app to the channel](#receive-notifications-to-a-private-channel). {{< /alert >}} 1. Optional. In the **Notification settings** section: - Select the **Notify only broken pipelines** checkbox to receive notifications for failed pipelines only. - From the **Branches for which notifications are to be sent** dropdown list, select the branches you want to receive notifications for. Notifications for vulnerabilities are only triggered by the default branch, regardless of the selected branches. For more details, see [issue 469373](https://gitlab.com/gitlab-org/gitlab/-/issues/469373). - For **Labels to be notified**, enter any or all of the labels a GitLab issue, merge request, or comment must have to receive notifications for. Leave blank to receive notifications for all events. 1. Optional. Select **Test settings**. 1. Select **Save changes**. ### Receive notifications to a private channel To receive notifications to a private Slack channel, you must add the GitLab for Slack app to the channel: 1. Mention the app in the channel by entering `@GitLab`. 1. Select **Add to Channel**. ### Notification events The following GitLab events can trigger notifications in Slack: | Event | Description | |-----------------------------------------------------------------------|---------------------------------------------------------------| | Push | A push is made to the repository. | | Issue | An issue is created, closed, or reopened. | | Confidential issue | A confidential issue is created, closed, or reopened. | | Merge request | A merge request is created, merged, closed, or reopened. | | Note | A comment is added. | | Confidential note | An internal note or comment on a confidential issue is added. | | Tag push | A tag is pushed to the repository or removed. | | Pipeline | A pipeline status changes. | | Wiki page | A wiki page is created or updated. | | Deployment | A deployment is started or finished. | | [Group mention](#trigger-notifications-for-group-mentions) in public | A group is mentioned in a public channel. | | [Group mention](#trigger-notifications-for-group-mentions) in private | A group is mentioned in a private channel. | | [Incident](../../../operations/incident_management/slack.md) | An incident is created, closed, or reopened. | | [Vulnerability](../../application_security/vulnerabilities/_index.md) | A new, unique vulnerability is recorded on the default branch.| | Alert | A new, unique alert is recorded. | ### Trigger notifications for group mentions {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/391526) in GitLab 16.10 [with a flag](../../../administration/feature_flags/_index.md) named `gitlab_for_slack_app_instance_and_group_level`. Disabled by default. - [Enabled on GitLab.com, GitLab Self-Managed, and GitLab Dedicated](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/147820) in GitLab 16.11. - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/175803) in GitLab 17.8. Feature flag `gitlab_for_slack_app_instance_and_group_level` removed. {{< /history >}} To trigger a [notification event](#notification-events) for a group mention, use `@<group_name>` in: - Issue and merge request descriptions - Comments on issues, merge requests, and commits
https://docs.gitlab.com/user/project/mattermost_slash_commands
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/mattermost_slash_commands.md
2025-08-13
doc/user/project/integrations
[ "doc", "user", "project", "integrations" ]
mattermost_slash_commands.md
Create
Import
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Mattermost slash commands
Configure Mattermost slash commands to run common GitLab operations from a Mattermost chat environment.
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} You can use [slash commands](gitlab_slack_application.md#slash-commands) to run common GitLab operations, like creating an issue, from a [Mattermost](https://mattermost.com/) chat environment. GitLab can also send events (such as `issue created`) to Mattermost as part of the separately configured [Mattermost notifications](mattermost.md). For a list of available slash commands, see [Slash commands](gitlab_slack_application.md#slash-commands). ## Configuration options GitLab provides different ways to configure Mattermost slash commands. For any of these options, you must have Mattermost [3.4 or later](https://mattermost.com/blog/category/platform/releases/). - **Linux package installations**: Mattermost is bundled with [Linux package](https://docs.gitlab.com/omnibus/). To configure Mattermost for Linux package installations, read the [Linux package Mattermost documentation](../../../integration/mattermost/_index.md). - **If Mattermost is installed on the same server as GitLab**, use the [automated configuration](#configure-automatically). - **For all other installations**, use the [manual configuration](#configure-manually). ## Configure automatically If Mattermost is installed on the same server as GitLab, you can automatically configure Mattermost slash commands: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings** > **Integrations**. 1. Select **Mattermost slash commands**. 1. Under **Enable integration**, ensure the **Active** checkbox is selected. 1. Select **Add to Mattermost**, and select **Save changes**. ## Configure manually To manually configure slash commands in Mattermost, you must: 1. [Enable custom slash commands in Mattermost](#enable-custom-slash-commands-in-mattermost). This step is required only for self-compiled installations. 1. [Get configuration values from GitLab](#get-configuration-values-from-gitlab). 1. [Create a slash command in Mattermost](#create-a-slash-command-in-mattermost). 1. [Provide the Mattermost token to GitLab](#provide-the-mattermost-token-to-gitlab). ### Enable custom slash commands in Mattermost To enable custom slash commands from the Mattermost administrator console: 1. Sign in to Mattermost as a user with administrator privileges. 1. Next to your username, select the {{< icon name="ellipsis_v" >}} **Settings** icon, and select **System Console**. 1. Select **Integration Management**, and set these values to `TRUE`: - **Enable Custom Slash Commands** - **Enable integrations to override usernames** - **Enable integrations to override profile picture icons** 1. Select **Save**, but do not close this browser tab. You need it in a later step. ### Get configuration values from GitLab To get configuration values from GitLab: 1. In a different browser tab, sign in to GitLab as a user with administrator access. 1. On the left sidebar, at the bottom, select **Admin**. 1. Select **Settings** > **Integrations**. 1. Select **Mattermost slash commands**. GitLab displays potential values for Mattermost settings. 1. Copy the **Request URL** value. All other values are suggestions. 1. Do not close this browser tab. You need it in a later step. ### Create a slash command in Mattermost To create a slash command in Mattermost: 1. [In the Mattermost browser tab](#enable-custom-slash-commands-in-mattermost), go to your team page. 1. Select the {{< icon name="ellipsis_v" >}} **Settings** icon, and select **Integrations**. 1. On the left sidebar, select **Slash commands**. 1. Select **Add Slash Command**. 1. Provide a **Display Name** and **Description** for your new command. 1. Provide a **Command Trigger Word** based on your application's configuration: - **If you intend to only connect one project to your Mattermost team**, use `/gitlab` for your trigger word. - **If you intend to connect multiple projects**, use a trigger word that relates to your project, such as `/project-name` or `/gitlab-project-name`. 1. For **Request URL**, [paste the value you copied from GitLab](#get-configuration-values-from-gitlab). 1. For all other values, you may use the suggestions from GitLab or your preferred values. 1. Copy the **Token** value, and select **Done**. ### Provide the Mattermost token to GitLab Creating a slash command in Mattermost generates a token you must provide to GitLab: 1. [In the GitLab browser tab](#get-configuration-values-from-gitlab), select the **Active** checkbox. 1. In the **Token** text box, [paste the token you copied from Mattermost](#create-a-slash-command-in-mattermost). 1. Select **Save changes**. Your slash command can now communicate with your GitLab project. ## Connect your GitLab account to Mattermost Prerequisites: - To run [slash commands](gitlab_slack_application.md#slash-commands), you must have [permission](../../permissions.md#project-members-permissions) to perform the action in the GitLab project. To interact with GitLab using Mattermost slash commands: 1. In a Mattermost chat environment, run your new slash command. 1. Select **connect your GitLab account** to authorize access. You can see all authorized chat accounts in your Mattermost profile page under **Chat**. ## Related topics - [Mattermost Linux package](../../../integration/mattermost/_index.md) - [Slash commands at Mattermost](https://developers.mattermost.com/integrate/slash-commands/) ## Troubleshooting When a Mattermost slash command does not trigger an event in GitLab: - Ensure you're using a public channel. Mattermost webhooks do not have access to private channels. - If you require a private channel, edit the webhook channel, and select a private one. All events are sent to the specified channel.
--- stage: Create group: Import info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments title: Mattermost slash commands description: Configure Mattermost slash commands to run common GitLab operations from a Mattermost chat environment. breadcrumbs: - doc - user - project - integrations --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} You can use [slash commands](gitlab_slack_application.md#slash-commands) to run common GitLab operations, like creating an issue, from a [Mattermost](https://mattermost.com/) chat environment. GitLab can also send events (such as `issue created`) to Mattermost as part of the separately configured [Mattermost notifications](mattermost.md). For a list of available slash commands, see [Slash commands](gitlab_slack_application.md#slash-commands). ## Configuration options GitLab provides different ways to configure Mattermost slash commands. For any of these options, you must have Mattermost [3.4 or later](https://mattermost.com/blog/category/platform/releases/). - **Linux package installations**: Mattermost is bundled with [Linux package](https://docs.gitlab.com/omnibus/). To configure Mattermost for Linux package installations, read the [Linux package Mattermost documentation](../../../integration/mattermost/_index.md). - **If Mattermost is installed on the same server as GitLab**, use the [automated configuration](#configure-automatically). - **For all other installations**, use the [manual configuration](#configure-manually). ## Configure automatically If Mattermost is installed on the same server as GitLab, you can automatically configure Mattermost slash commands: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings** > **Integrations**. 1. Select **Mattermost slash commands**. 1. Under **Enable integration**, ensure the **Active** checkbox is selected. 1. Select **Add to Mattermost**, and select **Save changes**. ## Configure manually To manually configure slash commands in Mattermost, you must: 1. [Enable custom slash commands in Mattermost](#enable-custom-slash-commands-in-mattermost). This step is required only for self-compiled installations. 1. [Get configuration values from GitLab](#get-configuration-values-from-gitlab). 1. [Create a slash command in Mattermost](#create-a-slash-command-in-mattermost). 1. [Provide the Mattermost token to GitLab](#provide-the-mattermost-token-to-gitlab). ### Enable custom slash commands in Mattermost To enable custom slash commands from the Mattermost administrator console: 1. Sign in to Mattermost as a user with administrator privileges. 1. Next to your username, select the {{< icon name="ellipsis_v" >}} **Settings** icon, and select **System Console**. 1. Select **Integration Management**, and set these values to `TRUE`: - **Enable Custom Slash Commands** - **Enable integrations to override usernames** - **Enable integrations to override profile picture icons** 1. Select **Save**, but do not close this browser tab. You need it in a later step. ### Get configuration values from GitLab To get configuration values from GitLab: 1. In a different browser tab, sign in to GitLab as a user with administrator access. 1. On the left sidebar, at the bottom, select **Admin**. 1. Select **Settings** > **Integrations**. 1. Select **Mattermost slash commands**. GitLab displays potential values for Mattermost settings. 1. Copy the **Request URL** value. All other values are suggestions. 1. Do not close this browser tab. You need it in a later step. ### Create a slash command in Mattermost To create a slash command in Mattermost: 1. [In the Mattermost browser tab](#enable-custom-slash-commands-in-mattermost), go to your team page. 1. Select the {{< icon name="ellipsis_v" >}} **Settings** icon, and select **Integrations**. 1. On the left sidebar, select **Slash commands**. 1. Select **Add Slash Command**. 1. Provide a **Display Name** and **Description** for your new command. 1. Provide a **Command Trigger Word** based on your application's configuration: - **If you intend to only connect one project to your Mattermost team**, use `/gitlab` for your trigger word. - **If you intend to connect multiple projects**, use a trigger word that relates to your project, such as `/project-name` or `/gitlab-project-name`. 1. For **Request URL**, [paste the value you copied from GitLab](#get-configuration-values-from-gitlab). 1. For all other values, you may use the suggestions from GitLab or your preferred values. 1. Copy the **Token** value, and select **Done**. ### Provide the Mattermost token to GitLab Creating a slash command in Mattermost generates a token you must provide to GitLab: 1. [In the GitLab browser tab](#get-configuration-values-from-gitlab), select the **Active** checkbox. 1. In the **Token** text box, [paste the token you copied from Mattermost](#create-a-slash-command-in-mattermost). 1. Select **Save changes**. Your slash command can now communicate with your GitLab project. ## Connect your GitLab account to Mattermost Prerequisites: - To run [slash commands](gitlab_slack_application.md#slash-commands), you must have [permission](../../permissions.md#project-members-permissions) to perform the action in the GitLab project. To interact with GitLab using Mattermost slash commands: 1. In a Mattermost chat environment, run your new slash command. 1. Select **connect your GitLab account** to authorize access. You can see all authorized chat accounts in your Mattermost profile page under **Chat**. ## Related topics - [Mattermost Linux package](../../../integration/mattermost/_index.md) - [Slash commands at Mattermost](https://developers.mattermost.com/integrate/slash-commands/) ## Troubleshooting When a Mattermost slash command does not trigger an event in GitLab: - Ensure you're using a public channel. Mattermost webhooks do not have access to private channels. - If you require a private channel, edit the webhook channel, and select a private one. All events are sent to the specified channel.
https://docs.gitlab.com/user/project/discord_notifications
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/discord_notifications.md
2025-08-13
doc/user/project/integrations
[ "doc", "user", "project", "integrations" ]
discord_notifications.md
Plan
Project Management
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Discord notifications
Configure the Discord notifications integration to receive notifications from GitLab in Discord channels.
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} The Discord Notifications integration sends event notifications from GitLab to the channel for which the webhook was created. To send GitLab event notifications to a Discord channel, [create a webhook in Discord](https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks) and configure it in GitLab. ## Create webhook 1. Open the Discord channel you want to receive GitLab event notifications. 1. From the channel menu, select **Edit channel**. 1. Select **Integrations**. 1. If there are no existing webhooks, select **Create Webhook**. Otherwise, select **View Webhooks** then **New Webhook**. 1. Enter the name of the bot to post the message. 1. Optional. Edit the avatar. 1. Copy the URL from the **WEBHOOK URL** field. 1. Select **Save**. ## Configure created webhook in GitLab {{< history >}} - Event webhook overrides [introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/125621) in GitLab 16.3. - Webhook URL validation introduced in GitLab 18.0. {{< /history >}} Prerequisites: - You must use a Discord URL (`https://discord.com/api/webhooks/webhook-snowflake/webhook-token`). With the webhook URL created in the Discord channel, you can set up the Discord Notifications integration in GitLab. 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Integrations**. 1. Select **Discord Notifications**. 1. Ensure that the **Active** toggle is enabled. 1. Paste the webhook URL that you [created earlier](#create-webhook) into the **Webhook** field. 1. Select the checkboxes corresponding to the GitLab events for which you want to send notifications to Discord. 1. Optionally for each checkbox that you select, enter a new Discord webhook URL that you have [configured](#create-webhook) to override the default one in the **Webhook** field. 1. Configure the remaining options and select the **Save changes** button. The Discord channel you created the webhook for now receives notification of the GitLab events that were configured.
--- stage: Plan group: Project Management info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments title: Discord notifications description: Configure the Discord notifications integration to receive notifications from GitLab in Discord channels. breadcrumbs: - doc - user - project - integrations --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} The Discord Notifications integration sends event notifications from GitLab to the channel for which the webhook was created. To send GitLab event notifications to a Discord channel, [create a webhook in Discord](https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks) and configure it in GitLab. ## Create webhook 1. Open the Discord channel you want to receive GitLab event notifications. 1. From the channel menu, select **Edit channel**. 1. Select **Integrations**. 1. If there are no existing webhooks, select **Create Webhook**. Otherwise, select **View Webhooks** then **New Webhook**. 1. Enter the name of the bot to post the message. 1. Optional. Edit the avatar. 1. Copy the URL from the **WEBHOOK URL** field. 1. Select **Save**. ## Configure created webhook in GitLab {{< history >}} - Event webhook overrides [introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/125621) in GitLab 16.3. - Webhook URL validation introduced in GitLab 18.0. {{< /history >}} Prerequisites: - You must use a Discord URL (`https://discord.com/api/webhooks/webhook-snowflake/webhook-token`). With the webhook URL created in the Discord channel, you can set up the Discord Notifications integration in GitLab. 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Integrations**. 1. Select **Discord Notifications**. 1. Ensure that the **Active** toggle is enabled. 1. Paste the webhook URL that you [created earlier](#create-webhook) into the **Webhook** field. 1. Select the checkboxes corresponding to the GitLab events for which you want to send notifications to Discord. 1. Optionally for each checkbox that you select, enter a new Discord webhook URL that you have [configured](#create-webhook) to override the default one in the **Webhook** field. 1. Configure the remaining options and select the **Save changes** button. The Discord channel you created the webhook for now receives notification of the GitLab events that were configured.
https://docs.gitlab.com/user/project/github
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/github.md
2025-08-13
doc/user/project/integrations
[ "doc", "user", "project", "integrations" ]
github.md
Verify
Pipeline Execution
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
GitHub
null
{{< details >}} - Tier: Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} You can update GitHub with pipeline status updates from GitLab. The GitHub integration can help you if you use GitLab for CI/CD. ![Pipeline status update on GitHub](img/github_status_check_pipeline_update_v10_6.png) This project integration is separate from the [instance-wide GitHub integration](../import/github.md#mirror-a-repository-and-share-pipeline-status) and is automatically configured when you import a [GitHub project](../../../integration/github.md). ## Configure the integration This integration requires a [GitHub API token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens) with `repo:status` access granted. Complete these steps on GitHub: 1. Go to your **Personal access tokens** page at <https://github.com/settings/tokens>. 1. Select **Generate new token**. 1. Under **Note**, enter a name for the new token. 1. Ensure `repo:status` is selected and select **Generate token**. 1. Copy the generated token to use in GitLab. Complete these steps in GitLab: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Integrations**. 1. Select **GitHub**. 1. Ensure the **Active** checkbox is selected. 1. In **Token**, paste the token you generated on GitHub. 1. In **Repository URL**, enter the path to your project on GitHub, such as `https://github.com/username/repository`. 1. Optional. To disable [static status check names](#static-or-dynamic-status-check-names), clear the **Enable static status check names** checkbox. 1. Optional. Select **Test settings**. 1. Select **Save changes**. After configuring the integration, see [Pipelines for external pull requests](../../../ci/ci_cd_for_external_repos/_index.md#pipelines-for-external-pull-requests) to configure pipelines to run for open pull requests. ### Static or dynamic status check names A status check name can be static or dynamic: - **Static**: The hostname of your GitLab instance is appended to the status check name. - **Dynamic**: The branch name is appended to the status check name. The **Enable static status check names** option enables you to configure required status checks in GitHub, which need a consistent (static) name to work correctly. If you [disable this option](#configure-the-integration), GitLab uses dynamic status check names instead.
--- stage: Verify group: Pipeline Execution info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments title: GitHub breadcrumbs: - doc - user - project - integrations --- {{< details >}} - Tier: Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} You can update GitHub with pipeline status updates from GitLab. The GitHub integration can help you if you use GitLab for CI/CD. ![Pipeline status update on GitHub](img/github_status_check_pipeline_update_v10_6.png) This project integration is separate from the [instance-wide GitHub integration](../import/github.md#mirror-a-repository-and-share-pipeline-status) and is automatically configured when you import a [GitHub project](../../../integration/github.md). ## Configure the integration This integration requires a [GitHub API token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens) with `repo:status` access granted. Complete these steps on GitHub: 1. Go to your **Personal access tokens** page at <https://github.com/settings/tokens>. 1. Select **Generate new token**. 1. Under **Note**, enter a name for the new token. 1. Ensure `repo:status` is selected and select **Generate token**. 1. Copy the generated token to use in GitLab. Complete these steps in GitLab: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Integrations**. 1. Select **GitHub**. 1. Ensure the **Active** checkbox is selected. 1. In **Token**, paste the token you generated on GitHub. 1. In **Repository URL**, enter the path to your project on GitHub, such as `https://github.com/username/repository`. 1. Optional. To disable [static status check names](#static-or-dynamic-status-check-names), clear the **Enable static status check names** checkbox. 1. Optional. Select **Test settings**. 1. Select **Save changes**. After configuring the integration, see [Pipelines for external pull requests](../../../ci/ci_cd_for_external_repos/_index.md#pipelines-for-external-pull-requests) to configure pipelines to run for open pull requests. ### Static or dynamic status check names A status check name can be static or dynamic: - **Static**: The hostname of your GitLab instance is appended to the status check name. - **Dynamic**: The branch name is appended to the status check name. The **Enable static status check names** option enables you to configure required status checks in GitHub, which need a consistent (static) name to work correctly. If you [disable this option](#configure-the-integration), GitLab uses dynamic status check names instead.
https://docs.gitlab.com/user/project/web_ide
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/_index.md
2025-08-13
doc/user/project/web_ide
[ "doc", "user", "project", "web_ide" ]
_index.md
Create
Remote Development
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Web IDE
Use the Web IDE to edit multiple files in the GitLab UI, stage commits, and create merge requests.
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} {{< history >}} - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/188427) in GitLab 18.0. Feature flag `vscode_web_ide` removed. {{< /history >}} The Web IDE is an advanced editor where you can edit multiple files, stage changes, and create commits directly in the GitLab UI. Unlike the [Web Editor](../repository/web_editor.md), the Web IDE provides a full-featured development environment with source control management. Support for [GitLab Flavored Markdown](../../markdown.md) preview in the Web IDE is proposed in [epic 15810](https://gitlab.com/groups/gitlab-org/-/epics/15810). ## Open the Web IDE You can access the Web IDE through several methods. ### With a keyboard shortcut 1. On the left sidebar, select **Search or go to** and find your project. 1. Use the <kbd>.</kbd> keyboard shortcut. ### From a directory 1. On the left sidebar, select **Search or go to** and find your project. 1. Go to your directory. 1. Select **Code > Open in Web IDE**. ### From a file 1. On the left sidebar, select **Search or go to** and find your project. 1. Go to your file. 1. Select **Edit > Open in Web IDE**. ### From a merge request 1. On the left sidebar, select **Search or go to** and find your project. 1. Go to your merge request. 1. In the upper right, select **Code > Open in Web IDE**. The Web IDE opens new and modified files in separate tabs, and displays changes side by side. To reduce load time, only 10 files with the most lines changed open automatically. The Web IDE interface displays a merge request icon ({{< icon name="merge-request" >}}) next to new or modified files in the left sidebar **Explorer** view. To view changes to a file, right-click the file and select **Compare with merge request base**. ## Manage files You can use the Web IDE to open, edit, and upload multiple files. ### Open a file To open a file by name in the Web IDE: 1. Press <kbd>Command</kbd>+<kbd>P</kbd>. 1. In the search box, enter the filename. ### Search open files To search across open files in the Web IDE: 1. Press <kbd>Shift</kbd>+<kbd>Command</kbd>+<kbd>F</kbd>. 1. In the search box, enter your search term. ### Upload a file To upload a file in the Web IDE: 1. On the left side of the Web IDE, select **Explorer** ({{< icon name="documents" >}}), or press <kbd>Shift</kbd>+<kbd>Command</kbd>+<kbd>E</kbd>. 1. Go to the directory where you want to upload the file. To create a new directory: - In the **Explorer** view, in the upper right, select **New Folder** ({{< icon name="folder-new" >}}). 1. Right-click the directory and select **Upload**. 1. Select the file you want to upload. You can upload multiple files at once. The files are uploaded and automatically added to the repository. ### Restore uncommitted changes You do not have to manually save any file you edit in the Web IDE. The Web IDE stages the files you modify, so you can [commit the changes](#commit-changes). Uncommitted changes are saved in your browser's local storage. They persist even if you close the browser tab or refresh the Web IDE. If your uncommitted changes are not available, you can restore the changes from local history. To restore uncommitted changes in the Web IDE: 1. Press <kbd>Shift</kbd>+<kbd>Command</kbd>+<kbd>P</kbd>. 1. In the search box, enter `Local History: Find Entry to Restore`. 1. Select the file that contains the uncommitted changes. ## Use source control You can use source control to view modified files, create and switch branches, commit changes, and create merge requests. ### View modified files To view a list of files you modified in the Web IDE: - On the left side of the Web IDE, select **Source Control** ({{< icon name="branch" >}}), or press <kbd>Control</kbd>+<kbd>Shift</kbd>+<kbd>G</kbd>. Your `CHANGES`, `STAGED CHANGES`, and `MERGE CHANGES` are displayed. For more information, see the [VS Code documentation](https://code.visualstudio.com/docs/sourcecontrol/overview#_commit). ### Switch branches The Web IDE uses the current branch by default. To switch branches in the Web IDE: 1. On the bottom status bar, on the left, select the current branch name. 1. Enter or select an existing branch. ### Create a branch To create a branch from the current branch in the Web IDE: 1. On the bottom status bar, on the left, select the current branch name. 1. From the dropdown list, select **Create new branch**. 1. Enter the new branch name. The Web IDE creates a branch using the checked out branch as base. Alternatively, you can follow these steps to create a branch from a different base: 1. On the left side of the Web IDE, select **Source Control** ({{< icon name="branch" >}}), or press <kbd>Control</kbd>+<kbd>Shift</kbd>+<kbd>G</kbd>. 1. Select the ellipsis menu ({{< icon name="ellipsis_h" >}}) on the top-right side of the Source Control panel. 1. From the dropdown list, select **Branch** -> **Create branch from...**. 1. From the dropdown list, select the branch that you want to use as base. If you do not have write access to the repository, **Create new branch** is not visible. ### Delete a branch 1. On the left side of the Web IDE, select **Source Control** ({{< icon name="branch" >}}), or press <kbd>Control</kbd>+<kbd>Shift</kbd>+<kbd>G</kbd>. 1. Select the ellipsis menu ({{< icon name="ellipsis_h" >}}) on the top-right side of the Source Control panel. 1. From the dropdown list, select **Branch** -> **Delete branch**. 1. From the dropdown list, select the branch that you want to delete. You can't delete protected branches from the Web IDE. ### Commit changes To commit changes in the Web IDE: 1. On the left side of the Web IDE, select **Source Control** ({{< icon name="branch" >}}), or press <kbd>Control</kbd>+<kbd>Shift</kbd>+<kbd>G</kbd>. 1. Enter your commit message. 1. Select one of the following commit options: - **Commit to current branch** - Commits changes to the current branch - **[Create a new branch](#create-a-branch)** - Creates a new branch and commits changes - **[Commit and force push](#commit-and-force-push)** - Force pushes changes to the remote branch - **[Amend commit and force push](#amend-commit-and-force-push)** - Modifies the last commit and force pushes ### Commit and force push To commit and force push your changes: 1. Select the action button menu or select the ellipsis ({{< icon name="ellipsis_h" >}}). 1. Select **Commit and Force push**. {{< alert type="warning" >}} This action overwrites the remote history of the current branch. Use with caution. {{< /alert >}} ### Amend commit and force push To amend the last commit and force push: 1. Select the action button menu or select the ellipsis ({{< icon name="ellipsis_h" >}}). 1. Select **Amend commit and Force push**. This updates the last commit and force pushes it to the remote repository. Use this to fix recent commits without creating new ones. ## Create a merge request To create a [merge request](../merge_requests/_index.md) in the Web IDE: 1. [Commit the changes](#commit-changes). 1. In the notification that appears in the lower right, select **Create MR**. For more information, see [View missed notifications](#view-missed-notifications). ## Customize the Web IDE Customize the Web IDE to match your preferences for keyboard shortcuts, themes, settings, and synchronization. ### Use the Command Palette You can use the Command Palette to access many commands. To open the Command Palette and run a command in the Web IDE: 1. Press <kbd>Shift</kbd>+<kbd>Command</kbd>+<kbd>P</kbd>. 1. Enter or select the command. ### Edit settings You can use the settings editor to view and edit your user and workspace settings. To open the settings editor in the Web IDE: - On the top menu bar, select **File > Preferences > Settings**, or press <kbd>Command</kbd>+<kbd>,</kbd>. In the settings editor, you can search for the settings you want to change. ### Edit keyboard shortcuts You can use the keyboard shortcuts editor to view and change the default keybindings for all available commands. To open the keyboard shortcuts editor in the Web IDE: - On the top menu bar, select **File > Preferences > Keyboard Shortcuts**, or press <kbd>Command</kbd>+<kbd>K</kbd> then <kbd>Command</kbd>+<kbd>S</kbd>. In the keyboard shortcuts editor, you can search for: - The keybindings you want to change - The commands you want to add or remove keybindings for Keybindings are based on your keyboard layout. If you change your keyboard layout, existing keybindings are updated automatically. ### Change the color theme You can choose between different color themes for the Web IDE. The default theme is **GitLab Dark**. To change the color theme in the Web IDE: 1. On the top menu bar, select **File > Preferences > Theme > Color Theme**, or press <kbd>Command</kbd>+<kbd>K</kbd> then <kbd>Command</kbd>+<kbd>T</kbd>. 1. From the dropdown list, preview the themes with the arrow keys. 1. Select a theme. The Web IDE stores your active color theme in your [user settings](#edit-settings). ### Configure sync settings To configure sync settings in the Web IDE: 1. Press <kbd>Shift</kbd>+<kbd>Command</kbd>+<kbd>P</kbd>. 1. In the search box, enter `Settings Sync: Configure`. 1. Select or clear the checkbox for: - **Settings** - **Keyboard shortcuts** - **User snippets** - **User tasks** - **UI state** - **Extensions** - **Profiles** These settings sync automatically across multiple Web IDE instances. You cannot sync user profiles or go back to an earlier version of synced settings. ### View missed notifications When you perform actions in the Web IDE, notifications appear in the lower right. To view any notification you might have missed: 1. On the bottom status bar, on the right, select the bell icon ({{< icon name="notifications" >}}) for a list of notifications. 1. Select the notification you want to view. ## Manage extensions {{< details >}} - Offering: GitLab.com, GitLab Self-Managed {{< /details >}} {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/151352) as a [beta](../../../policy/development_stages_support.md#beta) in GitLab 17.0 [with flags](../../../administration/feature_flags/_index.md) named `web_ide_oauth` and `web_ide_extensions_marketplace`. Disabled by default. - `web_ide_oauth` [enabled on GitLab.com, GitLab Self-Managed, and GitLab Dedicated](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/163181) in GitLab 17.4. - `web_ide_extensions_marketplace` [enabled on GitLab.com](https://gitlab.com/gitlab-org/gitlab/-/issues/459028) in GitLab 17.4. - `web_ide_oauth` [removed](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/167464) in GitLab 17.5. - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/508996) the `vscode_extension_marketplace_settings` [feature flag](../../../administration/feature_flags/_index.md) in GitLab 17.10. Disabled by default. - `web_ide_extensions_marketplace` [enabled on GitLab Self-Managed](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/184662), and `vscode_extension_marketplace_settings` [enabled on GitLab.com and GitLab Self-Managed](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/184662) in GitLab 17.11. - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/192659) in GitLab 18.1. Feature flags `web_ide_extensions_marketplace` and `vscode_extension_marketplace_settings` removed. {{< /history >}} The VS Code Extension Marketplace provides you with access to extensions that enhance the functionality of the Web IDE. By default, the GitLab Web IDE instance is configured to use the [Open VSX Registry](https://open-vsx.org/). {{< alert type="note" >}} To access the VS Code Extension Marketplace, your web browser must have access to the `.cdn.web-ide.gitlab-static.net` assets host. This security requirement ensures that third-party extensions run in isolation, and cannot access your account. {{< /alert >}} Before you can manage and use extensions in the Web IDE: - A GitLab administrator must [enable the extension marketplace](../../../administration/settings/vscode_extension_marketplace.md) in the **Admin** area. - You must [enable the extension marketplace](../../profile/preferences.md#integrate-with-the-extension-marketplace) in your user preferences. - For enterprise users, a person with the Owner role must [enable the extension marketplace](../../enterprise_user/_index.md#enable-the-extension-marketplace-for-the-web-ide-and-workspaces) in group settings. ### Install an extension To install an extension in the Web IDE: 1. On the top menu bar, select **View > Extensions**, or press <kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>X</kbd>. 1. In the search box, enter the extension name. 1. Select the extension you want to install. 1. Select **Install**. ### Uninstall an extension To uninstall an extension in the Web IDE: 1. On the top menu bar, select **View > Extensions**, or press <kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>X</kbd>. 1. From the list of installed extensions, select the extension you want to uninstall. 1. Select **Uninstall**. ### Extension setup Web IDE extensions may require additional configuration to work with your projects. #### Use Vim keybindings Use Vim keybindings to navigate and edit text using keyboard shortcuts from the Vim text editor. With the Extensions Marketplace, you can add Vim keybindings to the Web IDE. To enable Vim keybindings, install the [Vim](https://open-vsx.org/extension/vscodevim/vim) extension. For more information, see [install an extension](#install-an-extension). #### AsciiDoc Support The [AsciiDoc](https://open-vsx.org/extension/asciidoctor/asciidoctor-vscode) extension provides live preview, syntax highlighting, and snippets for AsciiDoc files in the Web IDE. To use AsciiDoc markup preview in the Web IDE, you must install the AsciiDoc extension. For more information, see [install an extension](#install-an-extension). ## Related topics - [GitLab Duo Chat in the Web IDE](../../gitlab_duo_chat/_index.md#use-gitlab-duo-chat-in-the-web-ide) ## Troubleshooting When working with the Web IDE, you might encounter the following issues. ### Character offset when typing When you type in the Web IDE, you might get a four-character offset. As a workaround: 1. On the top menu bar, select **File > Preferences > Settings**, or press <kbd>Command</kbd>+<kbd>,</kbd>. 1. In the upper-right corner, select **Open Settings (JSON)**. 1. In the `settings.json` file, add `"editor.disableMonospaceOptimizations": true` or change the `"editor.fontFamily"` setting. For more information, see [VS Code issue 80170](https://github.com/microsoft/vscode/issues/80170). ### Update the OAuth callback URL {{< details >}} - Offering: GitLab Self-Managed {{< /details >}} Prerequisites: - You must have administrator access to the instance. The Web IDE uses an [instance-wide OAuth application](../../../integration/oauth_provider.md#create-an-instance-wide-application) for authentication. If the OAuth callback URL is misconfigured, you might encounter a `Cannot open Web IDE` error page with the following message: ```plaintext The URL you're using to access the Web IDE and the configured OAuth callback URL do not match. This issue often occurs when you're using a proxy. ``` To resolve this issue, you must update the OAuth callback URL to match the URL used to access the GitLab instance. To update the OAuth callback URL: 1. On the left sidebar, at the bottom, select **Admin**. 1. Select **Applications**. 1. For **GitLab Web IDE**, select **Edit**. 1. Enter the OAuth callback URL. You can enter multiple URLs separated by newlines. ### Access token lifetime cannot be less than 5 minutes {{< details >}} - Offering: GitLab Self-Managed {{< /details >}} You might encounter an error message stating that the access token lifetime cannot be less than 5 minutes. This error occurs when your GitLab instance is configured with an access token expiry time of less than 5 minutes. The Web IDE requires access tokens with a minimum lifetime of 5 minutes to function properly. To resolve this issue, increase the access token lifetime to at least 5 minutes in your instance configuration. For more information about configuring access token expiration, see [access token expiration](../../../integration/oauth_provider.md#access-token-expiration). ### Workhorse dependency {{< details >}} - Offering: GitLab Self-Managed {{< /details >}} On GitLab Self-Managed, Workhorse must be installed and running in front of the GitLab Rails server. If it is not, you might encounter issues when you open the Web IDE or use certain features like Markdown preview. For security, some parts of the Web IDE must run in a separate origin. To support this approach, the Web IDE uses Workhorse to route requests appropriately to and from Web IDE assets. The Web IDE assets are static frontend assets, so it's unnecessary overhead to rely on Rails for this effort. ### CORS issues The Web IDE requires specific Cross-Origin Resource Sharing (CORS) configuration to function properly on GitLab Self-Managed instances. GitLab API endpoints (`/api/*`) must include the following HTTP response headers to support the Web IDE: | Header | Value | Description | |--------|-------|-------------| | `Access-Control-Allow-Origin` | `https://[subdomain].cdn.web-ide.gitlab-static.net` | Allows requests from the Web IDE origin. The `[subdomain]` is a dynamically generated alphanumeric string (max 52 characters). | | `Access-Control-Allow-Headers` | `Authorization` | Permits the Authorization header in cross-origin requests. | | `Access-Control-Allow-Methods` | `GET, POST, PUT, DELETE, OPTIONS` | Specifies allowed HTTP methods (recommended). | | `Access-Control-Allow-Credentials` | `false` | The Web IDE does not need to include credentials controlled by this [header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Access-Control-Allow-Credentials) in HTTP requests. | | `Access-Control-Expose-Headers` | `Link, X-Total, X-Total-Pages, X-Per-Page, X-Page, X-Next-Page, X-Prev-Page, X-Gitlab-Blob-Id, X-Gitlab-Commit-Id, X-Gitlab-Content-Sha256, X-Gitlab-Encoding, X-Gitlab-File-Name, X-Gitlab-File-Path, X-Gitlab-Last-Commit-Id X-Gitlab-Ref, X-Gitlab-Size, X-Request-Id, ETag` | Headers used by GitLab Rest and GraphQL APIs. | | `Vary` | `Origin` | Ensures proper caching behavior for CORS responses. | Since the subdomain portion of the Web IDE origin is dynamically generated, your CORS configuration must: - **Pattern matching**: Accept origins matching the pattern `https://*.cdn.web-ide.gitlab-static.net`. - **Validation**: Ensure the subdomain contains only alphanumeric characters and is ≤52 characters. - **Security**: Never use wildcard (*) for Access-Control-Allow-Origin as this poses security risks. A GitLab instance default CORS configuration satisfies these requirements. You might find issues when the GitLab Self-Managed instance is behind an HTTP reverse proxy server or it uses a custom CORS policy configuration. {{< alert type="note" >}} If these headers are not provided, the Web IDE will still work on GitLab Self-Managed although features such as Extension Marketplace will be disabled for security reasons. The Web IDE uses the `https://*.cdn.web-ide.gitlab-static.net` origin to run third-party extensions in a sandboxed environment. {{< /alert >}} ### Air-gapped or offline environments The Web IDE disables the Extension Marketplace and Web Views in air-gapped or offline environments where a user's web browser can't connect to the `https://*.cdn.web-ide.gitlab-static.net` external assets host. The Web IDE uses the external assets host to run third-party code coming from VSCode Extensions and Web Views in a sandboxed environment to secure user data. The Web IDE engineering team will provide better support for air-gapped environments in the future. You can keep track of the latest developments in this [epic](https://gitlab.com/groups/gitlab-org/-/epics/15146). ### Report a problem To report a problem, [create a new issue](https://gitlab.com/gitlab-org/gitlab-web-ide/-/issues/new) with the following information: - The error message - The full error details - How often the problem occurs - Steps to reproduce the problem If you're on a paid tier, you can also [contact Support](https://about.gitlab.com/support/#contact-support) for help.
--- stage: Create group: Remote Development info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments description: Use the Web IDE to edit multiple files in the GitLab UI, stage commits, and create merge requests. title: Web IDE breadcrumbs: - doc - user - project - web_ide --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} {{< history >}} - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/188427) in GitLab 18.0. Feature flag `vscode_web_ide` removed. {{< /history >}} The Web IDE is an advanced editor where you can edit multiple files, stage changes, and create commits directly in the GitLab UI. Unlike the [Web Editor](../repository/web_editor.md), the Web IDE provides a full-featured development environment with source control management. Support for [GitLab Flavored Markdown](../../markdown.md) preview in the Web IDE is proposed in [epic 15810](https://gitlab.com/groups/gitlab-org/-/epics/15810). ## Open the Web IDE You can access the Web IDE through several methods. ### With a keyboard shortcut 1. On the left sidebar, select **Search or go to** and find your project. 1. Use the <kbd>.</kbd> keyboard shortcut. ### From a directory 1. On the left sidebar, select **Search or go to** and find your project. 1. Go to your directory. 1. Select **Code > Open in Web IDE**. ### From a file 1. On the left sidebar, select **Search or go to** and find your project. 1. Go to your file. 1. Select **Edit > Open in Web IDE**. ### From a merge request 1. On the left sidebar, select **Search or go to** and find your project. 1. Go to your merge request. 1. In the upper right, select **Code > Open in Web IDE**. The Web IDE opens new and modified files in separate tabs, and displays changes side by side. To reduce load time, only 10 files with the most lines changed open automatically. The Web IDE interface displays a merge request icon ({{< icon name="merge-request" >}}) next to new or modified files in the left sidebar **Explorer** view. To view changes to a file, right-click the file and select **Compare with merge request base**. ## Manage files You can use the Web IDE to open, edit, and upload multiple files. ### Open a file To open a file by name in the Web IDE: 1. Press <kbd>Command</kbd>+<kbd>P</kbd>. 1. In the search box, enter the filename. ### Search open files To search across open files in the Web IDE: 1. Press <kbd>Shift</kbd>+<kbd>Command</kbd>+<kbd>F</kbd>. 1. In the search box, enter your search term. ### Upload a file To upload a file in the Web IDE: 1. On the left side of the Web IDE, select **Explorer** ({{< icon name="documents" >}}), or press <kbd>Shift</kbd>+<kbd>Command</kbd>+<kbd>E</kbd>. 1. Go to the directory where you want to upload the file. To create a new directory: - In the **Explorer** view, in the upper right, select **New Folder** ({{< icon name="folder-new" >}}). 1. Right-click the directory and select **Upload**. 1. Select the file you want to upload. You can upload multiple files at once. The files are uploaded and automatically added to the repository. ### Restore uncommitted changes You do not have to manually save any file you edit in the Web IDE. The Web IDE stages the files you modify, so you can [commit the changes](#commit-changes). Uncommitted changes are saved in your browser's local storage. They persist even if you close the browser tab or refresh the Web IDE. If your uncommitted changes are not available, you can restore the changes from local history. To restore uncommitted changes in the Web IDE: 1. Press <kbd>Shift</kbd>+<kbd>Command</kbd>+<kbd>P</kbd>. 1. In the search box, enter `Local History: Find Entry to Restore`. 1. Select the file that contains the uncommitted changes. ## Use source control You can use source control to view modified files, create and switch branches, commit changes, and create merge requests. ### View modified files To view a list of files you modified in the Web IDE: - On the left side of the Web IDE, select **Source Control** ({{< icon name="branch" >}}), or press <kbd>Control</kbd>+<kbd>Shift</kbd>+<kbd>G</kbd>. Your `CHANGES`, `STAGED CHANGES`, and `MERGE CHANGES` are displayed. For more information, see the [VS Code documentation](https://code.visualstudio.com/docs/sourcecontrol/overview#_commit). ### Switch branches The Web IDE uses the current branch by default. To switch branches in the Web IDE: 1. On the bottom status bar, on the left, select the current branch name. 1. Enter or select an existing branch. ### Create a branch To create a branch from the current branch in the Web IDE: 1. On the bottom status bar, on the left, select the current branch name. 1. From the dropdown list, select **Create new branch**. 1. Enter the new branch name. The Web IDE creates a branch using the checked out branch as base. Alternatively, you can follow these steps to create a branch from a different base: 1. On the left side of the Web IDE, select **Source Control** ({{< icon name="branch" >}}), or press <kbd>Control</kbd>+<kbd>Shift</kbd>+<kbd>G</kbd>. 1. Select the ellipsis menu ({{< icon name="ellipsis_h" >}}) on the top-right side of the Source Control panel. 1. From the dropdown list, select **Branch** -> **Create branch from...**. 1. From the dropdown list, select the branch that you want to use as base. If you do not have write access to the repository, **Create new branch** is not visible. ### Delete a branch 1. On the left side of the Web IDE, select **Source Control** ({{< icon name="branch" >}}), or press <kbd>Control</kbd>+<kbd>Shift</kbd>+<kbd>G</kbd>. 1. Select the ellipsis menu ({{< icon name="ellipsis_h" >}}) on the top-right side of the Source Control panel. 1. From the dropdown list, select **Branch** -> **Delete branch**. 1. From the dropdown list, select the branch that you want to delete. You can't delete protected branches from the Web IDE. ### Commit changes To commit changes in the Web IDE: 1. On the left side of the Web IDE, select **Source Control** ({{< icon name="branch" >}}), or press <kbd>Control</kbd>+<kbd>Shift</kbd>+<kbd>G</kbd>. 1. Enter your commit message. 1. Select one of the following commit options: - **Commit to current branch** - Commits changes to the current branch - **[Create a new branch](#create-a-branch)** - Creates a new branch and commits changes - **[Commit and force push](#commit-and-force-push)** - Force pushes changes to the remote branch - **[Amend commit and force push](#amend-commit-and-force-push)** - Modifies the last commit and force pushes ### Commit and force push To commit and force push your changes: 1. Select the action button menu or select the ellipsis ({{< icon name="ellipsis_h" >}}). 1. Select **Commit and Force push**. {{< alert type="warning" >}} This action overwrites the remote history of the current branch. Use with caution. {{< /alert >}} ### Amend commit and force push To amend the last commit and force push: 1. Select the action button menu or select the ellipsis ({{< icon name="ellipsis_h" >}}). 1. Select **Amend commit and Force push**. This updates the last commit and force pushes it to the remote repository. Use this to fix recent commits without creating new ones. ## Create a merge request To create a [merge request](../merge_requests/_index.md) in the Web IDE: 1. [Commit the changes](#commit-changes). 1. In the notification that appears in the lower right, select **Create MR**. For more information, see [View missed notifications](#view-missed-notifications). ## Customize the Web IDE Customize the Web IDE to match your preferences for keyboard shortcuts, themes, settings, and synchronization. ### Use the Command Palette You can use the Command Palette to access many commands. To open the Command Palette and run a command in the Web IDE: 1. Press <kbd>Shift</kbd>+<kbd>Command</kbd>+<kbd>P</kbd>. 1. Enter or select the command. ### Edit settings You can use the settings editor to view and edit your user and workspace settings. To open the settings editor in the Web IDE: - On the top menu bar, select **File > Preferences > Settings**, or press <kbd>Command</kbd>+<kbd>,</kbd>. In the settings editor, you can search for the settings you want to change. ### Edit keyboard shortcuts You can use the keyboard shortcuts editor to view and change the default keybindings for all available commands. To open the keyboard shortcuts editor in the Web IDE: - On the top menu bar, select **File > Preferences > Keyboard Shortcuts**, or press <kbd>Command</kbd>+<kbd>K</kbd> then <kbd>Command</kbd>+<kbd>S</kbd>. In the keyboard shortcuts editor, you can search for: - The keybindings you want to change - The commands you want to add or remove keybindings for Keybindings are based on your keyboard layout. If you change your keyboard layout, existing keybindings are updated automatically. ### Change the color theme You can choose between different color themes for the Web IDE. The default theme is **GitLab Dark**. To change the color theme in the Web IDE: 1. On the top menu bar, select **File > Preferences > Theme > Color Theme**, or press <kbd>Command</kbd>+<kbd>K</kbd> then <kbd>Command</kbd>+<kbd>T</kbd>. 1. From the dropdown list, preview the themes with the arrow keys. 1. Select a theme. The Web IDE stores your active color theme in your [user settings](#edit-settings). ### Configure sync settings To configure sync settings in the Web IDE: 1. Press <kbd>Shift</kbd>+<kbd>Command</kbd>+<kbd>P</kbd>. 1. In the search box, enter `Settings Sync: Configure`. 1. Select or clear the checkbox for: - **Settings** - **Keyboard shortcuts** - **User snippets** - **User tasks** - **UI state** - **Extensions** - **Profiles** These settings sync automatically across multiple Web IDE instances. You cannot sync user profiles or go back to an earlier version of synced settings. ### View missed notifications When you perform actions in the Web IDE, notifications appear in the lower right. To view any notification you might have missed: 1. On the bottom status bar, on the right, select the bell icon ({{< icon name="notifications" >}}) for a list of notifications. 1. Select the notification you want to view. ## Manage extensions {{< details >}} - Offering: GitLab.com, GitLab Self-Managed {{< /details >}} {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/151352) as a [beta](../../../policy/development_stages_support.md#beta) in GitLab 17.0 [with flags](../../../administration/feature_flags/_index.md) named `web_ide_oauth` and `web_ide_extensions_marketplace`. Disabled by default. - `web_ide_oauth` [enabled on GitLab.com, GitLab Self-Managed, and GitLab Dedicated](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/163181) in GitLab 17.4. - `web_ide_extensions_marketplace` [enabled on GitLab.com](https://gitlab.com/gitlab-org/gitlab/-/issues/459028) in GitLab 17.4. - `web_ide_oauth` [removed](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/167464) in GitLab 17.5. - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/508996) the `vscode_extension_marketplace_settings` [feature flag](../../../administration/feature_flags/_index.md) in GitLab 17.10. Disabled by default. - `web_ide_extensions_marketplace` [enabled on GitLab Self-Managed](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/184662), and `vscode_extension_marketplace_settings` [enabled on GitLab.com and GitLab Self-Managed](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/184662) in GitLab 17.11. - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/192659) in GitLab 18.1. Feature flags `web_ide_extensions_marketplace` and `vscode_extension_marketplace_settings` removed. {{< /history >}} The VS Code Extension Marketplace provides you with access to extensions that enhance the functionality of the Web IDE. By default, the GitLab Web IDE instance is configured to use the [Open VSX Registry](https://open-vsx.org/). {{< alert type="note" >}} To access the VS Code Extension Marketplace, your web browser must have access to the `.cdn.web-ide.gitlab-static.net` assets host. This security requirement ensures that third-party extensions run in isolation, and cannot access your account. {{< /alert >}} Before you can manage and use extensions in the Web IDE: - A GitLab administrator must [enable the extension marketplace](../../../administration/settings/vscode_extension_marketplace.md) in the **Admin** area. - You must [enable the extension marketplace](../../profile/preferences.md#integrate-with-the-extension-marketplace) in your user preferences. - For enterprise users, a person with the Owner role must [enable the extension marketplace](../../enterprise_user/_index.md#enable-the-extension-marketplace-for-the-web-ide-and-workspaces) in group settings. ### Install an extension To install an extension in the Web IDE: 1. On the top menu bar, select **View > Extensions**, or press <kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>X</kbd>. 1. In the search box, enter the extension name. 1. Select the extension you want to install. 1. Select **Install**. ### Uninstall an extension To uninstall an extension in the Web IDE: 1. On the top menu bar, select **View > Extensions**, or press <kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>X</kbd>. 1. From the list of installed extensions, select the extension you want to uninstall. 1. Select **Uninstall**. ### Extension setup Web IDE extensions may require additional configuration to work with your projects. #### Use Vim keybindings Use Vim keybindings to navigate and edit text using keyboard shortcuts from the Vim text editor. With the Extensions Marketplace, you can add Vim keybindings to the Web IDE. To enable Vim keybindings, install the [Vim](https://open-vsx.org/extension/vscodevim/vim) extension. For more information, see [install an extension](#install-an-extension). #### AsciiDoc Support The [AsciiDoc](https://open-vsx.org/extension/asciidoctor/asciidoctor-vscode) extension provides live preview, syntax highlighting, and snippets for AsciiDoc files in the Web IDE. To use AsciiDoc markup preview in the Web IDE, you must install the AsciiDoc extension. For more information, see [install an extension](#install-an-extension). ## Related topics - [GitLab Duo Chat in the Web IDE](../../gitlab_duo_chat/_index.md#use-gitlab-duo-chat-in-the-web-ide) ## Troubleshooting When working with the Web IDE, you might encounter the following issues. ### Character offset when typing When you type in the Web IDE, you might get a four-character offset. As a workaround: 1. On the top menu bar, select **File > Preferences > Settings**, or press <kbd>Command</kbd>+<kbd>,</kbd>. 1. In the upper-right corner, select **Open Settings (JSON)**. 1. In the `settings.json` file, add `"editor.disableMonospaceOptimizations": true` or change the `"editor.fontFamily"` setting. For more information, see [VS Code issue 80170](https://github.com/microsoft/vscode/issues/80170). ### Update the OAuth callback URL {{< details >}} - Offering: GitLab Self-Managed {{< /details >}} Prerequisites: - You must have administrator access to the instance. The Web IDE uses an [instance-wide OAuth application](../../../integration/oauth_provider.md#create-an-instance-wide-application) for authentication. If the OAuth callback URL is misconfigured, you might encounter a `Cannot open Web IDE` error page with the following message: ```plaintext The URL you're using to access the Web IDE and the configured OAuth callback URL do not match. This issue often occurs when you're using a proxy. ``` To resolve this issue, you must update the OAuth callback URL to match the URL used to access the GitLab instance. To update the OAuth callback URL: 1. On the left sidebar, at the bottom, select **Admin**. 1. Select **Applications**. 1. For **GitLab Web IDE**, select **Edit**. 1. Enter the OAuth callback URL. You can enter multiple URLs separated by newlines. ### Access token lifetime cannot be less than 5 minutes {{< details >}} - Offering: GitLab Self-Managed {{< /details >}} You might encounter an error message stating that the access token lifetime cannot be less than 5 minutes. This error occurs when your GitLab instance is configured with an access token expiry time of less than 5 minutes. The Web IDE requires access tokens with a minimum lifetime of 5 minutes to function properly. To resolve this issue, increase the access token lifetime to at least 5 minutes in your instance configuration. For more information about configuring access token expiration, see [access token expiration](../../../integration/oauth_provider.md#access-token-expiration). ### Workhorse dependency {{< details >}} - Offering: GitLab Self-Managed {{< /details >}} On GitLab Self-Managed, Workhorse must be installed and running in front of the GitLab Rails server. If it is not, you might encounter issues when you open the Web IDE or use certain features like Markdown preview. For security, some parts of the Web IDE must run in a separate origin. To support this approach, the Web IDE uses Workhorse to route requests appropriately to and from Web IDE assets. The Web IDE assets are static frontend assets, so it's unnecessary overhead to rely on Rails for this effort. ### CORS issues The Web IDE requires specific Cross-Origin Resource Sharing (CORS) configuration to function properly on GitLab Self-Managed instances. GitLab API endpoints (`/api/*`) must include the following HTTP response headers to support the Web IDE: | Header | Value | Description | |--------|-------|-------------| | `Access-Control-Allow-Origin` | `https://[subdomain].cdn.web-ide.gitlab-static.net` | Allows requests from the Web IDE origin. The `[subdomain]` is a dynamically generated alphanumeric string (max 52 characters). | | `Access-Control-Allow-Headers` | `Authorization` | Permits the Authorization header in cross-origin requests. | | `Access-Control-Allow-Methods` | `GET, POST, PUT, DELETE, OPTIONS` | Specifies allowed HTTP methods (recommended). | | `Access-Control-Allow-Credentials` | `false` | The Web IDE does not need to include credentials controlled by this [header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Access-Control-Allow-Credentials) in HTTP requests. | | `Access-Control-Expose-Headers` | `Link, X-Total, X-Total-Pages, X-Per-Page, X-Page, X-Next-Page, X-Prev-Page, X-Gitlab-Blob-Id, X-Gitlab-Commit-Id, X-Gitlab-Content-Sha256, X-Gitlab-Encoding, X-Gitlab-File-Name, X-Gitlab-File-Path, X-Gitlab-Last-Commit-Id X-Gitlab-Ref, X-Gitlab-Size, X-Request-Id, ETag` | Headers used by GitLab Rest and GraphQL APIs. | | `Vary` | `Origin` | Ensures proper caching behavior for CORS responses. | Since the subdomain portion of the Web IDE origin is dynamically generated, your CORS configuration must: - **Pattern matching**: Accept origins matching the pattern `https://*.cdn.web-ide.gitlab-static.net`. - **Validation**: Ensure the subdomain contains only alphanumeric characters and is ≤52 characters. - **Security**: Never use wildcard (*) for Access-Control-Allow-Origin as this poses security risks. A GitLab instance default CORS configuration satisfies these requirements. You might find issues when the GitLab Self-Managed instance is behind an HTTP reverse proxy server or it uses a custom CORS policy configuration. {{< alert type="note" >}} If these headers are not provided, the Web IDE will still work on GitLab Self-Managed although features such as Extension Marketplace will be disabled for security reasons. The Web IDE uses the `https://*.cdn.web-ide.gitlab-static.net` origin to run third-party extensions in a sandboxed environment. {{< /alert >}} ### Air-gapped or offline environments The Web IDE disables the Extension Marketplace and Web Views in air-gapped or offline environments where a user's web browser can't connect to the `https://*.cdn.web-ide.gitlab-static.net` external assets host. The Web IDE uses the external assets host to run third-party code coming from VSCode Extensions and Web Views in a sandboxed environment to secure user data. The Web IDE engineering team will provide better support for air-gapped environments in the future. You can keep track of the latest developments in this [epic](https://gitlab.com/groups/gitlab-org/-/epics/15146). ### Report a problem To report a problem, [create a new issue](https://gitlab.com/gitlab-org/gitlab-web-ide/-/issues/new) with the following information: - The error message - The full error details - How often the problem occurs - Steps to reproduce the problem If you're on a paid tier, you can also [contact Support](https://about.gitlab.com/support/#contact-support) for help.
https://docs.gitlab.com/user/project/members
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/_index.md
2025-08-13
doc/user/project/members
[ "doc", "user", "project", "members" ]
_index.md
Tenant Scale
Organizations
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Members of a project
User management, roles, permissions, and access levels.
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} Members are the users and groups who have access to your project. Members can be added directly to your project or inherit access through groups. Each member has a role that determines what they can do in the project. Project members with the appropriate role can add users to projects, remove users from projects, and manage access requests to control access to project resources. ## Membership types {{< history >}} - [Changed](https://gitlab.com/gitlab-org/gitlab/-/issues/219230) to display invited group members on the Members tab of the Members page in GitLab 16.10 [with a flag](../../../administration/feature_flags/_index.md) named `webui_members_inherited_users`. Disabled by default. - Feature flag `webui_members_inherited_users` was [enabled on GitLab.com and GitLab Self-Managed](https://gitlab.com/gitlab-org/gitlab/-/issues/219230) in GitLab 17.0. - Feature flag `webui_members_inherited_users` [removed](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/163627) in GitLab 17.4. Members of invited groups displayed by default. {{< /history >}} Users can become members of a group or project directly or indirectly. Indirect membership can be inherited, shared, or inherited shared. | Membership type | Membership process | | --------------------------------------------- | ------------------ | | Direct | The user is added directly to the current group or project. | | Inherited | The user is a member of a parent group that contains the current group or project. | | [Shared](sharing_projects_groups.md) | The user is a member of a group invited to the current group or project. | | [Inherited shared](sharing_projects_groups.md#invite-a-group-to-a-group) | The user is a member of a group invited to an ancestor of the current group or project. | | Indirect | An umbrella term for inherited, shared, or inherited shared members. | ```mermaid %%{init: { "fontFamily": "GitLab Sans" }}%% flowchart RL accTitle: Membership types accDescr: Describes membership types and their inheritance subgraph Group A A(Direct member) B{{Shared member}} subgraph Project X H(Direct member) C{{Inherited member}} D{{Inherited shared member}} E{{Shared member}} end A-->|Inherited membership in Project X Direct membership in Group A|C end subgraph Group C G(Direct member) end subgraph Group B F(Direct member) end F-->|Group B invited to Group A|B B-->|Inherited membership in Project X Indirect membership in Group A|D G-->|Group C invited to Project X|E ``` ![Project members page](img/project_members_v17_4.png) In the previous example: - **Administrator** is an inherited member from the **demo** group. - **User 0** is an inherited member from the **demo** group. - **User 1** is a shared member from the **Acme** group that is invited to this project. - **User 2** is an inherited shared member from the **Toolbox** group that is invited to the **demo** group. - **User 3** is a direct member added to this project. ## Security considerations Git is a distributed version control system (DVCS). Everyone who works with the source code has a local copy of the complete repository. In GitLab, every project member with the Reporter role or higher can clone the repository to create a local copy. Users can upload the full repository anywhere after they obtain a local copy, including: - Another project under their control. - A different server. - External hosting services. Access controls cannot prevent the intentional sharing of source code by users who already have access to the repository. All Git management platforms have this inherent characteristic of distributed version control systems. While you cannot prevent intentional sharing by authorized users, you can take the following steps to prevent unintentional sharing and information destruction: - Control who can [add users to a project](#add-users-to-a-project). - Use [protected branches](../repository/branches/protected.md) to prevent unauthorized force pushes. - Regularly review project membership and remove users who no longer require access. ## Add users to a project {{< history >}} - Expiring access email notification [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/12704) in GitLab 16.2. - Access expiration date for direct members of subgroups and projects [removed](https://gitlab.com/gitlab-org/gitlab/-/issues/471051) in GitLab 17.4. {{< /history >}} Add users to a project so they become direct members and have permission to perform actions. Prerequisites: - You must have the Owner or Maintainer role. - [Group membership lock](../../group/access_and_permissions.md#prevent-members-from-being-added-to-projects-in-a-group) must be disabled. - For GitLab Self-Managed instances: - If [new sign-ups are disabled](../../../administration/settings/sign_up_restrictions.md#disable-new-sign-ups), an administrator must add the user. - If [user invitations are not allowed](../../../administration/settings/visibility_and_access_controls.md#prevent-invitations-to-groups-and-projects), an administrator must add the user. - If [administrator approval is enabled](../../../administration/settings/sign_up_restrictions.md#turn-on-administrator-approval-for-role-promotions), an administrator must approve the invitation. To add a user to a project: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Manage > Members**. 1. Select **Invite members**. 1. If the user: - Has a GitLab account, enter their username. - Doesn't have a GitLab account, enter their email address. 1. Select a [default role](../../permissions.md) or [custom role](../../custom_roles/_index.md). 1. Optional. Select an **Access expiration date**. From that date onward, the user can no longer access the project. If you selected an access expiration date, the project member gets an email notification seven days before their access expires. {{< alert type="warning" >}} Maintainers have full permissions until their role expires, including the ability to extend their own access expiration date. {{< /alert >}} 1. Select **Invite**. If you invited the user using their: - GitLab username, they are added to the members list. - Email address, an invitation is sent to their email address, and they are prompted to create an account. If the invitation is not accepted, GitLab sends reminder emails two, five, and ten days later. Unaccepted invites are automatically deleted after 90 days. ### Which roles you can assign The maximum role you can assign depends on whether you have the Owner or Maintainer role for the group. For example, the maximum role you can set is: - Owner (`50`), if you have the Owner role for the project. - Maintainer (`40`), if you have the Maintainer role on the project. The Owner [role](../../permissions.md#project-members-permissions) can be added for the group only. ### View users pending promotion If [administrator approval for role promotions](../../../administration/settings/sign_up_restrictions.md#turn-on-administrator-approval-for-role-promotions) is turned on, membership requests that promote existing users into a billable role require administrator approval. To view users pending promotion: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Manage > Members**. 1. Select **Role promotions** tab. If the **Role promotions** tab is not displayed, the project has no pending promotions. ## Updating expiration and role If a user is: - A direct member of a project, the **Expiration** and **Role** fields can be updated directly on the project. - An inherited, shared, or inherited shared member, the **Expiration** and **Role** fields must be updated on the group that the member originates from. ## Share a project with a group Instead of adding users one by one, you can [share a project with an entire group](sharing_projects_groups.md). ## Import members from another project You can import another project's direct members to your own project. Imported project members retain the same permissions as the project you import them from. {{< alert type="note" >}} Only direct members of a project are imported. Inherited or shared members of a project are not imported. {{< /alert >}} Prerequisites: - You must have at least the Maintainer role. If the importing member's role for the target project is: - Maintainer, then members with the Owner role for the source project are imported with the Maintainer role. - Owner, then members with the Owner role for the source project are imported with the Owner role. To import a project's members: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Manage > Members**. 1. Select **Import from a project**. 1. Select the project. You can view only the projects for which you're a maintainer. 1. Select **Import project members**. If the import is successful, a success message is displayed. To view the imported members on the **Members** tab, refresh the page. ## Remove a member from a project If a user is: - A direct member of a project, you can remove them directly from the project. - An inherited member from a parent group, you can only remove them from the parent group itself. Prerequisites: - To remove direct members that have the: - Maintainer, Developer, Reporter, Planner, or Guest role, you must have the Maintainer role. - Owner role, you must have the Owner role. - Optional. Unassign the member from all issues and merge requests that are assigned to them. To remove a member from a project: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Manage > Members**. 1. Next to the project member you want to remove, select **Remove member**. 1. Optional. On the confirmation dialog, select the **Also unassign this user from related issues and merge requests** checkbox. 1. To prevent leaks of sensitive information from private projects, verify the member has not forked the private repository or created webhooks. Existing forks continue to receive changes from the upstream project, and webhooks continue to receive updates. You may also want to configure your project to prevent projects in a group [from being forked outside their group](../../group/access_and_permissions.md#prevent-project-forking-outside-group). 1. Select **Remove member**. ## Ensure removed users cannot invite themselves back Users with the Maintainer or Owner role could exploit a race condition that allows them to rejoin groups or projects after an administrator removes them. To avoid this problem, GitLab administrators can: - Remove the malicious user session from the [GitLab Rails console](../../../administration/operations/rails_console.md). - Impersonate the malicious user to: - Remove the user from the project. - Log the user out of GitLab. - Block the malicious user account. - Remove the malicious user account. - Change the password for the malicious user account. ## Filter and sort project members You can filter and sort members in a project. ### Display direct members 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Manage > Members**. 1. In the **Filter members** box, select `Membership` `=` `Direct`. 1. Press <kbd>Enter</kbd>. ### Display indirect members 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Manage > Members**. 1. In the **Filter members** box, select `Membership` `=` `Indirect`. 1. Press <kbd>Enter</kbd>. ### Search for members in a project To search for a project member: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Manage > Members**. 1. In the search box, enter the member's name, username, or email. 1. Press <kbd>Enter</kbd>. ### Sort members in a project You can sort members in ascending or descending order by: - **Account** name - **Access granted** date - **Role** the members have in the project - **User created** date - **Last activity** date - **Last sign-in** date To sort members: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Manage > Members**. 1. At the top of the member list, from the dropdown list, select the item you want to sort by. ## Request access to a project GitLab users can request to become a member of a project. 1. On the left sidebar, select **Search or go to** and find the project you want to be a member of. 1. In the top right, select the vertical ellipsis ({{< icon name="ellipsis_v" >}}) and select **Request Access**. An email is sent to the most recently active project Maintainers or Owners. Up to ten project Maintainers or Owners are notified. Any project Owner or Maintainer can approve or decline the request. Project Maintainers cannot approve Owner role access requests. If a project does not have any direct Owners or Maintainers, the most recently active Owners of the project's parent group receive the notification. ### Withdraw an access request to a project You can withdraw an access request to a project before the request is approved. To withdraw the access request: 1. On the left sidebar, select **Search or go to** and find the project you requested access to. 1. Next to the project name, select **Withdraw Access Request**. ## Prevent users from requesting access to a project You can prevent users from requesting access to a project. Prerequisites: - You must have the Owner role for the project. - The project must be public. 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > General**. 1. Expand **Visibility, project features, permissions**. 1. Under **Project visibility**, ensure the **Users can request access** checkbox is not selected. 1. Select **Save changes**. ## Membership and visibility rights Depending on their membership type, members of groups or projects are granted different [visibility levels](../../public_access.md) and rights into the group or project. The following table lists the membership and visibility rights of project members. | Action | Direct project member | Inherited project member | Direct shared project member | Inherited shared project member | | --- | ------------------- | ---------------------- | -------------------------- | ----------------------------- | | Generate boards | {{< icon name="check-circle" >}} Yes | {{< icon name="check-circle" >}} Yes | {{< icon name="check-circle" >}} Yes | {{< icon name="check-circle" >}} Yes | | View issues of parent groups <sup>1</sup> | {{< icon name="check-circle" >}} Yes | {{< icon name="check-circle" >}} Yes | {{< icon name="check-circle" >}} Yes | {{< icon name="check-circle" >}} Yes | | View labels of parent groups | {{< icon name="check-circle" >}} Yes | {{< icon name="check-circle" >}} Yes | {{< icon name="check-circle" >}} Yes | {{< icon name="check-circle" >}} Yes | | View milestones of parent groups | {{< icon name="check-circle" >}} Yes | {{< icon name="check-circle" >}} Yes | {{< icon name="check-circle" >}} Yes | {{< icon name="check-circle" >}} Yes | | Be shared into other groups | {{< icon name="check-circle" >}} Yes | {{< icon name="dotted-circle" >}} No | {{< icon name="dotted-circle" >}} No | {{< icon name="dotted-circle" >}} No | | Be imported into other projects | {{< icon name="check-circle" >}} Yes | {{< icon name="dotted-circle" >}} No | {{< icon name="dotted-circle" >}} No | {{< icon name="dotted-circle" >}} No | | Share the project with other members | {{< icon name="check-circle" >}} Yes | {{< icon name="check-circle" >}} Yes | {{< icon name="check-circle" >}} Yes | {{< icon name="check-circle" >}} Yes | **Footnotes**: 1. Users can view only issues of projects they have access to. The following table lists the membership and visibility rights of group members. | Action | Direct group member | Inherited group member | Direct shared group member | Inherited shared group member | | --- | ------------------- | ---------------------- | -------------------------- | ----------------------------- | | Generate boards | {{< icon name="check-circle" >}} Yes | {{< icon name="check-circle" >}} Yes | {{< icon name="check-circle" >}} Yes | {{< icon name="check-circle" >}} Yes | | View issues of parent groups | {{< icon name="check-circle" >}} Yes | {{< icon name="check-circle" >}} Yes | {{< icon name="check-circle" >}} Yes | {{< icon name="check-circle" >}} Yes | | View labels of parent groups | {{< icon name="check-circle" >}} Yes | {{< icon name="check-circle" >}} Yes | {{< icon name="check-circle" >}} Yes | {{< icon name="check-circle" >}} Yes | | View milestones of parent groups | {{< icon name="check-circle" >}} Yes | {{< icon name="check-circle" >}} Yes | {{< icon name="check-circle" >}} Yes | {{< icon name="check-circle" >}} Yes | In the following example, `User` is a: - Direct member of `subgroup`. - Inherited member of `subsubgroup`. - Indirect member of `subgroup-2` and `subgroup-3`. - Indirect inherited member of `subsubgroup-2` and `subsubgroup-3`. ```mermaid %%{init: { "fontFamily": "GitLab Sans" }}%% graph TD accTitle: Diagram of group inheritance accDescr: User inheritance, both direct and indirect through subgroups classDef user stroke:green,color:green; root --> subgroup --> subsubgroup root-2 --> subgroup-2 --> subsubgroup-2 root-3 --> subgroup-3 --> subsubgroup-3 subgroup -. shared .-> subgroup-2 -. shared .-> subgroup-3 User-. member .- subgroup class User user ```
--- stage: Tenant Scale group: Organizations info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments title: Members of a project description: User management, roles, permissions, and access levels. breadcrumbs: - doc - user - project - members --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} Members are the users and groups who have access to your project. Members can be added directly to your project or inherit access through groups. Each member has a role that determines what they can do in the project. Project members with the appropriate role can add users to projects, remove users from projects, and manage access requests to control access to project resources. ## Membership types {{< history >}} - [Changed](https://gitlab.com/gitlab-org/gitlab/-/issues/219230) to display invited group members on the Members tab of the Members page in GitLab 16.10 [with a flag](../../../administration/feature_flags/_index.md) named `webui_members_inherited_users`. Disabled by default. - Feature flag `webui_members_inherited_users` was [enabled on GitLab.com and GitLab Self-Managed](https://gitlab.com/gitlab-org/gitlab/-/issues/219230) in GitLab 17.0. - Feature flag `webui_members_inherited_users` [removed](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/163627) in GitLab 17.4. Members of invited groups displayed by default. {{< /history >}} Users can become members of a group or project directly or indirectly. Indirect membership can be inherited, shared, or inherited shared. | Membership type | Membership process | | --------------------------------------------- | ------------------ | | Direct | The user is added directly to the current group or project. | | Inherited | The user is a member of a parent group that contains the current group or project. | | [Shared](sharing_projects_groups.md) | The user is a member of a group invited to the current group or project. | | [Inherited shared](sharing_projects_groups.md#invite-a-group-to-a-group) | The user is a member of a group invited to an ancestor of the current group or project. | | Indirect | An umbrella term for inherited, shared, or inherited shared members. | ```mermaid %%{init: { "fontFamily": "GitLab Sans" }}%% flowchart RL accTitle: Membership types accDescr: Describes membership types and their inheritance subgraph Group A A(Direct member) B{{Shared member}} subgraph Project X H(Direct member) C{{Inherited member}} D{{Inherited shared member}} E{{Shared member}} end A-->|Inherited membership in Project X Direct membership in Group A|C end subgraph Group C G(Direct member) end subgraph Group B F(Direct member) end F-->|Group B invited to Group A|B B-->|Inherited membership in Project X Indirect membership in Group A|D G-->|Group C invited to Project X|E ``` ![Project members page](img/project_members_v17_4.png) In the previous example: - **Administrator** is an inherited member from the **demo** group. - **User 0** is an inherited member from the **demo** group. - **User 1** is a shared member from the **Acme** group that is invited to this project. - **User 2** is an inherited shared member from the **Toolbox** group that is invited to the **demo** group. - **User 3** is a direct member added to this project. ## Security considerations Git is a distributed version control system (DVCS). Everyone who works with the source code has a local copy of the complete repository. In GitLab, every project member with the Reporter role or higher can clone the repository to create a local copy. Users can upload the full repository anywhere after they obtain a local copy, including: - Another project under their control. - A different server. - External hosting services. Access controls cannot prevent the intentional sharing of source code by users who already have access to the repository. All Git management platforms have this inherent characteristic of distributed version control systems. While you cannot prevent intentional sharing by authorized users, you can take the following steps to prevent unintentional sharing and information destruction: - Control who can [add users to a project](#add-users-to-a-project). - Use [protected branches](../repository/branches/protected.md) to prevent unauthorized force pushes. - Regularly review project membership and remove users who no longer require access. ## Add users to a project {{< history >}} - Expiring access email notification [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/12704) in GitLab 16.2. - Access expiration date for direct members of subgroups and projects [removed](https://gitlab.com/gitlab-org/gitlab/-/issues/471051) in GitLab 17.4. {{< /history >}} Add users to a project so they become direct members and have permission to perform actions. Prerequisites: - You must have the Owner or Maintainer role. - [Group membership lock](../../group/access_and_permissions.md#prevent-members-from-being-added-to-projects-in-a-group) must be disabled. - For GitLab Self-Managed instances: - If [new sign-ups are disabled](../../../administration/settings/sign_up_restrictions.md#disable-new-sign-ups), an administrator must add the user. - If [user invitations are not allowed](../../../administration/settings/visibility_and_access_controls.md#prevent-invitations-to-groups-and-projects), an administrator must add the user. - If [administrator approval is enabled](../../../administration/settings/sign_up_restrictions.md#turn-on-administrator-approval-for-role-promotions), an administrator must approve the invitation. To add a user to a project: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Manage > Members**. 1. Select **Invite members**. 1. If the user: - Has a GitLab account, enter their username. - Doesn't have a GitLab account, enter their email address. 1. Select a [default role](../../permissions.md) or [custom role](../../custom_roles/_index.md). 1. Optional. Select an **Access expiration date**. From that date onward, the user can no longer access the project. If you selected an access expiration date, the project member gets an email notification seven days before their access expires. {{< alert type="warning" >}} Maintainers have full permissions until their role expires, including the ability to extend their own access expiration date. {{< /alert >}} 1. Select **Invite**. If you invited the user using their: - GitLab username, they are added to the members list. - Email address, an invitation is sent to their email address, and they are prompted to create an account. If the invitation is not accepted, GitLab sends reminder emails two, five, and ten days later. Unaccepted invites are automatically deleted after 90 days. ### Which roles you can assign The maximum role you can assign depends on whether you have the Owner or Maintainer role for the group. For example, the maximum role you can set is: - Owner (`50`), if you have the Owner role for the project. - Maintainer (`40`), if you have the Maintainer role on the project. The Owner [role](../../permissions.md#project-members-permissions) can be added for the group only. ### View users pending promotion If [administrator approval for role promotions](../../../administration/settings/sign_up_restrictions.md#turn-on-administrator-approval-for-role-promotions) is turned on, membership requests that promote existing users into a billable role require administrator approval. To view users pending promotion: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Manage > Members**. 1. Select **Role promotions** tab. If the **Role promotions** tab is not displayed, the project has no pending promotions. ## Updating expiration and role If a user is: - A direct member of a project, the **Expiration** and **Role** fields can be updated directly on the project. - An inherited, shared, or inherited shared member, the **Expiration** and **Role** fields must be updated on the group that the member originates from. ## Share a project with a group Instead of adding users one by one, you can [share a project with an entire group](sharing_projects_groups.md). ## Import members from another project You can import another project's direct members to your own project. Imported project members retain the same permissions as the project you import them from. {{< alert type="note" >}} Only direct members of a project are imported. Inherited or shared members of a project are not imported. {{< /alert >}} Prerequisites: - You must have at least the Maintainer role. If the importing member's role for the target project is: - Maintainer, then members with the Owner role for the source project are imported with the Maintainer role. - Owner, then members with the Owner role for the source project are imported with the Owner role. To import a project's members: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Manage > Members**. 1. Select **Import from a project**. 1. Select the project. You can view only the projects for which you're a maintainer. 1. Select **Import project members**. If the import is successful, a success message is displayed. To view the imported members on the **Members** tab, refresh the page. ## Remove a member from a project If a user is: - A direct member of a project, you can remove them directly from the project. - An inherited member from a parent group, you can only remove them from the parent group itself. Prerequisites: - To remove direct members that have the: - Maintainer, Developer, Reporter, Planner, or Guest role, you must have the Maintainer role. - Owner role, you must have the Owner role. - Optional. Unassign the member from all issues and merge requests that are assigned to them. To remove a member from a project: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Manage > Members**. 1. Next to the project member you want to remove, select **Remove member**. 1. Optional. On the confirmation dialog, select the **Also unassign this user from related issues and merge requests** checkbox. 1. To prevent leaks of sensitive information from private projects, verify the member has not forked the private repository or created webhooks. Existing forks continue to receive changes from the upstream project, and webhooks continue to receive updates. You may also want to configure your project to prevent projects in a group [from being forked outside their group](../../group/access_and_permissions.md#prevent-project-forking-outside-group). 1. Select **Remove member**. ## Ensure removed users cannot invite themselves back Users with the Maintainer or Owner role could exploit a race condition that allows them to rejoin groups or projects after an administrator removes them. To avoid this problem, GitLab administrators can: - Remove the malicious user session from the [GitLab Rails console](../../../administration/operations/rails_console.md). - Impersonate the malicious user to: - Remove the user from the project. - Log the user out of GitLab. - Block the malicious user account. - Remove the malicious user account. - Change the password for the malicious user account. ## Filter and sort project members You can filter and sort members in a project. ### Display direct members 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Manage > Members**. 1. In the **Filter members** box, select `Membership` `=` `Direct`. 1. Press <kbd>Enter</kbd>. ### Display indirect members 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Manage > Members**. 1. In the **Filter members** box, select `Membership` `=` `Indirect`. 1. Press <kbd>Enter</kbd>. ### Search for members in a project To search for a project member: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Manage > Members**. 1. In the search box, enter the member's name, username, or email. 1. Press <kbd>Enter</kbd>. ### Sort members in a project You can sort members in ascending or descending order by: - **Account** name - **Access granted** date - **Role** the members have in the project - **User created** date - **Last activity** date - **Last sign-in** date To sort members: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Manage > Members**. 1. At the top of the member list, from the dropdown list, select the item you want to sort by. ## Request access to a project GitLab users can request to become a member of a project. 1. On the left sidebar, select **Search or go to** and find the project you want to be a member of. 1. In the top right, select the vertical ellipsis ({{< icon name="ellipsis_v" >}}) and select **Request Access**. An email is sent to the most recently active project Maintainers or Owners. Up to ten project Maintainers or Owners are notified. Any project Owner or Maintainer can approve or decline the request. Project Maintainers cannot approve Owner role access requests. If a project does not have any direct Owners or Maintainers, the most recently active Owners of the project's parent group receive the notification. ### Withdraw an access request to a project You can withdraw an access request to a project before the request is approved. To withdraw the access request: 1. On the left sidebar, select **Search or go to** and find the project you requested access to. 1. Next to the project name, select **Withdraw Access Request**. ## Prevent users from requesting access to a project You can prevent users from requesting access to a project. Prerequisites: - You must have the Owner role for the project. - The project must be public. 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > General**. 1. Expand **Visibility, project features, permissions**. 1. Under **Project visibility**, ensure the **Users can request access** checkbox is not selected. 1. Select **Save changes**. ## Membership and visibility rights Depending on their membership type, members of groups or projects are granted different [visibility levels](../../public_access.md) and rights into the group or project. The following table lists the membership and visibility rights of project members. | Action | Direct project member | Inherited project member | Direct shared project member | Inherited shared project member | | --- | ------------------- | ---------------------- | -------------------------- | ----------------------------- | | Generate boards | {{< icon name="check-circle" >}} Yes | {{< icon name="check-circle" >}} Yes | {{< icon name="check-circle" >}} Yes | {{< icon name="check-circle" >}} Yes | | View issues of parent groups <sup>1</sup> | {{< icon name="check-circle" >}} Yes | {{< icon name="check-circle" >}} Yes | {{< icon name="check-circle" >}} Yes | {{< icon name="check-circle" >}} Yes | | View labels of parent groups | {{< icon name="check-circle" >}} Yes | {{< icon name="check-circle" >}} Yes | {{< icon name="check-circle" >}} Yes | {{< icon name="check-circle" >}} Yes | | View milestones of parent groups | {{< icon name="check-circle" >}} Yes | {{< icon name="check-circle" >}} Yes | {{< icon name="check-circle" >}} Yes | {{< icon name="check-circle" >}} Yes | | Be shared into other groups | {{< icon name="check-circle" >}} Yes | {{< icon name="dotted-circle" >}} No | {{< icon name="dotted-circle" >}} No | {{< icon name="dotted-circle" >}} No | | Be imported into other projects | {{< icon name="check-circle" >}} Yes | {{< icon name="dotted-circle" >}} No | {{< icon name="dotted-circle" >}} No | {{< icon name="dotted-circle" >}} No | | Share the project with other members | {{< icon name="check-circle" >}} Yes | {{< icon name="check-circle" >}} Yes | {{< icon name="check-circle" >}} Yes | {{< icon name="check-circle" >}} Yes | **Footnotes**: 1. Users can view only issues of projects they have access to. The following table lists the membership and visibility rights of group members. | Action | Direct group member | Inherited group member | Direct shared group member | Inherited shared group member | | --- | ------------------- | ---------------------- | -------------------------- | ----------------------------- | | Generate boards | {{< icon name="check-circle" >}} Yes | {{< icon name="check-circle" >}} Yes | {{< icon name="check-circle" >}} Yes | {{< icon name="check-circle" >}} Yes | | View issues of parent groups | {{< icon name="check-circle" >}} Yes | {{< icon name="check-circle" >}} Yes | {{< icon name="check-circle" >}} Yes | {{< icon name="check-circle" >}} Yes | | View labels of parent groups | {{< icon name="check-circle" >}} Yes | {{< icon name="check-circle" >}} Yes | {{< icon name="check-circle" >}} Yes | {{< icon name="check-circle" >}} Yes | | View milestones of parent groups | {{< icon name="check-circle" >}} Yes | {{< icon name="check-circle" >}} Yes | {{< icon name="check-circle" >}} Yes | {{< icon name="check-circle" >}} Yes | In the following example, `User` is a: - Direct member of `subgroup`. - Inherited member of `subsubgroup`. - Indirect member of `subgroup-2` and `subgroup-3`. - Indirect inherited member of `subsubgroup-2` and `subsubgroup-3`. ```mermaid %%{init: { "fontFamily": "GitLab Sans" }}%% graph TD accTitle: Diagram of group inheritance accDescr: User inheritance, both direct and indirect through subgroups classDef user stroke:green,color:green; root --> subgroup --> subsubgroup root-2 --> subgroup-2 --> subsubgroup-2 root-3 --> subgroup-3 --> subsubgroup-3 subgroup -. shared .-> subgroup-2 -. shared .-> subgroup-3 User-. member .- subgroup class User user ```
https://docs.gitlab.com/user/project/sharing_projects_groups
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/sharing_projects_groups.md
2025-08-13
doc/user/project/members
[ "doc", "user", "project", "members" ]
sharing_projects_groups.md
Tenant Scale
Organizations
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Sharing projects and groups
Invitations, group inheritance, and project visibility.
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} {{< history >}} - [Changed](https://gitlab.com/gitlab-org/gitlab/-/issues/219230) to display invited group members on the Members tab of the Members page in GitLab 16.10 [with a flag](../../../administration/feature_flags/_index.md) named `webui_members_inherited_users`. Disabled by default. - Feature flag `webui_members_inherited_users` was [enabled on GitLab.com and GitLab Self-Managed](https://gitlab.com/gitlab-org/gitlab/-/issues/219230) in GitLab 17.0. - Feature flag `webui_members_inherited_users` [removed](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/163627) in GitLab 17.4. Members of invited groups displayed by default. {{< /history >}} You can share by invitation: - A project with a group. - A group with another group. ## Sharing projects When you want a group to have access to your project, you can invite the [group](../../group/_index.md) to the project. The group's direct and inherited members get access to the project, which becomes a **shared project**. In this case, inherited members are members that are inherited from parent groups into the groups that are invited. Only members of the group that is invited get access to the shared project. If you want to give members of a subgroup of the group you are inviting access to the project, you have to invite the subgroup. The following table provides an overview of the group members that get access to a shared project. | Group member source | Access to shared project | |---------------------------------------------------------------------|--------------------------| | Direct member of the group that is invited | {{< icon name="check-circle" >}} Yes | | Inherited member of the group that is invited | {{< icon name="check-circle" >}} Yes | | Shared member of the group that is invited <sup>1</sup> | {{< icon name="dotted-circle" >}} Yes | | Direct member of a subgroup, but not of the group that is invited | {{< icon name="dotted-circle" >}} No | | Inherited member of a subgroup, but not of the group that is invited | {{< icon name="dotted-circle" >}} No | **Footnotes**: 1. GitLab supports extending project access to shared group members, but this approach is not recommended. [Epic 122](https://gitlab.com/groups/gitlab-org/-/epics/122) proposes changing this behavior and transitioning to a teams model for sharing groups. The [visibility level](../../public_access.md) of the group you're inviting must be at least as restrictive as that of the project. For example, you can invite: - A **private** group to a **private** project. - A **private** group to an **internal** project. - A **private** group to a **public** project. - An **internal** group to an **internal** project. - An **internal** group to a **public** project. - A **public** group to a **public** project. If the project's top-level group does not allow the project to be shared outside the hierarchy, the invited group or subgroup must be in the project's [namespace](../../namespace/_index.md). ### Member access and roles When you invite a group to a project, the following members get access to the project: - Direct group members. - Inherited group members. - Members of other [groups that are shared](sharing_projects_groups.md#invite-a-group-to-a-group) with the invited group. Each member's access depends on: - Their role in the group. - The maximum role you choose when you invite the group. Invited members keep the lower of these two roles. For example, if a member has the Guest role in their group, and you add their group to a project with a maximum role of Maintainer, they keep the Guest role in the project. In addition: - On the group's page, the project is listed on the **Shared projects** tab. - On the project's **Members** page, the group is listed on the **Groups** tab. This list includes both public and private groups. - On the project's **Members** page, the members of the invited group are listed on the **Members** tab. - On the usage quota page, members who have the **Project Invite** badge next to their profile count towards the billable members of the shared project's top-level group. [In GitLab 16.11 and later](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/144638), the invited group's name and membership source are masked on the **Members** and the **Groups** tabs, unless one of the following applies: - The invited group is public. - The current user is a member of the invited group. - The current user is an Owner of the current group or the Maintainer/Owner of the current project. {{< alert type="note" >}} The invited group's name and membership source are masked from members who do not have access to the invited group. However, even if project Maintainers and Owners cannot access the private invited group, they can see the source of private invited group members. This behavior is intended to help project Maintainers and Owners to better manage the memberships of the projects they own. {{< /alert >}} ### Examples A project in the namespace `group/subgroup01/project`: - Can be shared with `group/subgroup02` or `group/subgroup01/subgroup03`. - Can be shared with `group_abc` unless the project's top-level group does not allow the project to be shared outside the hierarchy. For a project that was created by `Group 1`: - The members of `Group 1` have access to the project. - The Owner of `Group 1` can invite `Group 2` to the project. This way, members of both `Group 1` and `Group 2` have access to the shared project. ### Invite a group to a project {{< history >}} - [Changed](https://gitlab.com/gitlab-org/gitlab/-/issues/219230) to display invited group members on the Members tab of the Members page in GitLab 16.10 [with a flag](../../../administration/feature_flags/_index.md) named `webui_members_inherited_users`. Disabled by default. - Feature flag `webui_members_inherited_users` [enabled on GitLab.com and GitLab Self-Managed](https://gitlab.com/gitlab-org/gitlab/-/issues/219230) in GitLab 17.0. - Access expiration date for direct members of subgroups and projects [removed](https://gitlab.com/gitlab-org/gitlab/-/issues/471051), and feature flag `webui_members_inherited_users` [removed](https://gitlab.com/gitlab-org/gitlab/-/issues/364078) in GitLab 17.4. {{< /history >}} Prerequisites: - You must have at least the Maintainer role. - Sharing the project with other groups must not be prevented. - You must be a member of the invited group or subgroup. To invite a group to a project: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Manage > Members**. 1. Select **Invite a group**. 1. In the **Select a group to invite** list, select the group you want to invite. 1. From the **Select maximum role** list, select the [role](../../permissions.md) the invited group's members can have in the project. Invited members receive the lower of: - The maximum role you select - Their existing role in the group Invited group members cannot have a higher role in the project than they have in the group. For more information, see [member access and roles](#member-access-and-roles). 1. Optional. Select an **Access expiration date**. From that date onward, the invited group can no longer access the project. 1. Select **Invite**. The invited group is displayed on the **Groups** tab. You can also use the REST API to [list a project's invited groups](../../../api/projects.md#list-a-projects-invited-groups). Private groups are: - Masked from unauthorized users. - Displayed in project settings for protected branches, protected tags, and protected environments. The **Members** tab shows: - Members who were directly added to the project. - Inherited members of the group [namespace](../../namespace/_index.md) that the project was added to. The members of the invited group are not displayed on the **Members** tab unless the `webui_members_inherited_users` feature flag is enabled. #### Examples A project with the name `project-01` has the following direct members: - User A, Owner - User B, Maintainer A group with the name `group-01` has the following direct members: - User C, Owner - User D, Maintainer - User E, Reporter When `group-01` is invited to `project-01` with `Developer` permissions, users have the following roles: - User A, Owner - User B, Maintainer - User C, Developer - User D, Developer - User E, Reporter When `group-01` is invited to `project-01` with `Owner` permissions, users have the following roles: - User A, Owner - User B, Maintainer - User C, Owner - User D, Maintainer - User E, Reporter ### View shared projects A shared project is a project that has invited your group members to access its resources through the [**Invite a group**](#invite-a-group-to-a-project) action. To view projects that have shared access with your group: 1. On the left sidebar, select **Search or go to** and find your group. 1. On the group page, select the **Shared projects** tab. A list of shared projects is displayed. You can also use the REST API to [list a group's shared projects](../../../api/groups.md#list-shared-projects). ### Prevent a project from being shared with groups Sharing a project with another group increases the number of users who can invite yet more members to the project. Each (sub)group can be an additional source of access permissions, which can be confusing and difficult to control. To prevent a project from being shared with other groups: 1. On the left sidebar, select **Search or go to** and find your group. 1. Select **Settings > General**. 1. Expand the **Permissions and group features** section. 1. Select **Projects in `<group_name>` cannot be shared with other groups**. 1. Select **Save changes**. When this setting is enabled: - It applies to all subgroups, unless overridden by a group Owner. - Groups already added to a project lose access to it. {{< alert type="note" >}} After you [specify a user cap for the group](../../group/manage.md#specify-a-user-cap-for-a-group) or if you [turn on restricted access](../../group/manage.md#turn-on-restricted-access), you cannot disable this setting. {{< /alert >}} ## Sharing groups When you want another group's members to have access to your group, you can invite the [group](../../group/_index.md) to your group. The group's direct members get access to the group, which becomes a **shared group**. Only direct members of the invited group get access to the shared group, not inherited, shared or subgroup members. To grant subgroup members access, invite the subgroup directly. The following table provides an overview of the group members that get access to a shared group: | Group member source | Access to shared group | |--------------------------------------------------------------|------------------------| | Direct member of the group that is invited | {{< icon name="check-circle" >}} Yes | | Inherited member of the group that is invited | {{< icon name="dotted-circle" >}} No | | Shared member of the group that is invited | {{< icon name="dotted-circle" >}} No | | Member of a subgroup, but not of the group that is invited | {{< icon name="dotted-circle" >}} No | ### Member access and roles Each member's access depends on: - Their role in the invited group. - The maximum role you choose when you invite the group. Invited members keep the lower of these two roles. For example, if a member has the Guest role in their group, and you invite their group to another group with a maximum role of Maintainer, they keep the Guest role in the new group. After you invite a group to your group: - On the group's overview page, groups that this group has been shared with are listed on the **Shared groups** tab. - On the group's **Members** page, the invited group is listed on the **Groups** tab. This list includes both public and private groups. - On the group's **Members** page, the members of the invited group are listed on the **Members** tab. - On the group's usage quota page, direct members of the invited group who have the **Group Invite** badge next to their profile count towards the billable members of the inviting group. [In GitLab 16.11 and later](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/144638), the invited group's name and membership source are masked on the **Members** and the **Groups** tabs, unless one of the following applies: - The invited group is public. - The current user is a member of the invited group. - The current user is an Owner of the current group or the Maintainer/Owner of the current project. {{< alert type="note" >}} The invited group's name and membership source are masked from members who do not have access to the invited group. However, even if group Owners cannot access the private invited group, they can see the source of private invited group members. This behavior is intended to help group Owners to better manage the memberships of the groups they own. {{< /alert >}} ### Examples `User A` is a direct member of `Group 1` and has the Maintainer role for the group. `Group 2` invites `Group 1` with the Developer role. `User A` has the Developer role in `Group 2`. `User B` is an inherited member of `Group 1`. This user doesn't get access to `Group 2` when `Group 1` is invited. ### Invite a group to a group {{< history >}} - Access expiration date for direct members of subgroups and projects [removed](https://gitlab.com/gitlab-org/gitlab/-/issues/471051) in GitLab 17.4. {{< /history >}} Similar to how you invite a group to a project, you can invite a group to another group. Prerequisites: - You must be a member of the invited and inviting groups. To invite a group to your group: 1. On the left sidebar, select **Search or go to** and find your group. 1. Select **Manage > Members**. 1. Select **Invite a group**. 1. In the **Select a group to invite** list, select the group you want to invite. 1. From the **Select maximum role** list, select the [role](../../permissions.md) the invited group's members can have in the group. Invited members receive the lower of: - The maximum role you select - Their existing role in the invited group Invited members cannot have a higher role than they have in the invited group. For more information, see [member access and roles](#member-access-and-roles-1). 1. Select the highest [role](../../permissions.md) or [custom role](../../custom_roles/_index.md#assign-a-custom-role-to-an-invited-group) for users in the group. 1. Optional. Select an **Access expiration date**. From that date onward, the invited group can no longer access the group. 1. Select **Invite**. ### Remove an invited group To remove an invited group: 1. On the left sidebar, select **Search or go to** and find your group. 1. Select **Manage > Members**. 1. Select the **Groups** tab. 1. To the right of the group you want to remove, select **Remove group** ({{< icon name="remove" >}}). When you remove the invited group from your group: - All direct members of the invited group no longer have access to your group. - Members of the invited group no longer count towards the billable members of your group. ### View shared groups A shared group is a group that has invited your group members to access its resources through the [**Invite a group**](#invite-a-group-to-a-group) action. To view groups that have shared access with your group: 1. On the left sidebar, select **Search or go to** and find your group. 1. On the group page, select the **Shared groups** tab. A list of shared groups is displayed. You can also use the REST API to [list a group's shared groups](../../../api/groups.md#list-shared-groups). ### Prevent inviting groups outside the group hierarchy You can configure a top-level group so its subgroups and projects cannot invite other groups outside of the top-level group's hierarchy. This option is only available for top-level groups. For example, in the following group and project hierarchy: - **Animals > Dogs > Dog Project** - **Animals > Cats** - **Plants > Trees** If you prevent inviting groups outside the hierarchy for the **Animals** group: - **Dogs** can invite the group **Cats**. - **Dogs** cannot invite the group **Trees**. - **Dog Project** can invite the group **Cats**. - **Dog Project** cannot invite the group **Trees**. To prevent inviting groups outside of the group's hierarchy: 1. On the left sidebar, select **Search or go to** and find your group. 1. Select **Settings > General**. 1. Expand **Permissions and group features**. 1. Select **Members cannot invite groups outside of `<group_name>` and its subgroups**. 1. Select **Save changes**. ## Setting up a group for collaboration If you intend to collaborate with external users on projects in your group, consider the following best practices: - Structure your groups and subgroups logically based on organizational needs. Avoid creating unnecessary groups. - If you have a lot of users to manage, consider organizing users in groups separate from the groups organizing projects. Share these user groups into the groups and projects they need access to. - Carefully consider which groups you invite to your projects. Invite only groups that need access, to prevent oversharing and maintain security. - When you invite a group: - Set the maximum role appropriately. It's better to assign the minimum permissions needed, instead of defaulting to the highest role. - Members from subgroups of the invited group do not gain access to the project. You might prefer to invite subgroups separately instead. - Check the maximum role of users who belong to multiple groups with access to a project. To prevent unintended high permissions, you might want to change the users' roles. - Periodically review group access to shared projects and update as appropriate. If a group no longer needs access to a project, remove it.
--- stage: Tenant Scale group: Organizations info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments title: Sharing projects and groups description: Invitations, group inheritance, and project visibility. breadcrumbs: - doc - user - project - members --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} {{< history >}} - [Changed](https://gitlab.com/gitlab-org/gitlab/-/issues/219230) to display invited group members on the Members tab of the Members page in GitLab 16.10 [with a flag](../../../administration/feature_flags/_index.md) named `webui_members_inherited_users`. Disabled by default. - Feature flag `webui_members_inherited_users` was [enabled on GitLab.com and GitLab Self-Managed](https://gitlab.com/gitlab-org/gitlab/-/issues/219230) in GitLab 17.0. - Feature flag `webui_members_inherited_users` [removed](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/163627) in GitLab 17.4. Members of invited groups displayed by default. {{< /history >}} You can share by invitation: - A project with a group. - A group with another group. ## Sharing projects When you want a group to have access to your project, you can invite the [group](../../group/_index.md) to the project. The group's direct and inherited members get access to the project, which becomes a **shared project**. In this case, inherited members are members that are inherited from parent groups into the groups that are invited. Only members of the group that is invited get access to the shared project. If you want to give members of a subgroup of the group you are inviting access to the project, you have to invite the subgroup. The following table provides an overview of the group members that get access to a shared project. | Group member source | Access to shared project | |---------------------------------------------------------------------|--------------------------| | Direct member of the group that is invited | {{< icon name="check-circle" >}} Yes | | Inherited member of the group that is invited | {{< icon name="check-circle" >}} Yes | | Shared member of the group that is invited <sup>1</sup> | {{< icon name="dotted-circle" >}} Yes | | Direct member of a subgroup, but not of the group that is invited | {{< icon name="dotted-circle" >}} No | | Inherited member of a subgroup, but not of the group that is invited | {{< icon name="dotted-circle" >}} No | **Footnotes**: 1. GitLab supports extending project access to shared group members, but this approach is not recommended. [Epic 122](https://gitlab.com/groups/gitlab-org/-/epics/122) proposes changing this behavior and transitioning to a teams model for sharing groups. The [visibility level](../../public_access.md) of the group you're inviting must be at least as restrictive as that of the project. For example, you can invite: - A **private** group to a **private** project. - A **private** group to an **internal** project. - A **private** group to a **public** project. - An **internal** group to an **internal** project. - An **internal** group to a **public** project. - A **public** group to a **public** project. If the project's top-level group does not allow the project to be shared outside the hierarchy, the invited group or subgroup must be in the project's [namespace](../../namespace/_index.md). ### Member access and roles When you invite a group to a project, the following members get access to the project: - Direct group members. - Inherited group members. - Members of other [groups that are shared](sharing_projects_groups.md#invite-a-group-to-a-group) with the invited group. Each member's access depends on: - Their role in the group. - The maximum role you choose when you invite the group. Invited members keep the lower of these two roles. For example, if a member has the Guest role in their group, and you add their group to a project with a maximum role of Maintainer, they keep the Guest role in the project. In addition: - On the group's page, the project is listed on the **Shared projects** tab. - On the project's **Members** page, the group is listed on the **Groups** tab. This list includes both public and private groups. - On the project's **Members** page, the members of the invited group are listed on the **Members** tab. - On the usage quota page, members who have the **Project Invite** badge next to their profile count towards the billable members of the shared project's top-level group. [In GitLab 16.11 and later](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/144638), the invited group's name and membership source are masked on the **Members** and the **Groups** tabs, unless one of the following applies: - The invited group is public. - The current user is a member of the invited group. - The current user is an Owner of the current group or the Maintainer/Owner of the current project. {{< alert type="note" >}} The invited group's name and membership source are masked from members who do not have access to the invited group. However, even if project Maintainers and Owners cannot access the private invited group, they can see the source of private invited group members. This behavior is intended to help project Maintainers and Owners to better manage the memberships of the projects they own. {{< /alert >}} ### Examples A project in the namespace `group/subgroup01/project`: - Can be shared with `group/subgroup02` or `group/subgroup01/subgroup03`. - Can be shared with `group_abc` unless the project's top-level group does not allow the project to be shared outside the hierarchy. For a project that was created by `Group 1`: - The members of `Group 1` have access to the project. - The Owner of `Group 1` can invite `Group 2` to the project. This way, members of both `Group 1` and `Group 2` have access to the shared project. ### Invite a group to a project {{< history >}} - [Changed](https://gitlab.com/gitlab-org/gitlab/-/issues/219230) to display invited group members on the Members tab of the Members page in GitLab 16.10 [with a flag](../../../administration/feature_flags/_index.md) named `webui_members_inherited_users`. Disabled by default. - Feature flag `webui_members_inherited_users` [enabled on GitLab.com and GitLab Self-Managed](https://gitlab.com/gitlab-org/gitlab/-/issues/219230) in GitLab 17.0. - Access expiration date for direct members of subgroups and projects [removed](https://gitlab.com/gitlab-org/gitlab/-/issues/471051), and feature flag `webui_members_inherited_users` [removed](https://gitlab.com/gitlab-org/gitlab/-/issues/364078) in GitLab 17.4. {{< /history >}} Prerequisites: - You must have at least the Maintainer role. - Sharing the project with other groups must not be prevented. - You must be a member of the invited group or subgroup. To invite a group to a project: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Manage > Members**. 1. Select **Invite a group**. 1. In the **Select a group to invite** list, select the group you want to invite. 1. From the **Select maximum role** list, select the [role](../../permissions.md) the invited group's members can have in the project. Invited members receive the lower of: - The maximum role you select - Their existing role in the group Invited group members cannot have a higher role in the project than they have in the group. For more information, see [member access and roles](#member-access-and-roles). 1. Optional. Select an **Access expiration date**. From that date onward, the invited group can no longer access the project. 1. Select **Invite**. The invited group is displayed on the **Groups** tab. You can also use the REST API to [list a project's invited groups](../../../api/projects.md#list-a-projects-invited-groups). Private groups are: - Masked from unauthorized users. - Displayed in project settings for protected branches, protected tags, and protected environments. The **Members** tab shows: - Members who were directly added to the project. - Inherited members of the group [namespace](../../namespace/_index.md) that the project was added to. The members of the invited group are not displayed on the **Members** tab unless the `webui_members_inherited_users` feature flag is enabled. #### Examples A project with the name `project-01` has the following direct members: - User A, Owner - User B, Maintainer A group with the name `group-01` has the following direct members: - User C, Owner - User D, Maintainer - User E, Reporter When `group-01` is invited to `project-01` with `Developer` permissions, users have the following roles: - User A, Owner - User B, Maintainer - User C, Developer - User D, Developer - User E, Reporter When `group-01` is invited to `project-01` with `Owner` permissions, users have the following roles: - User A, Owner - User B, Maintainer - User C, Owner - User D, Maintainer - User E, Reporter ### View shared projects A shared project is a project that has invited your group members to access its resources through the [**Invite a group**](#invite-a-group-to-a-project) action. To view projects that have shared access with your group: 1. On the left sidebar, select **Search or go to** and find your group. 1. On the group page, select the **Shared projects** tab. A list of shared projects is displayed. You can also use the REST API to [list a group's shared projects](../../../api/groups.md#list-shared-projects). ### Prevent a project from being shared with groups Sharing a project with another group increases the number of users who can invite yet more members to the project. Each (sub)group can be an additional source of access permissions, which can be confusing and difficult to control. To prevent a project from being shared with other groups: 1. On the left sidebar, select **Search or go to** and find your group. 1. Select **Settings > General**. 1. Expand the **Permissions and group features** section. 1. Select **Projects in `<group_name>` cannot be shared with other groups**. 1. Select **Save changes**. When this setting is enabled: - It applies to all subgroups, unless overridden by a group Owner. - Groups already added to a project lose access to it. {{< alert type="note" >}} After you [specify a user cap for the group](../../group/manage.md#specify-a-user-cap-for-a-group) or if you [turn on restricted access](../../group/manage.md#turn-on-restricted-access), you cannot disable this setting. {{< /alert >}} ## Sharing groups When you want another group's members to have access to your group, you can invite the [group](../../group/_index.md) to your group. The group's direct members get access to the group, which becomes a **shared group**. Only direct members of the invited group get access to the shared group, not inherited, shared or subgroup members. To grant subgroup members access, invite the subgroup directly. The following table provides an overview of the group members that get access to a shared group: | Group member source | Access to shared group | |--------------------------------------------------------------|------------------------| | Direct member of the group that is invited | {{< icon name="check-circle" >}} Yes | | Inherited member of the group that is invited | {{< icon name="dotted-circle" >}} No | | Shared member of the group that is invited | {{< icon name="dotted-circle" >}} No | | Member of a subgroup, but not of the group that is invited | {{< icon name="dotted-circle" >}} No | ### Member access and roles Each member's access depends on: - Their role in the invited group. - The maximum role you choose when you invite the group. Invited members keep the lower of these two roles. For example, if a member has the Guest role in their group, and you invite their group to another group with a maximum role of Maintainer, they keep the Guest role in the new group. After you invite a group to your group: - On the group's overview page, groups that this group has been shared with are listed on the **Shared groups** tab. - On the group's **Members** page, the invited group is listed on the **Groups** tab. This list includes both public and private groups. - On the group's **Members** page, the members of the invited group are listed on the **Members** tab. - On the group's usage quota page, direct members of the invited group who have the **Group Invite** badge next to their profile count towards the billable members of the inviting group. [In GitLab 16.11 and later](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/144638), the invited group's name and membership source are masked on the **Members** and the **Groups** tabs, unless one of the following applies: - The invited group is public. - The current user is a member of the invited group. - The current user is an Owner of the current group or the Maintainer/Owner of the current project. {{< alert type="note" >}} The invited group's name and membership source are masked from members who do not have access to the invited group. However, even if group Owners cannot access the private invited group, they can see the source of private invited group members. This behavior is intended to help group Owners to better manage the memberships of the groups they own. {{< /alert >}} ### Examples `User A` is a direct member of `Group 1` and has the Maintainer role for the group. `Group 2` invites `Group 1` with the Developer role. `User A` has the Developer role in `Group 2`. `User B` is an inherited member of `Group 1`. This user doesn't get access to `Group 2` when `Group 1` is invited. ### Invite a group to a group {{< history >}} - Access expiration date for direct members of subgroups and projects [removed](https://gitlab.com/gitlab-org/gitlab/-/issues/471051) in GitLab 17.4. {{< /history >}} Similar to how you invite a group to a project, you can invite a group to another group. Prerequisites: - You must be a member of the invited and inviting groups. To invite a group to your group: 1. On the left sidebar, select **Search or go to** and find your group. 1. Select **Manage > Members**. 1. Select **Invite a group**. 1. In the **Select a group to invite** list, select the group you want to invite. 1. From the **Select maximum role** list, select the [role](../../permissions.md) the invited group's members can have in the group. Invited members receive the lower of: - The maximum role you select - Their existing role in the invited group Invited members cannot have a higher role than they have in the invited group. For more information, see [member access and roles](#member-access-and-roles-1). 1. Select the highest [role](../../permissions.md) or [custom role](../../custom_roles/_index.md#assign-a-custom-role-to-an-invited-group) for users in the group. 1. Optional. Select an **Access expiration date**. From that date onward, the invited group can no longer access the group. 1. Select **Invite**. ### Remove an invited group To remove an invited group: 1. On the left sidebar, select **Search or go to** and find your group. 1. Select **Manage > Members**. 1. Select the **Groups** tab. 1. To the right of the group you want to remove, select **Remove group** ({{< icon name="remove" >}}). When you remove the invited group from your group: - All direct members of the invited group no longer have access to your group. - Members of the invited group no longer count towards the billable members of your group. ### View shared groups A shared group is a group that has invited your group members to access its resources through the [**Invite a group**](#invite-a-group-to-a-group) action. To view groups that have shared access with your group: 1. On the left sidebar, select **Search or go to** and find your group. 1. On the group page, select the **Shared groups** tab. A list of shared groups is displayed. You can also use the REST API to [list a group's shared groups](../../../api/groups.md#list-shared-groups). ### Prevent inviting groups outside the group hierarchy You can configure a top-level group so its subgroups and projects cannot invite other groups outside of the top-level group's hierarchy. This option is only available for top-level groups. For example, in the following group and project hierarchy: - **Animals > Dogs > Dog Project** - **Animals > Cats** - **Plants > Trees** If you prevent inviting groups outside the hierarchy for the **Animals** group: - **Dogs** can invite the group **Cats**. - **Dogs** cannot invite the group **Trees**. - **Dog Project** can invite the group **Cats**. - **Dog Project** cannot invite the group **Trees**. To prevent inviting groups outside of the group's hierarchy: 1. On the left sidebar, select **Search or go to** and find your group. 1. Select **Settings > General**. 1. Expand **Permissions and group features**. 1. Select **Members cannot invite groups outside of `<group_name>` and its subgroups**. 1. Select **Save changes**. ## Setting up a group for collaboration If you intend to collaborate with external users on projects in your group, consider the following best practices: - Structure your groups and subgroups logically based on organizational needs. Avoid creating unnecessary groups. - If you have a lot of users to manage, consider organizing users in groups separate from the groups organizing projects. Share these user groups into the groups and projects they need access to. - Carefully consider which groups you invite to your projects. Invite only groups that need access, to prevent oversharing and maintain security. - When you invite a group: - Set the maximum role appropriately. It's better to assign the minimum permissions needed, instead of defaulting to the highest role. - Members from subgroups of the invited group do not gain access to the project. You might prefer to invite subgroups separately instead. - Check the maximum role of users who belong to multiple groups with access to a project. To prevent unintended high permissions, you might want to change the users' roles. - Periodically review group access to shared projects and update as appropriate. If a group no longer needs access to a project, remove it.
https://docs.gitlab.com/user/project/web_editor
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/web_editor.md
2025-08-13
doc/user/project/repository
[ "doc", "user", "project", "repository" ]
web_editor.md
Create
Source Code
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Web Editor
Use the Web Editor to create, upload, and edit text files directly in the GitLab UI.
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} The Web Editor is a browser-based tool for making changes to your GitLab repositories without local setup. You can: - Edit single files and view live Markdown previews. - Create new files and directories. - Upload and replace files. - Create branches and tags for version control. - [Lock files](../file_lock.md#lock-a-file-or-directory) to prevent concurrent editing conflicts. - Contribute to projects without setting up Git locally. GitLab uses your [primary email address](../../profile/_index.md#change-the-email-displayed-on-your-commits) for Web Editor commits. For changes to multiple files, use the [Web IDE](../web_ide/_index.md). {{< alert type="note" >}} To manage files in a [protected branch](branches/protected.md), you must have the appropriate [permissions](../../permissions.md). {{< /alert >}} ## Manage files You can create, edit, upload, and delete files with the Web Editor, directly from the GitLab UI. ### Create a file To create a text file in the Web Editor: 1. On the left sidebar, select **Search or go to** and find your project. 1. Go to the directory where you want to create the new file. 1. Next to the directory name, select the plus icon ({{< icon name="plus" >}}) > **New file**. 1. Next to the branch name, enter a filename and extension. For example, `my_file.md`. 1. Add content to your file. 1. Select **Commit changes**. 1. In the **Commit message** field, enter a reason for the commit. 1. Choose one of the following options: - To create a file in the prefilled target branch, select **Commit changes**. - To create a file in a new branch and commit changes: 1. Select **Commit to a new branch**. 1. Enter a branch name. 1. Ensure the **Create a merge request for this change** checkbox is cleared. 1. Select **Commit changes**. - To create a file in a new branch, commit changes, and create a merge request: 1. Select **Commit to a new branch**. 1. Enter a branch name. 1. Ensure the **Create a merge request for this change** checkbox is selected. 1. Select **Commit changes**. #### From a template To create a text file from a template in the Web Editor: 1. On the left sidebar, select **Search or go to** and find your project. 1. Go to the directory where you want to create the new file. 1. Next to the directory name, select the plus icon ({{< icon name="plus" >}}) > **New file**. 1. In **Filename**, enter a name that GitLab provides a template for: - `.gitignore` - `.gitlab-ci.yml` - `LICENSE` - `Dockerfile` 1. From the **Apply a template** dropdown list, select a template. 1. Optional. Update the template as desired. 1. Continue from the step 6 in the [create a file](#create-a-file) process. ### Edit a file To edit a text file in the Web Editor: 1. On the left sidebar, select **Search or go to** and find your project. 1. Go to the file you want to edit. 1. Select **Edit > Edit single file**. 1. Make your changes. 1. Select **Commit changes**. 1. In the **Commit message** field, enter a reason for the commit. 1. Choose one of the following options: - To edit a file from the prefilled target branch, select **Commit changes**. - To edit a file from a new branch and commit changes: 1. Select **Commit to a new branch**. 1. Enter a branch name. 1. Ensure the **Create a merge request for this change** checkbox is cleared. 1. Select **Commit changes**. - To edit a file from a new branch, commit changes, and create a merge request: 1. Select **Commit to a new branch**. 1. Enter a branch name. 1. Ensure the **Create a merge request for this change** checkbox is selected. 1. Select **Commit changes**. 1. Fill out the fields and select **Create merge request**. {{< alert type="note" >}} If someone edits and commits changes to the same file while your are editing, you can't commit your changes. The following error message is displayed: `Someone edited the file the same time you did. Please check out the file and make sure your change will not unintentionally remove theirs.` {{< /alert >}} #### Markdown preview To preview a Markdown file in the Web Editor: 1. On the left sidebar, select **Search or go to** and find your project. 1. Go to the file you want to preview. 1. Select **Edit > Edit single file**. 1. Select the **Preview** tab. You can see a live Markdown preview alongside your content. To close the preview panel, select the **Write** tab. #### Link to specific lines To link to single or multiple lines in the Web Editor, add hash information to the filename segment of the URL. For example: - `MY_FILE.js#L3` highlights line 3 in `MY_FILE.js`. - `MY_FILE.js#L3-10` highlights lines 3 to 10 in `MY_FILE.js`. When you edit a file, you can also link to a single line by selecting a line number. #### Edit files in a forked merge request Prerequisites: - You must work on a merge request from a fork. - [Allow commits from upstream members](../merge_requests/allow_collaboration.md#allow-commits-from-upstream-members) must be enabled. If you're working on a merge request from a forked project, you can edit a file and commit changes. To do this: 1. Go to the merge request. 1. Go to the file you want to edit. 1. Select **Edit > Edit single file**. 1. Select **Commit changes**. 1. In **Commit message**, enter a reason for the commit. The following information is provided: `Your changes can be committed to <branch-name> because a merge request is open.` 1. Select **Commit changes**. ### Upload a file To upload a file in the Web Editor: 1. On the left sidebar, select **Search or go to** and find your project. 1. Go to the directory where you want to upload the file. 1. Next to the directory name, select the plus icon ({{< icon name="plus" >}}) > **Upload file**. 1. Drop or upload the file your want to add. 1. In the **Commit message** field, enter a reason for the commit. 1. Choose one of the following options: - To upload a file from the prefilled target branch, select **Commit changes**. - To upload a file from a new branch and commit changes: 1. Select **Commit to a new branch**. 1. Enter a branch name. 1. Ensure the **Create a merge request for this change** checkbox is cleared. 1. Select **Commit changes**. - To upload a file from a new branch, commit changes, and create a merge request: 1. Select **Commit to a new branch**. 1. Enter a branch name. 1. Ensure the **Create a merge request for this change** checkbox is selected. 1. Select **Commit changes**. 1. Fill out the fields and select **Create merge request**. ### Delete a file To delete a file in the Web Editor: 1. On the left sidebar, select **Search or go to** and find your project. 1. Go to the file you want to delete. 1. Select **Delete**. 1. In **Commit message**, enter a reason for the commit. 1. Choose between the following options: - To delete a file from the prefilled target branch, select **Commit changes**. - To delete a file from a new branch and commit changes: 1. Select **Commit to a new branch**. 1. Enter a branch name. 1. Ensure the **Create a merge request for this change** checkbox is cleared. 1. Select **Commit changes**. - To delete a file from a new branch, commit changes, and create a merge request: 1. Select **Commit to a new branch**. 1. Enter a branch name. 1. Ensure the **Create a merge request for this change** checkbox is selected. 1. Select **Commit changes**. {{< alert type="note" >}} If someone edits and commits changes to the same file while your are editing, you can't commit your changes. The following error message is displayed: `Someone edited the file the same time you did. Please check out the file and make sure your change will not unintentionally remove theirs.` {{< /alert >}} ### Replace a file To replace a file in the Web Editor: 1. On the left sidebar, select **Search or go to** and find your project. 1. Go to the file you want to replace. 1. Select **Replace**. 1. Drop or upload the file you want to upload and replace the existing one. 1. In **Commit message**, enter a reason for the commit. 1. Choose between the following options: - To replace a file from the prefilled target branch, select **Commit changes**. - To replace a file from a new branch and commit changes: 1. Select **Commit to a new branch**. 1. Enter a branch name. 1. Ensure the **Create a merge request for this change** checkbox is cleared. 1. Select **Commit changes**. - To replace a file from a new branch, commit changes, and create a merge request: 1. Select **Commit to a new branch**. 1. Enter a branch name. 1. Ensure the **Create a merge request for this change** checkbox is selected. 1. Select **Commit changes**. ### Cancel file changes To cancel changes, edit, upload, or delete a file, from the Web Editor: 1. Select **Cancel**. 1. Select one of the following: - Confirm you want to cancel changes: Select **OK**. - Don't cancel changes: Select **Cancel**. ### File operations from the Actions menu {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/519325) in GitLab 17.10 [with a flag](../../../administration/feature_flags/_index.md) named `blob_overflow_menu`. Disabled by default. - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/issues/522993) in GitLab 18.1. Feature flag `blob_overflow_menu` removed. {{< /history >}} The **Actions** ({{< icon name="ellipsis_v" >}}) menu consolidates file operations into the dropdown list. From this menu, you can: - Edit a file. - Upload a file. - Delete a file. - Replace a file. To complete these actions: 1. Open the file in GitLab. 1. In the upper-right corner, next to a filename, select **Actions** ({{< icon name="ellipsis_v" >}}). 1. Select your desired action. ## Create a directory To create a directory in the Web Editor: 1. On the left sidebar, select **Search or go to** and find your project. 1. Go to the directory where you want to create the new directory. 1. Next to the directory name, select the plus icon ({{< icon name="plus" >}}) > **New directory**. 1. In the **Directory name** field, enter your directory name. 1. In **Commit message**, enter a reason for the commit. 1. Choose between the following options: - To create a directory from the prefilled target branch, select **Commit changes**. - To create a directory from a new branch and commit changes: 1. Select **Commit to a new branch**. 1. Enter a branch name. 1. Ensure the **Create a merge request for this change** checkbox is cleared. 1. Select **Commit changes**. - To create a directory from a new branch, commit changes, and create a merge request: 1. Select **Commit to a new branch**. 1. Enter a branch name. 1. Ensure the **Create a merge request for this change** checkbox is selected. 1. Select **Commit changes**. ## Create a branch To create a [branch](branches/_index.md) in the Web Editor: 1. On the left sidebar, select **Search or go to** and find your project. 1. Next to the repository name, select the plus icon ({{< icon name="plus" >}}) > **New branch**. 1. Complete the fields. 1. Select **Create branch**. ## Create a tag You can create [tags](tags/_index.md) to mark milestones such as production releases and release candidates. To create a tag in the Web Editor: 1. On the left sidebar, select **Search or go to** and find your project. 1. Next to the repository name, select the plus icon ({{< icon name="plus" >}}) > **New tag**. 1. Complete the fields. 1. Select **Create tag**. ## Related topics - [Create merge requests](../merge_requests/creating_merge_requests.md) - [Branches](branches/_index.md) - [Default branch](branches/default.md) - [Protected branches](branches/protected.md) - [Web IDE](../web_ide/_index.md)
--- stage: Create group: Source Code info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments description: Use the Web Editor to create, upload, and edit text files directly in the GitLab UI. title: Web Editor breadcrumbs: - doc - user - project - repository --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} The Web Editor is a browser-based tool for making changes to your GitLab repositories without local setup. You can: - Edit single files and view live Markdown previews. - Create new files and directories. - Upload and replace files. - Create branches and tags for version control. - [Lock files](../file_lock.md#lock-a-file-or-directory) to prevent concurrent editing conflicts. - Contribute to projects without setting up Git locally. GitLab uses your [primary email address](../../profile/_index.md#change-the-email-displayed-on-your-commits) for Web Editor commits. For changes to multiple files, use the [Web IDE](../web_ide/_index.md). {{< alert type="note" >}} To manage files in a [protected branch](branches/protected.md), you must have the appropriate [permissions](../../permissions.md). {{< /alert >}} ## Manage files You can create, edit, upload, and delete files with the Web Editor, directly from the GitLab UI. ### Create a file To create a text file in the Web Editor: 1. On the left sidebar, select **Search or go to** and find your project. 1. Go to the directory where you want to create the new file. 1. Next to the directory name, select the plus icon ({{< icon name="plus" >}}) > **New file**. 1. Next to the branch name, enter a filename and extension. For example, `my_file.md`. 1. Add content to your file. 1. Select **Commit changes**. 1. In the **Commit message** field, enter a reason for the commit. 1. Choose one of the following options: - To create a file in the prefilled target branch, select **Commit changes**. - To create a file in a new branch and commit changes: 1. Select **Commit to a new branch**. 1. Enter a branch name. 1. Ensure the **Create a merge request for this change** checkbox is cleared. 1. Select **Commit changes**. - To create a file in a new branch, commit changes, and create a merge request: 1. Select **Commit to a new branch**. 1. Enter a branch name. 1. Ensure the **Create a merge request for this change** checkbox is selected. 1. Select **Commit changes**. #### From a template To create a text file from a template in the Web Editor: 1. On the left sidebar, select **Search or go to** and find your project. 1. Go to the directory where you want to create the new file. 1. Next to the directory name, select the plus icon ({{< icon name="plus" >}}) > **New file**. 1. In **Filename**, enter a name that GitLab provides a template for: - `.gitignore` - `.gitlab-ci.yml` - `LICENSE` - `Dockerfile` 1. From the **Apply a template** dropdown list, select a template. 1. Optional. Update the template as desired. 1. Continue from the step 6 in the [create a file](#create-a-file) process. ### Edit a file To edit a text file in the Web Editor: 1. On the left sidebar, select **Search or go to** and find your project. 1. Go to the file you want to edit. 1. Select **Edit > Edit single file**. 1. Make your changes. 1. Select **Commit changes**. 1. In the **Commit message** field, enter a reason for the commit. 1. Choose one of the following options: - To edit a file from the prefilled target branch, select **Commit changes**. - To edit a file from a new branch and commit changes: 1. Select **Commit to a new branch**. 1. Enter a branch name. 1. Ensure the **Create a merge request for this change** checkbox is cleared. 1. Select **Commit changes**. - To edit a file from a new branch, commit changes, and create a merge request: 1. Select **Commit to a new branch**. 1. Enter a branch name. 1. Ensure the **Create a merge request for this change** checkbox is selected. 1. Select **Commit changes**. 1. Fill out the fields and select **Create merge request**. {{< alert type="note" >}} If someone edits and commits changes to the same file while your are editing, you can't commit your changes. The following error message is displayed: `Someone edited the file the same time you did. Please check out the file and make sure your change will not unintentionally remove theirs.` {{< /alert >}} #### Markdown preview To preview a Markdown file in the Web Editor: 1. On the left sidebar, select **Search or go to** and find your project. 1. Go to the file you want to preview. 1. Select **Edit > Edit single file**. 1. Select the **Preview** tab. You can see a live Markdown preview alongside your content. To close the preview panel, select the **Write** tab. #### Link to specific lines To link to single or multiple lines in the Web Editor, add hash information to the filename segment of the URL. For example: - `MY_FILE.js#L3` highlights line 3 in `MY_FILE.js`. - `MY_FILE.js#L3-10` highlights lines 3 to 10 in `MY_FILE.js`. When you edit a file, you can also link to a single line by selecting a line number. #### Edit files in a forked merge request Prerequisites: - You must work on a merge request from a fork. - [Allow commits from upstream members](../merge_requests/allow_collaboration.md#allow-commits-from-upstream-members) must be enabled. If you're working on a merge request from a forked project, you can edit a file and commit changes. To do this: 1. Go to the merge request. 1. Go to the file you want to edit. 1. Select **Edit > Edit single file**. 1. Select **Commit changes**. 1. In **Commit message**, enter a reason for the commit. The following information is provided: `Your changes can be committed to <branch-name> because a merge request is open.` 1. Select **Commit changes**. ### Upload a file To upload a file in the Web Editor: 1. On the left sidebar, select **Search or go to** and find your project. 1. Go to the directory where you want to upload the file. 1. Next to the directory name, select the plus icon ({{< icon name="plus" >}}) > **Upload file**. 1. Drop or upload the file your want to add. 1. In the **Commit message** field, enter a reason for the commit. 1. Choose one of the following options: - To upload a file from the prefilled target branch, select **Commit changes**. - To upload a file from a new branch and commit changes: 1. Select **Commit to a new branch**. 1. Enter a branch name. 1. Ensure the **Create a merge request for this change** checkbox is cleared. 1. Select **Commit changes**. - To upload a file from a new branch, commit changes, and create a merge request: 1. Select **Commit to a new branch**. 1. Enter a branch name. 1. Ensure the **Create a merge request for this change** checkbox is selected. 1. Select **Commit changes**. 1. Fill out the fields and select **Create merge request**. ### Delete a file To delete a file in the Web Editor: 1. On the left sidebar, select **Search or go to** and find your project. 1. Go to the file you want to delete. 1. Select **Delete**. 1. In **Commit message**, enter a reason for the commit. 1. Choose between the following options: - To delete a file from the prefilled target branch, select **Commit changes**. - To delete a file from a new branch and commit changes: 1. Select **Commit to a new branch**. 1. Enter a branch name. 1. Ensure the **Create a merge request for this change** checkbox is cleared. 1. Select **Commit changes**. - To delete a file from a new branch, commit changes, and create a merge request: 1. Select **Commit to a new branch**. 1. Enter a branch name. 1. Ensure the **Create a merge request for this change** checkbox is selected. 1. Select **Commit changes**. {{< alert type="note" >}} If someone edits and commits changes to the same file while your are editing, you can't commit your changes. The following error message is displayed: `Someone edited the file the same time you did. Please check out the file and make sure your change will not unintentionally remove theirs.` {{< /alert >}} ### Replace a file To replace a file in the Web Editor: 1. On the left sidebar, select **Search or go to** and find your project. 1. Go to the file you want to replace. 1. Select **Replace**. 1. Drop or upload the file you want to upload and replace the existing one. 1. In **Commit message**, enter a reason for the commit. 1. Choose between the following options: - To replace a file from the prefilled target branch, select **Commit changes**. - To replace a file from a new branch and commit changes: 1. Select **Commit to a new branch**. 1. Enter a branch name. 1. Ensure the **Create a merge request for this change** checkbox is cleared. 1. Select **Commit changes**. - To replace a file from a new branch, commit changes, and create a merge request: 1. Select **Commit to a new branch**. 1. Enter a branch name. 1. Ensure the **Create a merge request for this change** checkbox is selected. 1. Select **Commit changes**. ### Cancel file changes To cancel changes, edit, upload, or delete a file, from the Web Editor: 1. Select **Cancel**. 1. Select one of the following: - Confirm you want to cancel changes: Select **OK**. - Don't cancel changes: Select **Cancel**. ### File operations from the Actions menu {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/519325) in GitLab 17.10 [with a flag](../../../administration/feature_flags/_index.md) named `blob_overflow_menu`. Disabled by default. - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/issues/522993) in GitLab 18.1. Feature flag `blob_overflow_menu` removed. {{< /history >}} The **Actions** ({{< icon name="ellipsis_v" >}}) menu consolidates file operations into the dropdown list. From this menu, you can: - Edit a file. - Upload a file. - Delete a file. - Replace a file. To complete these actions: 1. Open the file in GitLab. 1. In the upper-right corner, next to a filename, select **Actions** ({{< icon name="ellipsis_v" >}}). 1. Select your desired action. ## Create a directory To create a directory in the Web Editor: 1. On the left sidebar, select **Search or go to** and find your project. 1. Go to the directory where you want to create the new directory. 1. Next to the directory name, select the plus icon ({{< icon name="plus" >}}) > **New directory**. 1. In the **Directory name** field, enter your directory name. 1. In **Commit message**, enter a reason for the commit. 1. Choose between the following options: - To create a directory from the prefilled target branch, select **Commit changes**. - To create a directory from a new branch and commit changes: 1. Select **Commit to a new branch**. 1. Enter a branch name. 1. Ensure the **Create a merge request for this change** checkbox is cleared. 1. Select **Commit changes**. - To create a directory from a new branch, commit changes, and create a merge request: 1. Select **Commit to a new branch**. 1. Enter a branch name. 1. Ensure the **Create a merge request for this change** checkbox is selected. 1. Select **Commit changes**. ## Create a branch To create a [branch](branches/_index.md) in the Web Editor: 1. On the left sidebar, select **Search or go to** and find your project. 1. Next to the repository name, select the plus icon ({{< icon name="plus" >}}) > **New branch**. 1. Complete the fields. 1. Select **Create branch**. ## Create a tag You can create [tags](tags/_index.md) to mark milestones such as production releases and release candidates. To create a tag in the Web Editor: 1. On the left sidebar, select **Search or go to** and find your project. 1. Next to the repository name, select the plus icon ({{< icon name="plus" >}}) > **New tag**. 1. Complete the fields. 1. Select **Create tag**. ## Related topics - [Create merge requests](../merge_requests/creating_merge_requests.md) - [Branches](branches/_index.md) - [Default branch](branches/default.md) - [Protected branches](branches/protected.md) - [Web IDE](../web_ide/_index.md)
https://docs.gitlab.com/user/project/push_rules
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/push_rules.md
2025-08-13
doc/user/project/repository
[ "doc", "user", "project", "repository" ]
push_rules.md
Create
Source Code
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Push rules
Use push rules to control the content and format of Git commits your repository accepts. Set standards for commit messages, and block secrets or credentials from being added accidentally.
{{< details >}} - Tier: Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} {{< history >}} - Maximum regular expression length for push rules [changed](https://gitlab.com/gitlab-org/gitlab/-/issues/411901) from 255 to 511 characters in GitLab 16.3. {{< /history >}} Push rules are [`pre-receive` Git hooks](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks#:~:text=pre%2Dreceive,with%20the%20push.) you can enable in a user-friendly interface. Push rules give you more control over what can and can't be pushed to your repository. While GitLab offers [protected branches](branches/protected.md), you may need more specific rules, such as: - Evaluating the contents of a commit. - Confirming commit messages match expected formats. - Enforcing [branch name rules](branches/_index.md#name-your-branch). - Evaluating the details of files. - Preventing Git tag removal. - Requiring signed commits. GitLab uses [RE2 syntax](https://github.com/google/re2/wiki/Syntax) for regular expressions in push rules. You can test them at the [regex101 regex tester](https://regex101.com/). Each regular expression is limited to 511 characters. For custom push rules use [server hooks](../../../administration/server_hooks.md). ## Enable global push rules You can create push rules for all new projects to inherit, but they can be overridden in a project or [group](../../group/access_and_permissions.md#group-push-rules). All projects created after you configure global push rules inherit this configuration. However, each existing project must be updated manually, using the process described in [Override global push rules per project](#override-global-push-rules-per-project). Prerequisites: - You must be an administrator. To create global push rules: 1. On the left sidebar, at the bottom, select **Admin**. 1. Select **Push rules**. 1. Expand **Push rules**. 1. Set the rule you want. 1. Select **Save push rules**. ## Override global push rules per project The push rule of an individual project overrides the global push rule. To override global push rules for a specific project, or to update the rules for an existing project to match new global push rules: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Repository**. 1. Expand **Push rules**. 1. Set the rule you want. 1. Select **Save push rules**. ## Verify users Use these rules to validate users who make commits. {{< alert type="note" >}} These push rules apply only to commits and not [tags](tags/_index.md). {{< /alert >}} - **Reject unverified users**: The committer email must match one of the user's [verified email addresses](../../profile/_index.md#add-emails-to-your-user-profile) or [private commit email address](../../profile/_index.md#use-an-automatically-generated-private-commit-email). - **Reject inconsistent user name**: The commit author name must match the user's GitLab account name. - **Check whether the commit author is a GitLab user**: Both the commit author and committer email addresses must match a GitLab user's [verified email addresses](../../profile/_index.md#add-emails-to-your-user-profile). - **Commit author's email**: Both the author and committer email addresses must match the regular expression. To allow any email address, leave empty. When using [bot users for projects](../../project/settings/project_access_tokens.md#bot-users-for-projects) or [bot users for groups](../../group/settings/group_access_tokens.md#bot-users-for-groups), you must add the generated email suffix so that bot tokens can commit and push changes. ## Validate commit messages Use these rules for your commit messages: - **Require expression in commit messages**: Messages must match the expression. To allow any commit message, leave empty. Uses multiline mode, which can be disabled by using `(?-m)`. Some validation examples: - `JIRA\-\d+` requires every commit to reference a Jira issue, like `Refactored css. Fixes JIRA-123`. - `[[:^punct:]]\b$` rejects a commit if the final character is a punctuation mark. The word boundary character (`\b`) prevents false negatives, because Git adds a newline character (`\n`) to the end of the commit message. Commit messages created in GitLab UI set `\r\n` as a newline character. Use `(\r\n?|\n)` instead of `\n` in your regular expression to correctly match it. For example, given the following multi-line commit description: ```plaintext JIRA: Description ``` You can validate it with this regular expression: `JIRA:(\r\n?|\n)\w+`. - **Reject expression in commit messages**: Commit messages must not match the expression. To allow any commit message, leave empty. Uses multiline mode, which can be disabled by using `(?-m)`. ## Validate branch names To validate your branch names, enter a regular expression for **Branch name**. To allow any branch name, leave empty. Your [default branch](branches/default.md) is always allowed. Certain formats of branch names are restricted by default for security purposes. Names with 40 hexadecimal characters, similar to Git commit hashes, are prohibited. Some validation examples: - Branches must start with `JIRA-`. ```plaintext ^JIRA- ``` - Branches must end with `-JIRA`. ```plaintext -JIRA$ ``` - Branches must be between `4` and `15` characters long, accepting only lowercase letters, numbers and dashes. ```plaintext ^[a-z0-9\\-]{4,15}$ ``` ## Prevent unintended consequences Use these rules to prevent unintended consequences. - **Reject unsigned commits**: Commit [must be signed](signed_commits/_index.md). This rule can block some legitimate commits [created in the Web IDE](#reject-unsigned-commits-push-rule-disables-web-ide), and allow [unsigned commits to appear in commit history](#unsigned-commits-appear-in-commit-history). - **Do not allow users to remove Git tags with `git push`**: Users cannot use `git push` to remove Git tags. ## Validate files Use these rules to validate files contained in the commit. - **Prevent pushing secret files**: Files must not contain [secrets](#prevent-pushing-secrets-to-the-repository). - **Prohibited filenames**: Files that do not exist in the repository must not match the regular expression. To allow all filenames, leave empty. See [common examples](#prohibit-files-by-name). - **Maximum file size**: Added or updated files must not exceed this file size (in MB). To allow files of any size, set to `0`. Files tracked by Git LFS are exempted. ### Prevent pushing secrets to the repository Never commit secrets, such as credential files and SSH private keys, to a version control system. In GitLab, you can use a predefined list of files to block those files from a repository. Merge requests that contain a file that matches the list are blocked. This push rule does not restrict files already committed to the repository. You must update the configuration of existing projects to use the rule, using the process described in [Override global push rules per project](#override-global-push-rules-per-project). Files blocked by this rule are listed below. For a complete list of criteria, refer to [`files_denylist.yml`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/lib/gitlab/checks/files_denylist.yml). - AWS CLI credential blobs: - `.aws/credentials` - `aws/credentials` - `homefolder/aws/credentials` - Private RSA SSH keys: - `/ssh/id_rsa` - `/.ssh/personal_rsa` - `/config/server_rsa` - `id_rsa` - `.id_rsa` - Private DSA SSH keys: - `/ssh/id_dsa` - `/.ssh/personal_dsa` - `/config/server_dsa` - `id_dsa` - `.id_dsa` - Private ED25519 SSH keys: - `/ssh/id_ed25519` - `/.ssh/personal_ed25519` - `/config/server_ed25519` - `id_ed25519` - `.id_ed25519` - Private ECDSA SSH keys: - `/ssh/id_ecdsa` - `/.ssh/personal_ecdsa` - `/config/server_ecdsa` - `id_ecdsa` - `.id_ecdsa` - Private ECDSA_SK SSH keys: - `/ssh/id_ecdsa_sk` - `/.ssh/personal_ecdsa_sk` - `/config/server_ecdsa_sk` - `id_ecdsa_sk` - `.id_ecdsa_sk` - Private ED25519_SK SSH keys: - `/ssh/id_ed25519_sk` - `/.ssh/personal_ed25519_sk` - `/config/server_ed25519_sk` - `id_ed25519_sk` - `.id_ed25519_sk` - Any files ending with these suffixes: - `*.pem` - `*.key` - `*.history` - `*_history` ### Prohibit files by name In Git, filenames include both the file's name, and all directories preceding the name. When you `git push`, each filename in the push is compared to the regular expression in **Prohibited filenames**. {{< alert type="note" >}} This feature uses [RE2 syntax](https://github.com/google/re2/wiki/Syntax), which does not support positive or negative lookaheads. {{< /alert >}} The regular expression can: - Match file names in any location in your repository. - Match file names in specific locations. - Match partial file names. - Exclude specific file types by extension. - Combine multiple expressions to exclude several patterns. ### Regular expression examples These examples use common regex string boundary patterns: - `^`: Matches the beginning of a string. - `$`: Matches the end of a string. - `\.`: Matches a literal period character. The backslash escapes the period. - `\/`: Matches a literal forward slash. The backslash escapes the forward slash. #### Prevent specific file types - To prevent pushing `.exe` files to any location in the repository: ```plaintext \.exe$ ``` #### Prevent specific files - To prevent pushing a specific configuration file: - In the repository root: ```plaintext ^config\.yml$ ``` - In a specific directory: ```plaintext ^directory-name\/config\.yml$ ``` - In any location - This example prevents pushing any file named `install.exe`: ```plaintext (^|\/)install\.exe$ ``` #### Combine patterns You can combine multiple patterns into one expression. This example combines all the previous expressions: ```plaintext (\.exe|^config\.yml|^directory-name\/config\.yml|(^|\/)install\.exe)$ ``` ## Require signed commits [Signed commits](signed_commits/_index.md) are digital signatures used to verify authenticity. Use the **Reject unsigned commits** push rule to require all commits to have cryptographic signatures. When you enable this rule: - All new commits pushed to the repository must contain a valid cryptographic signature. - The signature must be created using a supported signing method (GPG, SSH, or X.509). - Commits without any signature are rejected at push time. - Commits with invalid or corrupted signatures are rejected. To enable the **Reject unsigned commits** push rule: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Repository**. 1. Expand **Push rules**. 1. Select **Reject unsigned commits**. 1. Select **Save push rules**. ## Reject commits that aren't DCO certified Commits signed with the [Developer Certificate of Origin](https://developercertificate.org/) (DCO) certify the contributor wrote, or has the right to submit, the code contributed in that commit. You can require all commits to your project to comply with the DCO. This push rule requires a `Signed-off-by:` trailer in every commit message, and rejects any commits that lack it. ## Related topics - [Git server hooks](../../../administration/server_hooks.md) (previously called server hooks), to create complex custom push rules - [Signed commits](signed_commits/_index.md) - [Protected branches](branches/protected.md) - [Secret detection](../../application_security/secret_detection/_index.md) ## Troubleshooting ### Reject unsigned commits push rule disables Web IDE If a project has the **Reject unsigned commits** push rule, the user cannot create commits through the GitLab Web IDE. To allow committing through the Web IDE on a project with this push rule, a GitLab administrator must disable the feature flag `reject_unsigned_commits_by_gitlab` [with a flag](../../../administration/feature_flags/_index.md). ```ruby Feature.disable(:reject_unsigned_commits_by_gitlab) ``` ### Unsigned commits appear in commit history The **Reject unsigned commits** push rule ignores commits that are authenticated and created by GitLab (either through the UI or API). When this push rule is enabled, unsigned commits might still appear in the commit history if a commit was created in GitLab itself. As expected, commits created outside GitLab and pushed to the repository are rejected. For more information, see [issue #5361](https://gitlab.com/gitlab-org/gitaly/-/issues/5361). ### Bulk update push rules for all projects To update the push rules to be the same for all projects, use the [Rails console](../../../administration/operations/rails_console.md#starting-a-rails-console-session), or write a script to update each project using the [push rules API endpoint](../../../api/project_push_rules.md). For example, to enable **Check whether the commit author is a GitLab user** and **Do not allow users to remove Git tags with `git push`** checkboxes, and create a filter for allowing commits from a specific email domain only through rails console: {{< alert type="warning" >}} Commands that change data can cause damage if not run correctly or under the right conditions. Always run commands in a test environment first and have a backup instance ready to restore. {{< /alert >}} ``` ruby Project.find_each do |p| pr = p.push_rule || PushRule.new(project: p) # Check whether the commit author is a GitLab user pr.member_check = true # Do not allow users to remove Git tags with `git push` pr.deny_delete_tag = true # Commit author's email pr.author_email_regex = '@domain\.com$' pr.save! end ```
--- stage: Create group: Source Code info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments description: Use push rules to control the content and format of Git commits your repository accepts. Set standards for commit messages, and block secrets or credentials from being added accidentally. title: Push rules breadcrumbs: - doc - user - project - repository --- {{< details >}} - Tier: Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} {{< history >}} - Maximum regular expression length for push rules [changed](https://gitlab.com/gitlab-org/gitlab/-/issues/411901) from 255 to 511 characters in GitLab 16.3. {{< /history >}} Push rules are [`pre-receive` Git hooks](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks#:~:text=pre%2Dreceive,with%20the%20push.) you can enable in a user-friendly interface. Push rules give you more control over what can and can't be pushed to your repository. While GitLab offers [protected branches](branches/protected.md), you may need more specific rules, such as: - Evaluating the contents of a commit. - Confirming commit messages match expected formats. - Enforcing [branch name rules](branches/_index.md#name-your-branch). - Evaluating the details of files. - Preventing Git tag removal. - Requiring signed commits. GitLab uses [RE2 syntax](https://github.com/google/re2/wiki/Syntax) for regular expressions in push rules. You can test them at the [regex101 regex tester](https://regex101.com/). Each regular expression is limited to 511 characters. For custom push rules use [server hooks](../../../administration/server_hooks.md). ## Enable global push rules You can create push rules for all new projects to inherit, but they can be overridden in a project or [group](../../group/access_and_permissions.md#group-push-rules). All projects created after you configure global push rules inherit this configuration. However, each existing project must be updated manually, using the process described in [Override global push rules per project](#override-global-push-rules-per-project). Prerequisites: - You must be an administrator. To create global push rules: 1. On the left sidebar, at the bottom, select **Admin**. 1. Select **Push rules**. 1. Expand **Push rules**. 1. Set the rule you want. 1. Select **Save push rules**. ## Override global push rules per project The push rule of an individual project overrides the global push rule. To override global push rules for a specific project, or to update the rules for an existing project to match new global push rules: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Repository**. 1. Expand **Push rules**. 1. Set the rule you want. 1. Select **Save push rules**. ## Verify users Use these rules to validate users who make commits. {{< alert type="note" >}} These push rules apply only to commits and not [tags](tags/_index.md). {{< /alert >}} - **Reject unverified users**: The committer email must match one of the user's [verified email addresses](../../profile/_index.md#add-emails-to-your-user-profile) or [private commit email address](../../profile/_index.md#use-an-automatically-generated-private-commit-email). - **Reject inconsistent user name**: The commit author name must match the user's GitLab account name. - **Check whether the commit author is a GitLab user**: Both the commit author and committer email addresses must match a GitLab user's [verified email addresses](../../profile/_index.md#add-emails-to-your-user-profile). - **Commit author's email**: Both the author and committer email addresses must match the regular expression. To allow any email address, leave empty. When using [bot users for projects](../../project/settings/project_access_tokens.md#bot-users-for-projects) or [bot users for groups](../../group/settings/group_access_tokens.md#bot-users-for-groups), you must add the generated email suffix so that bot tokens can commit and push changes. ## Validate commit messages Use these rules for your commit messages: - **Require expression in commit messages**: Messages must match the expression. To allow any commit message, leave empty. Uses multiline mode, which can be disabled by using `(?-m)`. Some validation examples: - `JIRA\-\d+` requires every commit to reference a Jira issue, like `Refactored css. Fixes JIRA-123`. - `[[:^punct:]]\b$` rejects a commit if the final character is a punctuation mark. The word boundary character (`\b`) prevents false negatives, because Git adds a newline character (`\n`) to the end of the commit message. Commit messages created in GitLab UI set `\r\n` as a newline character. Use `(\r\n?|\n)` instead of `\n` in your regular expression to correctly match it. For example, given the following multi-line commit description: ```plaintext JIRA: Description ``` You can validate it with this regular expression: `JIRA:(\r\n?|\n)\w+`. - **Reject expression in commit messages**: Commit messages must not match the expression. To allow any commit message, leave empty. Uses multiline mode, which can be disabled by using `(?-m)`. ## Validate branch names To validate your branch names, enter a regular expression for **Branch name**. To allow any branch name, leave empty. Your [default branch](branches/default.md) is always allowed. Certain formats of branch names are restricted by default for security purposes. Names with 40 hexadecimal characters, similar to Git commit hashes, are prohibited. Some validation examples: - Branches must start with `JIRA-`. ```plaintext ^JIRA- ``` - Branches must end with `-JIRA`. ```plaintext -JIRA$ ``` - Branches must be between `4` and `15` characters long, accepting only lowercase letters, numbers and dashes. ```plaintext ^[a-z0-9\\-]{4,15}$ ``` ## Prevent unintended consequences Use these rules to prevent unintended consequences. - **Reject unsigned commits**: Commit [must be signed](signed_commits/_index.md). This rule can block some legitimate commits [created in the Web IDE](#reject-unsigned-commits-push-rule-disables-web-ide), and allow [unsigned commits to appear in commit history](#unsigned-commits-appear-in-commit-history). - **Do not allow users to remove Git tags with `git push`**: Users cannot use `git push` to remove Git tags. ## Validate files Use these rules to validate files contained in the commit. - **Prevent pushing secret files**: Files must not contain [secrets](#prevent-pushing-secrets-to-the-repository). - **Prohibited filenames**: Files that do not exist in the repository must not match the regular expression. To allow all filenames, leave empty. See [common examples](#prohibit-files-by-name). - **Maximum file size**: Added or updated files must not exceed this file size (in MB). To allow files of any size, set to `0`. Files tracked by Git LFS are exempted. ### Prevent pushing secrets to the repository Never commit secrets, such as credential files and SSH private keys, to a version control system. In GitLab, you can use a predefined list of files to block those files from a repository. Merge requests that contain a file that matches the list are blocked. This push rule does not restrict files already committed to the repository. You must update the configuration of existing projects to use the rule, using the process described in [Override global push rules per project](#override-global-push-rules-per-project). Files blocked by this rule are listed below. For a complete list of criteria, refer to [`files_denylist.yml`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/lib/gitlab/checks/files_denylist.yml). - AWS CLI credential blobs: - `.aws/credentials` - `aws/credentials` - `homefolder/aws/credentials` - Private RSA SSH keys: - `/ssh/id_rsa` - `/.ssh/personal_rsa` - `/config/server_rsa` - `id_rsa` - `.id_rsa` - Private DSA SSH keys: - `/ssh/id_dsa` - `/.ssh/personal_dsa` - `/config/server_dsa` - `id_dsa` - `.id_dsa` - Private ED25519 SSH keys: - `/ssh/id_ed25519` - `/.ssh/personal_ed25519` - `/config/server_ed25519` - `id_ed25519` - `.id_ed25519` - Private ECDSA SSH keys: - `/ssh/id_ecdsa` - `/.ssh/personal_ecdsa` - `/config/server_ecdsa` - `id_ecdsa` - `.id_ecdsa` - Private ECDSA_SK SSH keys: - `/ssh/id_ecdsa_sk` - `/.ssh/personal_ecdsa_sk` - `/config/server_ecdsa_sk` - `id_ecdsa_sk` - `.id_ecdsa_sk` - Private ED25519_SK SSH keys: - `/ssh/id_ed25519_sk` - `/.ssh/personal_ed25519_sk` - `/config/server_ed25519_sk` - `id_ed25519_sk` - `.id_ed25519_sk` - Any files ending with these suffixes: - `*.pem` - `*.key` - `*.history` - `*_history` ### Prohibit files by name In Git, filenames include both the file's name, and all directories preceding the name. When you `git push`, each filename in the push is compared to the regular expression in **Prohibited filenames**. {{< alert type="note" >}} This feature uses [RE2 syntax](https://github.com/google/re2/wiki/Syntax), which does not support positive or negative lookaheads. {{< /alert >}} The regular expression can: - Match file names in any location in your repository. - Match file names in specific locations. - Match partial file names. - Exclude specific file types by extension. - Combine multiple expressions to exclude several patterns. ### Regular expression examples These examples use common regex string boundary patterns: - `^`: Matches the beginning of a string. - `$`: Matches the end of a string. - `\.`: Matches a literal period character. The backslash escapes the period. - `\/`: Matches a literal forward slash. The backslash escapes the forward slash. #### Prevent specific file types - To prevent pushing `.exe` files to any location in the repository: ```plaintext \.exe$ ``` #### Prevent specific files - To prevent pushing a specific configuration file: - In the repository root: ```plaintext ^config\.yml$ ``` - In a specific directory: ```plaintext ^directory-name\/config\.yml$ ``` - In any location - This example prevents pushing any file named `install.exe`: ```plaintext (^|\/)install\.exe$ ``` #### Combine patterns You can combine multiple patterns into one expression. This example combines all the previous expressions: ```plaintext (\.exe|^config\.yml|^directory-name\/config\.yml|(^|\/)install\.exe)$ ``` ## Require signed commits [Signed commits](signed_commits/_index.md) are digital signatures used to verify authenticity. Use the **Reject unsigned commits** push rule to require all commits to have cryptographic signatures. When you enable this rule: - All new commits pushed to the repository must contain a valid cryptographic signature. - The signature must be created using a supported signing method (GPG, SSH, or X.509). - Commits without any signature are rejected at push time. - Commits with invalid or corrupted signatures are rejected. To enable the **Reject unsigned commits** push rule: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Repository**. 1. Expand **Push rules**. 1. Select **Reject unsigned commits**. 1. Select **Save push rules**. ## Reject commits that aren't DCO certified Commits signed with the [Developer Certificate of Origin](https://developercertificate.org/) (DCO) certify the contributor wrote, or has the right to submit, the code contributed in that commit. You can require all commits to your project to comply with the DCO. This push rule requires a `Signed-off-by:` trailer in every commit message, and rejects any commits that lack it. ## Related topics - [Git server hooks](../../../administration/server_hooks.md) (previously called server hooks), to create complex custom push rules - [Signed commits](signed_commits/_index.md) - [Protected branches](branches/protected.md) - [Secret detection](../../application_security/secret_detection/_index.md) ## Troubleshooting ### Reject unsigned commits push rule disables Web IDE If a project has the **Reject unsigned commits** push rule, the user cannot create commits through the GitLab Web IDE. To allow committing through the Web IDE on a project with this push rule, a GitLab administrator must disable the feature flag `reject_unsigned_commits_by_gitlab` [with a flag](../../../administration/feature_flags/_index.md). ```ruby Feature.disable(:reject_unsigned_commits_by_gitlab) ``` ### Unsigned commits appear in commit history The **Reject unsigned commits** push rule ignores commits that are authenticated and created by GitLab (either through the UI or API). When this push rule is enabled, unsigned commits might still appear in the commit history if a commit was created in GitLab itself. As expected, commits created outside GitLab and pushed to the repository are rejected. For more information, see [issue #5361](https://gitlab.com/gitlab-org/gitaly/-/issues/5361). ### Bulk update push rules for all projects To update the push rules to be the same for all projects, use the [Rails console](../../../administration/operations/rails_console.md#starting-a-rails-console-session), or write a script to update each project using the [push rules API endpoint](../../../api/project_push_rules.md). For example, to enable **Check whether the commit author is a GitLab user** and **Do not allow users to remove Git tags with `git push`** checkboxes, and create a filter for allowing commits from a specific email domain only through rails console: {{< alert type="warning" >}} Commands that change data can cause damage if not run correctly or under the right conditions. Always run commands in a test environment first and have a backup instance ready to restore. {{< /alert >}} ``` ruby Project.find_each do |p| pr = p.push_rule || PushRule.new(project: p) # Check whether the commit author is a GitLab user pr.member_check = true # Do not allow users to remove Git tags with `git push` pr.deny_delete_tag = true # Commit author's email pr.author_email_regex = '@domain\.com$' pr.save! end ```
https://docs.gitlab.com/user/project/code_explain
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/code_explain.md
2025-08-13
doc/user/project/repository
[ "doc", "user", "project", "repository" ]
code_explain.md
Create
Code Creation
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Explain code in a file
null
{{< details >}} - Tier: Premium, Ultimate - Add-on: GitLab Duo Pro or Enterprise, GitLab Duo with Amazon Q - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated - LLM for GitLab Self-Managed, GitLab Dedicated: Anthropic [Claude 3.5 Sonnet](https://console.cloud.google.com/vertex-ai/publishers/anthropic/model-garden/claude-3-5-sonnet) - LLM for GitLab.com: Anthropic [Claude 4.0 Sonnet](https://console.cloud.google.com/vertex-ai/publishers/anthropic/model-garden/claude-sonnet-4) - LLM for Amazon Q: Amazon Q Developer - Available on [GitLab Duo with self-hosted models](../../../administration/gitlab_duo_self_hosted/_index.md): Yes {{< /details >}} {{< history >}} - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/issues/429915) in GitLab 16.8. - Changed to require GitLab Duo add-on in GitLab 17.6 and later. {{< /history >}} If you spend a lot of time trying to understand code that others have created, or you struggle to understand code written in a language you are not familiar with, you can ask GitLab Duo to explain the code to you. Prerequisites: - You must belong to at least one group with the [experiment and beta features setting](../../gitlab_duo/turn_on_off.md#turn-on-beta-and-experimental-features) enabled. - You must have access to view the project. To explain the code in a file: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select a file that contains code. 1. Select the lines you want explained. 1. On the left side, select the question mark ({{< icon name="question" >}}). You might have to scroll to the first line of your selection to view it. ![explain code in a file](img/explain_code_v17_1.png) Duo Chat explains the code. It might take a moment for the explanation to be generated. If you'd like, you can provide feedback about the quality of the explanation. We cannot guarantee that the large language model produces results that are correct. Use the explanation with caution. You can also explain code in: - A [merge request](../merge_requests/changes.md#explain-code-in-a-merge-request). - The [IDE](../../gitlab_duo_chat/examples.md#explain-selected-code).
--- stage: Create group: Code Creation info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments title: Explain code in a file breadcrumbs: - doc - user - project - repository --- {{< details >}} - Tier: Premium, Ultimate - Add-on: GitLab Duo Pro or Enterprise, GitLab Duo with Amazon Q - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated - LLM for GitLab Self-Managed, GitLab Dedicated: Anthropic [Claude 3.5 Sonnet](https://console.cloud.google.com/vertex-ai/publishers/anthropic/model-garden/claude-3-5-sonnet) - LLM for GitLab.com: Anthropic [Claude 4.0 Sonnet](https://console.cloud.google.com/vertex-ai/publishers/anthropic/model-garden/claude-sonnet-4) - LLM for Amazon Q: Amazon Q Developer - Available on [GitLab Duo with self-hosted models](../../../administration/gitlab_duo_self_hosted/_index.md): Yes {{< /details >}} {{< history >}} - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/issues/429915) in GitLab 16.8. - Changed to require GitLab Duo add-on in GitLab 17.6 and later. {{< /history >}} If you spend a lot of time trying to understand code that others have created, or you struggle to understand code written in a language you are not familiar with, you can ask GitLab Duo to explain the code to you. Prerequisites: - You must belong to at least one group with the [experiment and beta features setting](../../gitlab_duo/turn_on_off.md#turn-on-beta-and-experimental-features) enabled. - You must have access to view the project. To explain the code in a file: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select a file that contains code. 1. Select the lines you want explained. 1. On the left side, select the question mark ({{< icon name="question" >}}). You might have to scroll to the first line of your selection to view it. ![explain code in a file](img/explain_code_v17_1.png) Duo Chat explains the code. It might take a moment for the explanation to be generated. If you'd like, you can provide feedback about the quality of the explanation. We cannot guarantee that the large language model produces results that are correct. Use the explanation with caution. You can also explain code in: - A [merge request](../merge_requests/changes.md#explain-code-in-a-merge-request). - The [IDE](../../gitlab_duo_chat/examples.md#explain-selected-code).
https://docs.gitlab.com/user/project/forking_workflow
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/forking_workflow.md
2025-08-13
doc/user/project/repository
[ "doc", "user", "project", "repository" ]
forking_workflow.md
Create
Source Code
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Forks
Fork a Git repository when you want to contribute changes back to an upstream repository you don't have permission to contribute to directly.
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} A fork is a personal copy of another Git repository, placed in the namespace of your choice. Your copy contains the upstream repository's content, including all branches, tags, and CI/CD job configurations. You can create merge requests from your fork to target the upstream repository. Individual commits can also be [cherry-picked](../merge_requests/cherry_pick_changes.md) from your fork into the upstream repository. If you have write access to the original repository, you don't need a fork. Instead, use branches to manage your work. If you don't have write access to a repository you want to contribute to, fork it. Make your changes in your fork, then submit them through a merge request to the upstream repository. To create a [confidential merge request](../merge_requests/confidential.md), use a personal fork of a public repository. {{< alert type="note" >}} If the upstream project is archived, the fork relationship is automatically removed. Merge requests that were closed due to a broken fork relationship are not reopened if the fork relationship is later restored. For more information, see [Archive a project](../working_with_projects.md#archive-a-project). {{< /alert >}} ## Create a fork {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/24894) in GitLab 16.6. {{< /history >}} To fork an existing project in GitLab: 1. On the project's homepage, in the upper-right corner, select **Fork** ({{< icon name="fork" >}}). 1. Optional. Edit the **Project name**. 1. For **Project URL**, select the [namespace](../../namespace/_index.md) your fork should belong to. 1. Add a **Project slug**. This value becomes part of the URL to your fork. It must be unique in the namespace. 1. Optional. Add a **Project description**. 1. Select one of the **Branches to include** options: - **All branches** (default). - **Only the default branch**. Uses the `--single-branch` and `--no-tags` [Git options](https://git-scm.com/docs/git-clone). 1. Select the **Visibility level** for your fork. For more information about visibility levels, read [Project and group visibility](../../public_access.md). 1. Select **Fork project**. GitLab creates your fork, redirects you to the new fork's page, and logs the fork's creation in the [audit log](../../compliance/audit_event_types.md). If you intend to contribute changes upstream frequently, consider setting a [default target](../merge_requests/creating_merge_requests.md#set-the-default-target-project) for your fork. ## Update your fork A fork can fall out of sync with its upstream repository, and require an update: - **Ahead**: Your fork contains new commits not present in the upstream repository. To sync your fork, create a merge request to push your changes to the upstream repository. - **Behind**: The upstream repository contains new commits not present in your fork. To sync your fork, pull the new commits into your fork. - **Ahead and behind**: Both the upstream repository and your fork contain new commits not present in the other. To fully sync your fork, create a merge request to push your changes up, and pull the upstream repository's new changes into your fork. To sync your fork with its upstream repository, update it from the GitLab UI or the command line. GitLab Premium and Ultimate tiers can also automate updates by [configuring forks as pull mirrors](#with-repository-mirroring) of the upstream repository. ### From the UI {{< history >}} - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/issues/330243) in GitLab 16.0. Feature flag `synchronize_fork` removed. {{< /history >}} Prerequisites: - You must create your fork from an [unprotected branch](branches/protected.md) in upstream repository. To update your fork from the GitLab UI: 1. On the left sidebar, select **Search or go to**. 1. Select **View all my projects**. 1. Select the fork you want to update. 1. Below the dropdown list for branch name, find the **Forked from** ({{< icon name="fork" >}}) information box to determine if your fork is ahead, behind, or both. In this example, the fork is behind the upstream repository: ![Information box for a fork some commits behind the upstream repository](img/update-fork_v16_6.png) 1. If your fork is **ahead** of the upstream repository, select **Create merge request** to propose adding your fork's changes to the upstream repository. 1. If your fork is **behind** the upstream repository, select **Update fork** to pull changes from the upstream repository. 1. If your fork is **ahead and behind** the upstream repository, you can update from the UI only if GitLab detects no merge conflicts: - If your fork contains no merge conflicts, you can select **Create merge request** to propose pushing your changes to the upstream repository, **Update fork** to pull changes down to your fork, or both. The type of changes in your fork determine which actions are appropriate. - If your fork contains merge conflicts, GitLab shows a step-by-step guide to update your fork from the command line. ### From the command line You can also choose to update your fork from the command line. Prerequisites: - You must [download and install the Git client](../../../topics/git/how_to_install_git/_index.md) on your local machine. - You must [create a fork](#create-a-fork) of the repository you want to update. To update your fork from the command line, follow the instruction in [use Git to update a fork](../../../topics/git/forks.md). ### With repository mirroring {{< details >}} - Tier: Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} A fork can be configured as a mirror of the upstream if all these conditions are met: 1. Your subscription is GitLab Premium or GitLab Ultimate. 1. You create all changes in branches (not `main`). 1. You do not work on [merge requests for confidential issues](../merge_requests/confidential.md), which requires changes to `main`. [Repository mirroring](mirror/_index.md) keeps your fork synced with the original repository. This method updates your fork once per hour, with no manual `git pull` required. For instructions, read [Configure pull mirroring](mirror/pull.md#configure-pull-mirroring). {{< alert type="warning" >}} With mirroring, before approving a merge request, you are asked to sync. You should automate it. {{< /alert >}} ## Merge changes back upstream When you are ready to send your code back to the upstream repository, create a new merge request as described in [When you work in a fork](../merge_requests/creating_merge_requests.md#when-you-work-in-a-fork). When successfully merged, your changes are added to the repository and branch you're merging into. ## Unlink a fork Removing a fork relationship unlinks your fork from its upstream repository. Your fork then becomes an independent repository. Prerequisites: - You must be a project owner to unlink a fork. {{< alert type="warning" >}} If you remove a fork relationship, you can't send new merge requests to the source. Any existing open merge requests from the fork to the source are also closed. If anyone has forked your repository, their fork also loses the relationship. To restore the fork relationship, [use the API](../../../api/project_forks.md#create-a-fork-relationship-between-projects). {{< /alert >}} To remove a fork relationship: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > General**. 1. Expand **Advanced**. 1. In the **Remove fork relationship** section, select **Remove fork relationship**. 1. To confirm, enter the project path and select **Confirm**. GitLab logs the unlink operation in the [audit log](../../compliance/audit_event_types.md). When you unlink a fork that uses a [hashed storage pool](../../../administration/repository_storage_paths.md#hashed-object-pools) to share objects with another repository: - All objects are copied from the pool into your fork. - After the copy process completes, no further updates from the storage pool are propagated to your fork. ## Check a fork's storage usage Your fork uses a deduplication strategy to reduce the storage space it needs. Your fork can access the object pool connected to the source repository. For more information and to check the storage use, see [View project fork storage usage](../../storage_usage_quotas.md#view-project-fork-storage-usage). ## Related topics - GitLab community forum: [Refreshing a fork](https://forum.gitlab.com/t/refreshing-a-fork/32469) - [Prevent project forking outside group](../../group/access_and_permissions.md#prevent-project-forking-outside-group) - [Understand how Git LFS works with forks](../../../topics/git/lfs/_index.md#understand-how-git-lfs-works-with-forks) ## Troubleshooting ### Error: `An error occurred while forking the project. Please try again` This error can be due to a mismatch in instance runner settings between the forked project and the new namespace. See [Forks](../../../ci/runners/configure_runners.md#using-instance-runners-in-forked-projects) in the Runner documentation for more information. ### Removing fork relationship fails If removing the fork through the UI or API is not working, you can attempt the fork relationship removal in a [Rails console session](../../../administration/operations/rails_console.md#starting-a-rails-console-session): ```ruby p = Project.find_by_full_path('<project_path>') u = User.find_by_username('<username>') Projects::UnlinkForkService.new(p, u).execute ```
--- stage: Create group: Source Code info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments description: Fork a Git repository when you want to contribute changes back to an upstream repository you don't have permission to contribute to directly. title: Forks breadcrumbs: - doc - user - project - repository --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} A fork is a personal copy of another Git repository, placed in the namespace of your choice. Your copy contains the upstream repository's content, including all branches, tags, and CI/CD job configurations. You can create merge requests from your fork to target the upstream repository. Individual commits can also be [cherry-picked](../merge_requests/cherry_pick_changes.md) from your fork into the upstream repository. If you have write access to the original repository, you don't need a fork. Instead, use branches to manage your work. If you don't have write access to a repository you want to contribute to, fork it. Make your changes in your fork, then submit them through a merge request to the upstream repository. To create a [confidential merge request](../merge_requests/confidential.md), use a personal fork of a public repository. {{< alert type="note" >}} If the upstream project is archived, the fork relationship is automatically removed. Merge requests that were closed due to a broken fork relationship are not reopened if the fork relationship is later restored. For more information, see [Archive a project](../working_with_projects.md#archive-a-project). {{< /alert >}} ## Create a fork {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/24894) in GitLab 16.6. {{< /history >}} To fork an existing project in GitLab: 1. On the project's homepage, in the upper-right corner, select **Fork** ({{< icon name="fork" >}}). 1. Optional. Edit the **Project name**. 1. For **Project URL**, select the [namespace](../../namespace/_index.md) your fork should belong to. 1. Add a **Project slug**. This value becomes part of the URL to your fork. It must be unique in the namespace. 1. Optional. Add a **Project description**. 1. Select one of the **Branches to include** options: - **All branches** (default). - **Only the default branch**. Uses the `--single-branch` and `--no-tags` [Git options](https://git-scm.com/docs/git-clone). 1. Select the **Visibility level** for your fork. For more information about visibility levels, read [Project and group visibility](../../public_access.md). 1. Select **Fork project**. GitLab creates your fork, redirects you to the new fork's page, and logs the fork's creation in the [audit log](../../compliance/audit_event_types.md). If you intend to contribute changes upstream frequently, consider setting a [default target](../merge_requests/creating_merge_requests.md#set-the-default-target-project) for your fork. ## Update your fork A fork can fall out of sync with its upstream repository, and require an update: - **Ahead**: Your fork contains new commits not present in the upstream repository. To sync your fork, create a merge request to push your changes to the upstream repository. - **Behind**: The upstream repository contains new commits not present in your fork. To sync your fork, pull the new commits into your fork. - **Ahead and behind**: Both the upstream repository and your fork contain new commits not present in the other. To fully sync your fork, create a merge request to push your changes up, and pull the upstream repository's new changes into your fork. To sync your fork with its upstream repository, update it from the GitLab UI or the command line. GitLab Premium and Ultimate tiers can also automate updates by [configuring forks as pull mirrors](#with-repository-mirroring) of the upstream repository. ### From the UI {{< history >}} - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/issues/330243) in GitLab 16.0. Feature flag `synchronize_fork` removed. {{< /history >}} Prerequisites: - You must create your fork from an [unprotected branch](branches/protected.md) in upstream repository. To update your fork from the GitLab UI: 1. On the left sidebar, select **Search or go to**. 1. Select **View all my projects**. 1. Select the fork you want to update. 1. Below the dropdown list for branch name, find the **Forked from** ({{< icon name="fork" >}}) information box to determine if your fork is ahead, behind, or both. In this example, the fork is behind the upstream repository: ![Information box for a fork some commits behind the upstream repository](img/update-fork_v16_6.png) 1. If your fork is **ahead** of the upstream repository, select **Create merge request** to propose adding your fork's changes to the upstream repository. 1. If your fork is **behind** the upstream repository, select **Update fork** to pull changes from the upstream repository. 1. If your fork is **ahead and behind** the upstream repository, you can update from the UI only if GitLab detects no merge conflicts: - If your fork contains no merge conflicts, you can select **Create merge request** to propose pushing your changes to the upstream repository, **Update fork** to pull changes down to your fork, or both. The type of changes in your fork determine which actions are appropriate. - If your fork contains merge conflicts, GitLab shows a step-by-step guide to update your fork from the command line. ### From the command line You can also choose to update your fork from the command line. Prerequisites: - You must [download and install the Git client](../../../topics/git/how_to_install_git/_index.md) on your local machine. - You must [create a fork](#create-a-fork) of the repository you want to update. To update your fork from the command line, follow the instruction in [use Git to update a fork](../../../topics/git/forks.md). ### With repository mirroring {{< details >}} - Tier: Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} A fork can be configured as a mirror of the upstream if all these conditions are met: 1. Your subscription is GitLab Premium or GitLab Ultimate. 1. You create all changes in branches (not `main`). 1. You do not work on [merge requests for confidential issues](../merge_requests/confidential.md), which requires changes to `main`. [Repository mirroring](mirror/_index.md) keeps your fork synced with the original repository. This method updates your fork once per hour, with no manual `git pull` required. For instructions, read [Configure pull mirroring](mirror/pull.md#configure-pull-mirroring). {{< alert type="warning" >}} With mirroring, before approving a merge request, you are asked to sync. You should automate it. {{< /alert >}} ## Merge changes back upstream When you are ready to send your code back to the upstream repository, create a new merge request as described in [When you work in a fork](../merge_requests/creating_merge_requests.md#when-you-work-in-a-fork). When successfully merged, your changes are added to the repository and branch you're merging into. ## Unlink a fork Removing a fork relationship unlinks your fork from its upstream repository. Your fork then becomes an independent repository. Prerequisites: - You must be a project owner to unlink a fork. {{< alert type="warning" >}} If you remove a fork relationship, you can't send new merge requests to the source. Any existing open merge requests from the fork to the source are also closed. If anyone has forked your repository, their fork also loses the relationship. To restore the fork relationship, [use the API](../../../api/project_forks.md#create-a-fork-relationship-between-projects). {{< /alert >}} To remove a fork relationship: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > General**. 1. Expand **Advanced**. 1. In the **Remove fork relationship** section, select **Remove fork relationship**. 1. To confirm, enter the project path and select **Confirm**. GitLab logs the unlink operation in the [audit log](../../compliance/audit_event_types.md). When you unlink a fork that uses a [hashed storage pool](../../../administration/repository_storage_paths.md#hashed-object-pools) to share objects with another repository: - All objects are copied from the pool into your fork. - After the copy process completes, no further updates from the storage pool are propagated to your fork. ## Check a fork's storage usage Your fork uses a deduplication strategy to reduce the storage space it needs. Your fork can access the object pool connected to the source repository. For more information and to check the storage use, see [View project fork storage usage](../../storage_usage_quotas.md#view-project-fork-storage-usage). ## Related topics - GitLab community forum: [Refreshing a fork](https://forum.gitlab.com/t/refreshing-a-fork/32469) - [Prevent project forking outside group](../../group/access_and_permissions.md#prevent-project-forking-outside-group) - [Understand how Git LFS works with forks](../../../topics/git/lfs/_index.md#understand-how-git-lfs-works-with-forks) ## Troubleshooting ### Error: `An error occurred while forking the project. Please try again` This error can be due to a mismatch in instance runner settings between the forked project and the new namespace. See [Forks](../../../ci/runners/configure_runners.md#using-instance-runners-in-forked-projects) in the Runner documentation for more information. ### Removing fork relationship fails If removing the fork through the UI or API is not working, you can attempt the fork relationship removal in a [Rails console session](../../../administration/operations/rails_console.md#starting-a-rails-console-session): ```ruby p = Project.find_by_full_path('<project_path>') u = User.find_by_username('<username>') Projects::UnlinkForkService.new(p, u).execute ```
https://docs.gitlab.com/user/project/repository_size
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/repository_size.md
2025-08-13
doc/user/project/repository
[ "doc", "user", "project", "repository" ]
repository_size.md
Create
Source Code
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Repository size
Understand repository size calculation, limits, and methods to reduce Git repository storage.
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} The size of a Git repository can significantly impact performance and storage costs. It can differ slightly from one instance to another due to compression, housekeeping, and other factors. ## Size calculation The project overview page shows the size of all files in the repository, including repository files, artifacts, and LFS. This size is updated every 15 minutes. The size of a repository is determined by computing the accumulated size of all files in the repository. This calculation is similar to executing `du --summarize --bytes` on your repository's [hashed storage path](../../../administration/repository_storage_paths.md). ## Size and storage limits Administrators can set a [repository size limit](../../../administration/settings/account_and_limit_settings.md#repository-size-limit) for GitLab Self-Managed. For GitLab SaaS, size limits are [pre-defined](../../gitlab_com/_index.md#account-and-limit-settings). When a project reaches its size limit, certain operations like pushing, creating merge requests, and uploading LFS objects are restricted. ## Methods to reduce repository size The following methods are available to reduce the size of a repository: - [Purge files from history](#purge-files-from-repository-history): Remove large files from the entire Git history. - [Clean up repository](#clean-up-repository): Remove internal Git references and unreferenced objects. - [Remove blobs](#remove-blobs): Permanently delete blobs containing sensitive or confidential information. Before you reduce your repository size, you should [create a full backup of your repository](../../../administration/backup_restore/_index.md). These methods are irreversible and can potentially affect your project's history and data. When you reduce your repository size with any of the available methods, you don't need to block access to your project. You can perform these operations while your project remains accessible to users. These methods don't have any known performance implications and don't cause downtime. However, you should perform these actions during periods of low activity to minimize the potential impact on users. ### Purge files from repository history You can [purge files with `git filter-repo`](../../../topics/git/repository.md#purge-files-from-repository-history) to remove large files from Git history. Do not use this method to remove sensitive data like passwords or keys. Instead use [Remove blobs](#remove-blobs). This process: - Modifies the entire Git history. - Might affect open merge requests. - Might affect existing pipelines. - Requires re-cloning of local repositories. - Does not affect LFS objects. - Does not specify commit signatures. - Is irreversible. {{< alert type="note" >}} Information about commits, including file content, is cached in the database, and remains visible even after they have been removed from the repository. {{< /alert >}} ### Clean up repository Use this method to remove internal Git references and unreferenced objects from your repository. Do not use this method to remove sensitive data. Instead use [Remove blobs](#remove-blobs). This process: - Runs `git gc --prune=30.minutes.ago` to remove unreferenced objects. - Unlinks unused LFS objects, freeing storage space. - Recalculates repository size on disk. - Is irreversible. {{< alert type="warning" >}} Removing internal Git references causes associated merge request commits, pipelines, and change details to become unavailable. {{< /alert >}} Prerequisites: - The list of objects to remove. Use the [`git filter-repo`](https://github.com/newren/git-filter-repo) to produce a list of objects in a`commit-map` file. To clean up a repository: 1. On the left sidebar, select **Search or go to** and find your project. 1. Go to **Settings > Repository**. 1. Expand **Repository maintenance**. 1. Upload the list of objects to remove. For example, the `commit-map` file in the `filter-repo` directory. If your `commit-map` file is too large, the background cleanup process might time out and fail. As a result, the repository size isn't reduced as expected. To address this, split the file and upload it in parts. Start with `20000` and reduce as needed. For example: ```shell split -l 20000 filter-repo/commit-map filter-repo/commit-map- ``` 1. Select **Start cleanup**. GitLab sends an email notification with the recalculated repository size after the cleanup completes. ### Remove blobs {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/450701) in GitLab 17.1 [with a flag](../../../administration/feature_flags/_index.md) named `rewrite_history_ui`. Disabled by default. - [Enabled on GitLab.com](https://gitlab.com/gitlab-org/gitlab/-/issues/462999) in GitLab 17.2. - [Enabled on GitLab Self-Managed and GitLab Dedicated](https://gitlab.com/gitlab-org/gitlab/-/issues/462999) in GitLab 17.3. - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/issues/472018) in GitLab 17.9. Feature flag `rewrite_history_ui` removed. {{< /history >}} A Git binary large object (blob) stores file contents without metadata. Each blob has a unique SHA hash that represents a specific version of a file in the repository. Use this method to permanently delete blobs that contain sensitive or confidential information. This process: - Rewrites Git history. - Drops commit signatures. - Might cause open merge requests to fail to merge, requiring a manual rebase. - Might cause pipelines referencing old commit SHAs to break. - Might affect historical tags and branches based on old commit history. - Requires re-cloning of local repositories. - Is irreversible. {{< alert type="note" >}} To replace strings with `***REMOVED***`, see [Redact information](../../../topics/git/undo.md#redact-information). {{< /alert >}} Prerequisites: - You must have the Owner role for the project - [A list of object IDs](#get-a-list-of-object-ids) to remove. - Your project must not be: - A fork of a public upstream project. - A public upstream project with downstream forks. {{< alert type="note" >}} To ensure successful blob removal, consider temporarily restricting repository access during the process. New commits pushed during blob removal can cause the operation to fail. {{< /alert >}} To remove blobs from your repository: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Repository**. 1. Expand **Repository maintenance**. 1. Select **Remove blobs**. 1. Enter a list of blob IDs to remove, each ID on its own line. 1. Select **Remove blobs**. 1. On the confirmation dialog, enter your project path. 1. Select **Yes, remove blobs**. 1. On the left sidebar, select **Settings > General**. 1. Expand the section labeled **Advanced**. 1. Select **Run housekeeping**. Wait at least 30 minutes for the operation to complete. 1. In the same **Settings > General > Advanced** section, select **Prune unreachable objects**. This operation takes approximately 5-10 minutes to complete. {{< alert type="note" >}} If the project containing the sensitive information has been forked, the housekeeping task might succeed without completing this process. Housekeeping must maintain the integrity of the [special object pool repository](../../../administration/housekeeping.md#object-pool-repositories), which contains the forked data. For help, contact GitLab Support. {{< /alert >}} #### Get a list of object IDs To remove blobs, you need a list of objects to remove. To get these IDs, use the `ls-tree` command or use the [Repositories API list repository tree](../../../api/repositories.md#list-repository-tree) endpoint. The following instructions use the `ls-tree` command. Prerequisites: - The repository must be cloned to your local machine. To get a list of blobs at a given commit or branch sorted by size: 1. Open a terminal and go to your repository directory. 1. Run the following command: ```shell git ls-tree -r -t --long --full-name <COMMIT/BRANCH> | sort -nk 4 ``` Example output: ```plaintext 100644 blob 8150ee86f923548d376459b29afecbe8495514e9 133508 doc/howto/img/remote-development-new-workspace-button.png 100644 blob cde4360b3d3ee4f4c04c998d43cfaaf586f09740 214231 doc/howto/img/dependency_proxy_macos_config_new.png 100644 blob 2ad0e839a709e73a6174e78321e87021b20be445 216452 doc/howto/img/gdk-in-gitpod.jpg 100644 blob 115dd03fc0828a9011f012abbc58746f7c587a05 242304 doc/howto/img/gitpod-button-repository.jpg 100644 blob c41ebb321a6a99f68ee6c353dd0ed29f52c1dc80 491158 doc/howto/img/dependency_proxy_macos_config.png ``` The third column in the output is the object ID of the blob. For example: `8150ee86f923548d376459b29afecbe8495514e9`. ## Troubleshooting ### Incorrect repository statistics shown in the GUI If the repository size or commit number displayed in the GitLab interface differs from the exported `.tar.gz` or local repository: 1. Ask a GitLab administrator to force an update using the Rails console. 1. The administrator should run the following commands: ```ruby p = Project.find_by_full_path('<namespace>/<project>') p.statistics.refresh! ``` 1. To clear project statistics and trigger a recalculation: ```ruby p.repository.expire_all_method_caches UpdateProjectStatisticsWorker.perform_async(p.id, ["commit_count","repository_size","storage_size","lfs_objects_size","container_registry_size"]) ``` 1. To check the total artifact storage space: ```ruby builds_with_artifacts = p.builds.with_downloadable_artifacts.all artifact_storage = 0 builds_with_artifacts.find_each do |build| artifact_storage += build.artifacts_size end puts "#{artifact_storage} bytes" ``` ### Space not being freed after cleanup If you've completed a repository cleanup process but the storage usage remains unchanged: - Be aware that unreachable objects remain in the repository for a two-week grace period. - These objects are not included in exports but still occupy file system space. - After two weeks, these objects are automatically pruned, which updates storage usage statistics. - To expedite this process, ask an administrator to run the ['Prune Unreachable Objects' housekeeping task](../../../administration/housekeeping.md). ### Blobs are not removed When blobs are successfully removed, GitLab adds an entry in the project audit logs and sends an email notification to the person who initiated the action. If the blob removal fails, GitLab sends an email notification to the initiator with the subject `<project_name> | Project history rewrite failure`. The email body contains the full error message. Possible errors and solutions: - `validating object ID: invalid object ID`: The object ID list contains a syntax error or an incorrect object ID. To resolve this: 1. Regenerate the [object IDs list](#get-a-list-of-object-ids). 1. Re-run the [blob removal steps](#remove-blobs). - `source repository checksum altered`: This occurs when someone pushes a commit during the blob removal process. To resolve this: 1. Temporarily block all pushes to the repository. 1. Re-run the [blob removal steps](#remove-blobs). 1. Re-enable pushes after the process completes successfully. ### Repository size limit reached If you've reached the repository size limit: - Try removing some data and making a new commit. - If unsuccessful, consider moving some blobs to [Git LFS](../../../topics/git/lfs/_index.md) or removing old dependency updates from history. - If you still can't push changes, contact your GitLab administrator to temporarily [increase the limit for your project](../../../administration/settings/account_and_limit_settings.md#repository-size-limit). - As a last resort, create a new project and migrate your data. {{< alert type="note" >}} Deleting files in a new commit doesn't reduce repository size immediately, as earlier commits and blobs still exist. To effectively reduce size, you must rewrite history using a tool like [`git filter-repo`](https://github.com/newren/git-filter-repo). {{< /alert >}}
--- stage: Create group: Source Code info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments description: Understand repository size calculation, limits, and methods to reduce Git repository storage. title: Repository size breadcrumbs: - doc - user - project - repository --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} The size of a Git repository can significantly impact performance and storage costs. It can differ slightly from one instance to another due to compression, housekeeping, and other factors. ## Size calculation The project overview page shows the size of all files in the repository, including repository files, artifacts, and LFS. This size is updated every 15 minutes. The size of a repository is determined by computing the accumulated size of all files in the repository. This calculation is similar to executing `du --summarize --bytes` on your repository's [hashed storage path](../../../administration/repository_storage_paths.md). ## Size and storage limits Administrators can set a [repository size limit](../../../administration/settings/account_and_limit_settings.md#repository-size-limit) for GitLab Self-Managed. For GitLab SaaS, size limits are [pre-defined](../../gitlab_com/_index.md#account-and-limit-settings). When a project reaches its size limit, certain operations like pushing, creating merge requests, and uploading LFS objects are restricted. ## Methods to reduce repository size The following methods are available to reduce the size of a repository: - [Purge files from history](#purge-files-from-repository-history): Remove large files from the entire Git history. - [Clean up repository](#clean-up-repository): Remove internal Git references and unreferenced objects. - [Remove blobs](#remove-blobs): Permanently delete blobs containing sensitive or confidential information. Before you reduce your repository size, you should [create a full backup of your repository](../../../administration/backup_restore/_index.md). These methods are irreversible and can potentially affect your project's history and data. When you reduce your repository size with any of the available methods, you don't need to block access to your project. You can perform these operations while your project remains accessible to users. These methods don't have any known performance implications and don't cause downtime. However, you should perform these actions during periods of low activity to minimize the potential impact on users. ### Purge files from repository history You can [purge files with `git filter-repo`](../../../topics/git/repository.md#purge-files-from-repository-history) to remove large files from Git history. Do not use this method to remove sensitive data like passwords or keys. Instead use [Remove blobs](#remove-blobs). This process: - Modifies the entire Git history. - Might affect open merge requests. - Might affect existing pipelines. - Requires re-cloning of local repositories. - Does not affect LFS objects. - Does not specify commit signatures. - Is irreversible. {{< alert type="note" >}} Information about commits, including file content, is cached in the database, and remains visible even after they have been removed from the repository. {{< /alert >}} ### Clean up repository Use this method to remove internal Git references and unreferenced objects from your repository. Do not use this method to remove sensitive data. Instead use [Remove blobs](#remove-blobs). This process: - Runs `git gc --prune=30.minutes.ago` to remove unreferenced objects. - Unlinks unused LFS objects, freeing storage space. - Recalculates repository size on disk. - Is irreversible. {{< alert type="warning" >}} Removing internal Git references causes associated merge request commits, pipelines, and change details to become unavailable. {{< /alert >}} Prerequisites: - The list of objects to remove. Use the [`git filter-repo`](https://github.com/newren/git-filter-repo) to produce a list of objects in a`commit-map` file. To clean up a repository: 1. On the left sidebar, select **Search or go to** and find your project. 1. Go to **Settings > Repository**. 1. Expand **Repository maintenance**. 1. Upload the list of objects to remove. For example, the `commit-map` file in the `filter-repo` directory. If your `commit-map` file is too large, the background cleanup process might time out and fail. As a result, the repository size isn't reduced as expected. To address this, split the file and upload it in parts. Start with `20000` and reduce as needed. For example: ```shell split -l 20000 filter-repo/commit-map filter-repo/commit-map- ``` 1. Select **Start cleanup**. GitLab sends an email notification with the recalculated repository size after the cleanup completes. ### Remove blobs {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/450701) in GitLab 17.1 [with a flag](../../../administration/feature_flags/_index.md) named `rewrite_history_ui`. Disabled by default. - [Enabled on GitLab.com](https://gitlab.com/gitlab-org/gitlab/-/issues/462999) in GitLab 17.2. - [Enabled on GitLab Self-Managed and GitLab Dedicated](https://gitlab.com/gitlab-org/gitlab/-/issues/462999) in GitLab 17.3. - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/issues/472018) in GitLab 17.9. Feature flag `rewrite_history_ui` removed. {{< /history >}} A Git binary large object (blob) stores file contents without metadata. Each blob has a unique SHA hash that represents a specific version of a file in the repository. Use this method to permanently delete blobs that contain sensitive or confidential information. This process: - Rewrites Git history. - Drops commit signatures. - Might cause open merge requests to fail to merge, requiring a manual rebase. - Might cause pipelines referencing old commit SHAs to break. - Might affect historical tags and branches based on old commit history. - Requires re-cloning of local repositories. - Is irreversible. {{< alert type="note" >}} To replace strings with `***REMOVED***`, see [Redact information](../../../topics/git/undo.md#redact-information). {{< /alert >}} Prerequisites: - You must have the Owner role for the project - [A list of object IDs](#get-a-list-of-object-ids) to remove. - Your project must not be: - A fork of a public upstream project. - A public upstream project with downstream forks. {{< alert type="note" >}} To ensure successful blob removal, consider temporarily restricting repository access during the process. New commits pushed during blob removal can cause the operation to fail. {{< /alert >}} To remove blobs from your repository: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Repository**. 1. Expand **Repository maintenance**. 1. Select **Remove blobs**. 1. Enter a list of blob IDs to remove, each ID on its own line. 1. Select **Remove blobs**. 1. On the confirmation dialog, enter your project path. 1. Select **Yes, remove blobs**. 1. On the left sidebar, select **Settings > General**. 1. Expand the section labeled **Advanced**. 1. Select **Run housekeeping**. Wait at least 30 minutes for the operation to complete. 1. In the same **Settings > General > Advanced** section, select **Prune unreachable objects**. This operation takes approximately 5-10 minutes to complete. {{< alert type="note" >}} If the project containing the sensitive information has been forked, the housekeeping task might succeed without completing this process. Housekeeping must maintain the integrity of the [special object pool repository](../../../administration/housekeeping.md#object-pool-repositories), which contains the forked data. For help, contact GitLab Support. {{< /alert >}} #### Get a list of object IDs To remove blobs, you need a list of objects to remove. To get these IDs, use the `ls-tree` command or use the [Repositories API list repository tree](../../../api/repositories.md#list-repository-tree) endpoint. The following instructions use the `ls-tree` command. Prerequisites: - The repository must be cloned to your local machine. To get a list of blobs at a given commit or branch sorted by size: 1. Open a terminal and go to your repository directory. 1. Run the following command: ```shell git ls-tree -r -t --long --full-name <COMMIT/BRANCH> | sort -nk 4 ``` Example output: ```plaintext 100644 blob 8150ee86f923548d376459b29afecbe8495514e9 133508 doc/howto/img/remote-development-new-workspace-button.png 100644 blob cde4360b3d3ee4f4c04c998d43cfaaf586f09740 214231 doc/howto/img/dependency_proxy_macos_config_new.png 100644 blob 2ad0e839a709e73a6174e78321e87021b20be445 216452 doc/howto/img/gdk-in-gitpod.jpg 100644 blob 115dd03fc0828a9011f012abbc58746f7c587a05 242304 doc/howto/img/gitpod-button-repository.jpg 100644 blob c41ebb321a6a99f68ee6c353dd0ed29f52c1dc80 491158 doc/howto/img/dependency_proxy_macos_config.png ``` The third column in the output is the object ID of the blob. For example: `8150ee86f923548d376459b29afecbe8495514e9`. ## Troubleshooting ### Incorrect repository statistics shown in the GUI If the repository size or commit number displayed in the GitLab interface differs from the exported `.tar.gz` or local repository: 1. Ask a GitLab administrator to force an update using the Rails console. 1. The administrator should run the following commands: ```ruby p = Project.find_by_full_path('<namespace>/<project>') p.statistics.refresh! ``` 1. To clear project statistics and trigger a recalculation: ```ruby p.repository.expire_all_method_caches UpdateProjectStatisticsWorker.perform_async(p.id, ["commit_count","repository_size","storage_size","lfs_objects_size","container_registry_size"]) ``` 1. To check the total artifact storage space: ```ruby builds_with_artifacts = p.builds.with_downloadable_artifacts.all artifact_storage = 0 builds_with_artifacts.find_each do |build| artifact_storage += build.artifacts_size end puts "#{artifact_storage} bytes" ``` ### Space not being freed after cleanup If you've completed a repository cleanup process but the storage usage remains unchanged: - Be aware that unreachable objects remain in the repository for a two-week grace period. - These objects are not included in exports but still occupy file system space. - After two weeks, these objects are automatically pruned, which updates storage usage statistics. - To expedite this process, ask an administrator to run the ['Prune Unreachable Objects' housekeeping task](../../../administration/housekeeping.md). ### Blobs are not removed When blobs are successfully removed, GitLab adds an entry in the project audit logs and sends an email notification to the person who initiated the action. If the blob removal fails, GitLab sends an email notification to the initiator with the subject `<project_name> | Project history rewrite failure`. The email body contains the full error message. Possible errors and solutions: - `validating object ID: invalid object ID`: The object ID list contains a syntax error or an incorrect object ID. To resolve this: 1. Regenerate the [object IDs list](#get-a-list-of-object-ids). 1. Re-run the [blob removal steps](#remove-blobs). - `source repository checksum altered`: This occurs when someone pushes a commit during the blob removal process. To resolve this: 1. Temporarily block all pushes to the repository. 1. Re-run the [blob removal steps](#remove-blobs). 1. Re-enable pushes after the process completes successfully. ### Repository size limit reached If you've reached the repository size limit: - Try removing some data and making a new commit. - If unsuccessful, consider moving some blobs to [Git LFS](../../../topics/git/lfs/_index.md) or removing old dependency updates from history. - If you still can't push changes, contact your GitLab administrator to temporarily [increase the limit for your project](../../../administration/settings/account_and_limit_settings.md#repository-size-limit). - As a last resort, create a new project and migrate your data. {{< alert type="note" >}} Deleting files in a new commit doesn't reduce repository size immediately, as earlier commits and blobs still exist. To effectively reduce size, you must rewrite history using a tool like [`git filter-repo`](https://github.com/newren/git-filter-repo). {{< /alert >}}
https://docs.gitlab.com/user/project/repository
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/_index.md
2025-08-13
doc/user/project/repository
[ "doc", "user", "project", "repository" ]
_index.md
Create
Source Code
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Repository
How to create, clone, and use GitLab repositories.
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} Your [repository](https://git-scm.com/book/en/v2/Git-Basics-Getting-a-Git-Repository) is a component of your GitLab project. You store your code in your repository, and track changes to it with version control. Each repository is part of a [GitLab project](../_index.md), and cannot exist without a GitLab project. Your project provides the configuration options for your repository. ## Create a repository To create a repository: - [Create a project](../_index.md) or - [Fork an existing project](forking_workflow.md). ## Add files to a repository You can add files to a repository: - When you [create a project](../_index.md), or - After you create a project, using the following options: - [Web editor](web_editor.md#upload-a-file). - [User Interface (UI)](#add-a-file-from-the-ui). - [Command line](../../../topics/git/add_files.md). ### Add a file from the UI To add or upload a file from the GitLab UI: <!-- Original source for this list: doc/user/project/repository/web_editor.md#upload-a-file --> <!-- For why we duplicated the info, see https://gitlab.com/gitlab-org/gitlab/-/merge_requests/111072#note_1267429478 --> 1. On the left sidebar, select **Search or go to** and find your project. 1. Go to the directory you want to upload the file to. 1. Next to the directory name, select the plus icon ({{< icon name="plus" >}}) > **Upload file**. 1. Drop or upload your file. 1. Enter a commit message. 1. Optional. To create a merge request with your changes, in **Target branch**, enter a branch name that's not your repository's [default branch](branches/default.md). 1. Select **Upload file**. ## Commit changes to a repository You can commit your changes to a branch in the repository. When you use the command line, use [`git commit`](../../../topics/git/commands.md#git-commit). For information about how to use commits to improve communication and collaboration, trigger or skip pipelines, and reverting changes, see [commits](../merge_requests/commits.md). ## Clone a repository You can clone a repository using the: - Command line: - [Clone with SSH](../../../topics/git/clone.md#clone-with-ssh) - [Clone with HTTPS](../../../topics/git/clone.md#clone-with-https) - GitLab UI: - [Clone and open in Apple Xcode](../../../topics/git/clone.md#clone-and-open-in-apple-xcode) - [Clone and open in Visual Studio Code](../../../topics/git/clone.md#clone-and-open-in-visual-studio-code) - [Clone and open in IntelliJ IDEA](../../../topics/git/clone.md#clone-and-open-in-intellij-idea) ## Download repository source code To download a repository's source code as a compressed file: 1. On the left sidebar, select **Search or go to** and find your project. 1. Above the file list, select **Code**. 1. From the options, select the files you want to download: - **Source code**: Download the source code from the current branch you're viewing. Available extensions: `zip`, `tar`, `tar.gz`, and `tar.bz2`. - **Directory**: Download a specific directory. Visible only when you view a subdirectory. Available extensions: `zip`, `tar`, `tar.gz`, and `tar.bz2`. - **Artifacts**: Download the artifacts from the latest CI/CD job. The checksums of generated archives can change even if the repository itself doesn't change. For example, this occurs if Git or a third-party library that GitLab uses changes. ## View repository by Git revision To view all repository files and folders at a specific Git revision, such as a commit SHA, branch name, or tag: 1. On the left sidebar, select **Search or go to** and find your project. 1. At the top, select to open the **Select Git revision** dropdown list. 1. Select or search for a Git revision. You can also view and browse files at a specific Git revision from the [commits](commits/_index.md) page. ## Repository languages GitLab detects programming languages used in the default branch. This information is displayed on the **Project overview** page. ![Repository Languages bar](img/repository_languages_v15_2.png) When new files are added, this information can take up to five minutes to update. ### Add repository languages Not all files are detected and listed on the **Project overview** page. Documentation, vendor code, and [most markup languages](files/_index.md#supported-markup-languages) are excluded. To view a list of supported files and languages, see [supported data types](https://github.com/github/linguist/blob/master/lib/linguist/languages.yml). To change this behavior and include additional file types in the default settings: 1. In your repository's root directory, create a file named `.gitattributes`. 1. Add a line that tells GitLab to include a specific file type. For example, to enable `.proto` files, add the following: ```plaintext *.proto linguist-detectable=true ``` This feature can use excessive CPU. If you experience an issue, see the [Repository Languages: excessive CPU use](files/_index.md#repository-languages-excessive-cpu-use) troubleshooting section. ## Repository contributor analytics You can view a line chart with the number of commits to the selected project branch over time, and line charts with the number of commits by each project member. For more information, see [Contributor analytics](../../analytics/contributor_analytics.md). ## Repository history graph A repository graph displays a visual history of the repository network, including branches and merges. This graph helps you see the flow of changes in the repository. To view the repository history graph, go to your project's **Code > Repository graph**. ![A graph showing the flow of commits in a repository.](img/repo_graph_v17_9.png) ## Repository path changes When a repository path changes, GitLab handles the transition from the old location to the new one with a redirect. When you [rename a user](../../profile/_index.md#change-your-username), [change a group path](../../group/manage.md#change-a-groups-path), or [rename a repository](../working_with_projects.md#rename-a-repository): - URLs for the namespace and everything under it, like projects, are redirected to the new URLs. - Git remote URLs for projects under the namespace redirect to the new remote URL. When you push or pull to a repository that has changed location, a warning message to update your remote is displayed. Automation scripts or Git clients continue to work after a rename. - The redirects are available as long as the original path is not claimed by another group, user, or project. - [API redirects](../../../api/rest/_index.md#redirects) may need to be followed explicitly. After you change a path, you must update the existing URL in the following resources: - [Include statements](../../../ci/yaml/includes.md) except [`include:component`](../../../ci/components/_index.md), otherwise pipelines fail with a syntax error. CI/CD component references can follow redirects. - Namespaced API calls that use the [encoded path](../../../api/rest/_index.md#namespaced-paths) instead of the numeric namespace and project IDs. - [Docker image references](../../../ci/yaml/_index.md#image). - Variables that specify a project or namespace. - [CODEOWNERS file](../codeowners/_index.md#codeowners-file). ## Related topics - [GitLab Workflow extension for VS Code](../../../editor_extensions/visual_studio_code/_index.md) - [Lock files and prevent change conflicts](../file_lock.md) - [Repository API](../../../api/repositories.md) - [Files](files/_index.md) - [Branches](branches/_index.md) - [Create a directory](web_editor.md#create-a-directory) - [Find file history](files/git_history.md) - [Identify changes by line (Git blame)](files/git_blame.md) ## Troubleshooting ### Search sequence of pushes to a repository If it seems that a commit has gone "missing", search the sequence of pushes to a repository. [This StackOverflow article](https://stackoverflow.com/questions/13468027/the-mystery-of-the-missing-commit-across-merges) describes how you can end up in this state without a force push. Another cause can be a misconfigured [server hook](../../../administration/server_hooks.md) that changes a HEAD ref in a `git reset` operation. If you look at the output from the sample code below for the target branch, you see a discontinuity in the from/to commits as you step through the output. The `commit_from` of each new push should equal the `commit_to` of the previous push. A break in that sequence indicates one or more commits have been "lost" from the repository history. Using the [rails console](../../../administration/operations/rails_console.md#starting-a-rails-console-session), the following example checks the last 100 pushes and prints the `commit_from` and `commit_to` entries: ```ruby p = Project.find_by_full_path('project/path') p.events.pushed_action.last(100).each do |e| printf "%-20.20s %8s...%8s (%s)", e.push_event_payload[:ref], e.push_event_payload[:commit_from], e.push_event_payload[:commit_to], e.author.try(:username) end ; nil ``` Example output showing break in sequence at line 4: ```plaintext master f21b07713251e04575908149bdc8ac1f105aabc3...6bc56c1f46244792222f6c85b11606933af171de root master 6bc56c1f46244792222f6c85b11606933af171de...132da6064f5d3453d445fd7cb452b148705bdc1b root master 132da6064f5d3453d445fd7cb452b148705bdc1b...a62e1e693150a2e46ace0ce696cd4a52856dfa65 root master 58b07b719a4b0039fec810efa52f479ba1b84756...f05321a5b5728bd8a89b7bf530aa44043c951dce root master f05321a5b5728bd8a89b7bf530aa44043c951dce...7d02e575fd790e76a3284ee435368279a5eb3773 root ``` ### Error: Xcode fails to clone repository GitLab provides an option to [restrict a list of allowed SSH keys](../../../security/ssh_keys_restrictions.md). If your SSH key is not on the allowed list, you might encounter an error like `The repository rejected the provided credentials`. To resolve this issue, create a new SSH key pair that meets the guidelines for [supported SSH key types](../../ssh.md#supported-ssh-key-types). After you generate a supported SSH key, try cloning the repository again.
--- stage: Create group: Source Code info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments description: How to create, clone, and use GitLab repositories. title: Repository breadcrumbs: - doc - user - project - repository --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} Your [repository](https://git-scm.com/book/en/v2/Git-Basics-Getting-a-Git-Repository) is a component of your GitLab project. You store your code in your repository, and track changes to it with version control. Each repository is part of a [GitLab project](../_index.md), and cannot exist without a GitLab project. Your project provides the configuration options for your repository. ## Create a repository To create a repository: - [Create a project](../_index.md) or - [Fork an existing project](forking_workflow.md). ## Add files to a repository You can add files to a repository: - When you [create a project](../_index.md), or - After you create a project, using the following options: - [Web editor](web_editor.md#upload-a-file). - [User Interface (UI)](#add-a-file-from-the-ui). - [Command line](../../../topics/git/add_files.md). ### Add a file from the UI To add or upload a file from the GitLab UI: <!-- Original source for this list: doc/user/project/repository/web_editor.md#upload-a-file --> <!-- For why we duplicated the info, see https://gitlab.com/gitlab-org/gitlab/-/merge_requests/111072#note_1267429478 --> 1. On the left sidebar, select **Search or go to** and find your project. 1. Go to the directory you want to upload the file to. 1. Next to the directory name, select the plus icon ({{< icon name="plus" >}}) > **Upload file**. 1. Drop or upload your file. 1. Enter a commit message. 1. Optional. To create a merge request with your changes, in **Target branch**, enter a branch name that's not your repository's [default branch](branches/default.md). 1. Select **Upload file**. ## Commit changes to a repository You can commit your changes to a branch in the repository. When you use the command line, use [`git commit`](../../../topics/git/commands.md#git-commit). For information about how to use commits to improve communication and collaboration, trigger or skip pipelines, and reverting changes, see [commits](../merge_requests/commits.md). ## Clone a repository You can clone a repository using the: - Command line: - [Clone with SSH](../../../topics/git/clone.md#clone-with-ssh) - [Clone with HTTPS](../../../topics/git/clone.md#clone-with-https) - GitLab UI: - [Clone and open in Apple Xcode](../../../topics/git/clone.md#clone-and-open-in-apple-xcode) - [Clone and open in Visual Studio Code](../../../topics/git/clone.md#clone-and-open-in-visual-studio-code) - [Clone and open in IntelliJ IDEA](../../../topics/git/clone.md#clone-and-open-in-intellij-idea) ## Download repository source code To download a repository's source code as a compressed file: 1. On the left sidebar, select **Search or go to** and find your project. 1. Above the file list, select **Code**. 1. From the options, select the files you want to download: - **Source code**: Download the source code from the current branch you're viewing. Available extensions: `zip`, `tar`, `tar.gz`, and `tar.bz2`. - **Directory**: Download a specific directory. Visible only when you view a subdirectory. Available extensions: `zip`, `tar`, `tar.gz`, and `tar.bz2`. - **Artifacts**: Download the artifacts from the latest CI/CD job. The checksums of generated archives can change even if the repository itself doesn't change. For example, this occurs if Git or a third-party library that GitLab uses changes. ## View repository by Git revision To view all repository files and folders at a specific Git revision, such as a commit SHA, branch name, or tag: 1. On the left sidebar, select **Search or go to** and find your project. 1. At the top, select to open the **Select Git revision** dropdown list. 1. Select or search for a Git revision. You can also view and browse files at a specific Git revision from the [commits](commits/_index.md) page. ## Repository languages GitLab detects programming languages used in the default branch. This information is displayed on the **Project overview** page. ![Repository Languages bar](img/repository_languages_v15_2.png) When new files are added, this information can take up to five minutes to update. ### Add repository languages Not all files are detected and listed on the **Project overview** page. Documentation, vendor code, and [most markup languages](files/_index.md#supported-markup-languages) are excluded. To view a list of supported files and languages, see [supported data types](https://github.com/github/linguist/blob/master/lib/linguist/languages.yml). To change this behavior and include additional file types in the default settings: 1. In your repository's root directory, create a file named `.gitattributes`. 1. Add a line that tells GitLab to include a specific file type. For example, to enable `.proto` files, add the following: ```plaintext *.proto linguist-detectable=true ``` This feature can use excessive CPU. If you experience an issue, see the [Repository Languages: excessive CPU use](files/_index.md#repository-languages-excessive-cpu-use) troubleshooting section. ## Repository contributor analytics You can view a line chart with the number of commits to the selected project branch over time, and line charts with the number of commits by each project member. For more information, see [Contributor analytics](../../analytics/contributor_analytics.md). ## Repository history graph A repository graph displays a visual history of the repository network, including branches and merges. This graph helps you see the flow of changes in the repository. To view the repository history graph, go to your project's **Code > Repository graph**. ![A graph showing the flow of commits in a repository.](img/repo_graph_v17_9.png) ## Repository path changes When a repository path changes, GitLab handles the transition from the old location to the new one with a redirect. When you [rename a user](../../profile/_index.md#change-your-username), [change a group path](../../group/manage.md#change-a-groups-path), or [rename a repository](../working_with_projects.md#rename-a-repository): - URLs for the namespace and everything under it, like projects, are redirected to the new URLs. - Git remote URLs for projects under the namespace redirect to the new remote URL. When you push or pull to a repository that has changed location, a warning message to update your remote is displayed. Automation scripts or Git clients continue to work after a rename. - The redirects are available as long as the original path is not claimed by another group, user, or project. - [API redirects](../../../api/rest/_index.md#redirects) may need to be followed explicitly. After you change a path, you must update the existing URL in the following resources: - [Include statements](../../../ci/yaml/includes.md) except [`include:component`](../../../ci/components/_index.md), otherwise pipelines fail with a syntax error. CI/CD component references can follow redirects. - Namespaced API calls that use the [encoded path](../../../api/rest/_index.md#namespaced-paths) instead of the numeric namespace and project IDs. - [Docker image references](../../../ci/yaml/_index.md#image). - Variables that specify a project or namespace. - [CODEOWNERS file](../codeowners/_index.md#codeowners-file). ## Related topics - [GitLab Workflow extension for VS Code](../../../editor_extensions/visual_studio_code/_index.md) - [Lock files and prevent change conflicts](../file_lock.md) - [Repository API](../../../api/repositories.md) - [Files](files/_index.md) - [Branches](branches/_index.md) - [Create a directory](web_editor.md#create-a-directory) - [Find file history](files/git_history.md) - [Identify changes by line (Git blame)](files/git_blame.md) ## Troubleshooting ### Search sequence of pushes to a repository If it seems that a commit has gone "missing", search the sequence of pushes to a repository. [This StackOverflow article](https://stackoverflow.com/questions/13468027/the-mystery-of-the-missing-commit-across-merges) describes how you can end up in this state without a force push. Another cause can be a misconfigured [server hook](../../../administration/server_hooks.md) that changes a HEAD ref in a `git reset` operation. If you look at the output from the sample code below for the target branch, you see a discontinuity in the from/to commits as you step through the output. The `commit_from` of each new push should equal the `commit_to` of the previous push. A break in that sequence indicates one or more commits have been "lost" from the repository history. Using the [rails console](../../../administration/operations/rails_console.md#starting-a-rails-console-session), the following example checks the last 100 pushes and prints the `commit_from` and `commit_to` entries: ```ruby p = Project.find_by_full_path('project/path') p.events.pushed_action.last(100).each do |e| printf "%-20.20s %8s...%8s (%s)", e.push_event_payload[:ref], e.push_event_payload[:commit_from], e.push_event_payload[:commit_to], e.author.try(:username) end ; nil ``` Example output showing break in sequence at line 4: ```plaintext master f21b07713251e04575908149bdc8ac1f105aabc3...6bc56c1f46244792222f6c85b11606933af171de root master 6bc56c1f46244792222f6c85b11606933af171de...132da6064f5d3453d445fd7cb452b148705bdc1b root master 132da6064f5d3453d445fd7cb452b148705bdc1b...a62e1e693150a2e46ace0ce696cd4a52856dfa65 root master 58b07b719a4b0039fec810efa52f479ba1b84756...f05321a5b5728bd8a89b7bf530aa44043c951dce root master f05321a5b5728bd8a89b7bf530aa44043c951dce...7d02e575fd790e76a3284ee435368279a5eb3773 root ``` ### Error: Xcode fails to clone repository GitLab provides an option to [restrict a list of allowed SSH keys](../../../security/ssh_keys_restrictions.md). If your SSH key is not on the allowed list, you might encounter an error like `The repository rejected the provided credentials`. To resolve this issue, create a new SSH key pair that meets the guidelines for [supported SSH key types](../../ssh.md#supported-ssh-key-types). After you generate a supported SSH key, try cloning the repository again.
https://docs.gitlab.com/user/project/repository/protection_rules
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/repository/protection_rules.md
2025-08-13
doc/user/project/repository/branches
[ "doc", "user", "project", "repository", "branches" ]
protection_rules.md
Create
Source Code
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Protection rules and permissions
How protection rules work with protected branches in GitLab, especially in complex scenarios.
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} Protection rules control access to branches and determine what happens when multiple rules apply to the same branch. They help you implement the right security measures for your repository branches. These rules cover: - Permission levels, precedence, and rule conflicts. - Force push permissions across multiple matching rules. - Code Owner approvals. - Protection settings between groups and projects. ## Rule behaviors When a branch matches multiple protection rules, these behaviors apply: - Group rules apply to all projects in a group and cannot be modified from project settings. For more information, see [Rules across groups and projects](#rules-across-groups-and-projects). - When a branch matches multiple rules, the most permissive rule applies. However, [code owner approval](#code-owner-approval) uses the most restrictive rule. - Exact branch names like `main` do not override wildcard patterns like `m*`. ## Push and merge permissions {{< history >}} - Branch push permission [changed](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/118532) to require GitLab administrators to also have the **Allowed** permission in GitLab 16.0. {{< /history >}} When a branch is protected, the default behavior enforces these restrictions: | Action | Who can do it | |:-------------------------|:----------------------------------------| | Protect a branch | At least the Maintainer role. | | Push to the branch | Anyone with **Allowed** permission. (1) | | Force push to the branch | No one. | | Delete the branch | No one. (2) | 1. Users with the Developer role can create a project in a group, but might not be allowed to initially push to the [default branch](default.md). 1. No one can delete a protected branch using Git commands, however, users with at least Maintainer role can [delete a protected branch](protected.md#delete-protected-branches) from the UI or API. ## Force push permissions Force push permissions follow the same most permissive rule applies logic. For example, consider these rules, which include [wildcards](protected.md#use-wildcard-rules): | Branch name pattern | Allow force push | |---------------------|------------------| | `v1.x` | Yes | | `v1.*` | No | | `v*` | No | A branch named `v1.x` matches all three branch name patterns: `v1.x`, `v1.*`, and `v*`. As the most permissive option determines the behavior, the resulting permissions for branch `v1.x` are: - **Allow force push**: Of the three settings, `Yes` is most permissive, and controls branch behavior as a result. Even though the branch also matched `v1.x` and `v*` (which each have stricter permissions), any user that can push to this branch can also force push. ## Code owner approval {{< details >}} - Tier: Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} Unlike push and merge permissions, and force push permissions, code owner approval uses the most restrictive rule. If a branch is protected by multiple rules, code owner approval is required if any of the applicable rules have **Required approval from code owners** enabled. For more information, see [require code owner approval](protected.md#require-code-owner-approval). For example, consider these rules: | Branch name pattern | Code owner approval required | |---------------------|------------------------------| | `v1.x` | Yes | | `v1.*` | No | | `v*` | No | A branch named `v1.x` matches all three branch name patterns: `v1.x`, `v1.*`, and `v*`. Because at least one rule (`v1.x`) requires code owner approval, all merge requests to this branch require approval by a Code Owner before they can be merged. ## Rules across groups and projects Branch protection rules can be set in both groups and projects: - Group rules apply to all projects in a group and cannot be modified from project settings. - Project rules apply only to that specific project. When both group and project rules exist that match a branch: - All matching rules are evaluated together. - The most permissive rule applies for most settings. - For [code owner approval](#code-owner-approval), the most restrictive rule applies. You cannot edit or remove group rules from project settings, but you can add additional project rules for the same branch. For example: - A group rule for `main` disallows force push. - You can add a project rule for `main` that allows force push. - Both rules exist, but the more permissive project rule takes effect for force push settings. ## Multiple branch rule examples The following examples demonstrate how different rules can affect branch protection. ### Allowed to merge An example of how an exact branch name does not override a more permissive wildcard pattern. | Branch pattern | Allowed to merge | |----------------|---------------------------| | `release-v1.0` | No one | | `release*` | Maintainer | | `*` | Developer + Maintainer | - Branch `release-v1.0` matches all three patterns. The most permissive rule applies: - **Allowed to merge**: Developer + Maintainer can merge (from `*` rule). ### Allowed to push and merge An example of how multiple branch rules apply to different branch names. | Branch pattern | Allowed to merge | Allowed to push and merge | |----------------|------------------------|---------------------------| | `main` | Maintainer | No one | | `m*` | Developer + Maintainer | Developer + Maintainer | | `r*` | No one | No one | - Branch `main` matches two patterns (`main` and `m*`). The most permissive rule applies: - **Allowed to merge**: Developer + Maintainer can merge (from `m*` rule). - **Allowed to push and merge**: Developer + Maintainer can push (from `m*` rule). - Branch `release-v1.0` matches one pattern: - **Allowed to merge**: No one can merge (from `r*` rule). - **Allowed to push and merge**: No one can push (from `r*` rule). ### Code owner requirements Code owner approval works differently from other branch protection settings. When multiple rules match, the most restrictive rule applies instead of the most permissive. | Branch pattern | Code owner approval required | |----------------|------------------------------| | `production` | Yes | | `prod*` | No | | `p*` | Yes | - Branch `production` matches all three patterns. The most restrictive rule applies: - **Code owner approval**: Required (from `production` and `p*` rules). - Branch `product-v1.0` matches two patterns (`prod*` and `p*`). The most restrictive rule applies: - **Code owner approval**: Required (from `p*` rule). ### Ensure strict protection To ensure strict protection that cannot be overridden by more permissive patterns, configure all matching patterns with the same restrictive settings. | Branch pattern | Allowed to merge | Allowed to push and merge | |----------------|------------------|---------------------------| | `production` | Maintainer | No one | | `prod*` | Maintainer | No one | | `p*` | Maintainer | No one | | `*` | Maintainer | No one | Now branch `production` has restrictive push permissions because all matching rules specify **No one** can push. ## Related topics - [Protected branches](protected.md) - [Protected branches API](../../../../api/protected_branches.md) - [Branch rules](branch_rules.md) - [Code Owners](../../codeowners/_index.md#code-owners-and-protected-branches)
--- stage: Create group: Source Code info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments description: How protection rules work with protected branches in GitLab, especially in complex scenarios. title: Protection rules and permissions breadcrumbs: - doc - user - project - repository - branches --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} Protection rules control access to branches and determine what happens when multiple rules apply to the same branch. They help you implement the right security measures for your repository branches. These rules cover: - Permission levels, precedence, and rule conflicts. - Force push permissions across multiple matching rules. - Code Owner approvals. - Protection settings between groups and projects. ## Rule behaviors When a branch matches multiple protection rules, these behaviors apply: - Group rules apply to all projects in a group and cannot be modified from project settings. For more information, see [Rules across groups and projects](#rules-across-groups-and-projects). - When a branch matches multiple rules, the most permissive rule applies. However, [code owner approval](#code-owner-approval) uses the most restrictive rule. - Exact branch names like `main` do not override wildcard patterns like `m*`. ## Push and merge permissions {{< history >}} - Branch push permission [changed](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/118532) to require GitLab administrators to also have the **Allowed** permission in GitLab 16.0. {{< /history >}} When a branch is protected, the default behavior enforces these restrictions: | Action | Who can do it | |:-------------------------|:----------------------------------------| | Protect a branch | At least the Maintainer role. | | Push to the branch | Anyone with **Allowed** permission. (1) | | Force push to the branch | No one. | | Delete the branch | No one. (2) | 1. Users with the Developer role can create a project in a group, but might not be allowed to initially push to the [default branch](default.md). 1. No one can delete a protected branch using Git commands, however, users with at least Maintainer role can [delete a protected branch](protected.md#delete-protected-branches) from the UI or API. ## Force push permissions Force push permissions follow the same most permissive rule applies logic. For example, consider these rules, which include [wildcards](protected.md#use-wildcard-rules): | Branch name pattern | Allow force push | |---------------------|------------------| | `v1.x` | Yes | | `v1.*` | No | | `v*` | No | A branch named `v1.x` matches all three branch name patterns: `v1.x`, `v1.*`, and `v*`. As the most permissive option determines the behavior, the resulting permissions for branch `v1.x` are: - **Allow force push**: Of the three settings, `Yes` is most permissive, and controls branch behavior as a result. Even though the branch also matched `v1.x` and `v*` (which each have stricter permissions), any user that can push to this branch can also force push. ## Code owner approval {{< details >}} - Tier: Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} Unlike push and merge permissions, and force push permissions, code owner approval uses the most restrictive rule. If a branch is protected by multiple rules, code owner approval is required if any of the applicable rules have **Required approval from code owners** enabled. For more information, see [require code owner approval](protected.md#require-code-owner-approval). For example, consider these rules: | Branch name pattern | Code owner approval required | |---------------------|------------------------------| | `v1.x` | Yes | | `v1.*` | No | | `v*` | No | A branch named `v1.x` matches all three branch name patterns: `v1.x`, `v1.*`, and `v*`. Because at least one rule (`v1.x`) requires code owner approval, all merge requests to this branch require approval by a Code Owner before they can be merged. ## Rules across groups and projects Branch protection rules can be set in both groups and projects: - Group rules apply to all projects in a group and cannot be modified from project settings. - Project rules apply only to that specific project. When both group and project rules exist that match a branch: - All matching rules are evaluated together. - The most permissive rule applies for most settings. - For [code owner approval](#code-owner-approval), the most restrictive rule applies. You cannot edit or remove group rules from project settings, but you can add additional project rules for the same branch. For example: - A group rule for `main` disallows force push. - You can add a project rule for `main` that allows force push. - Both rules exist, but the more permissive project rule takes effect for force push settings. ## Multiple branch rule examples The following examples demonstrate how different rules can affect branch protection. ### Allowed to merge An example of how an exact branch name does not override a more permissive wildcard pattern. | Branch pattern | Allowed to merge | |----------------|---------------------------| | `release-v1.0` | No one | | `release*` | Maintainer | | `*` | Developer + Maintainer | - Branch `release-v1.0` matches all three patterns. The most permissive rule applies: - **Allowed to merge**: Developer + Maintainer can merge (from `*` rule). ### Allowed to push and merge An example of how multiple branch rules apply to different branch names. | Branch pattern | Allowed to merge | Allowed to push and merge | |----------------|------------------------|---------------------------| | `main` | Maintainer | No one | | `m*` | Developer + Maintainer | Developer + Maintainer | | `r*` | No one | No one | - Branch `main` matches two patterns (`main` and `m*`). The most permissive rule applies: - **Allowed to merge**: Developer + Maintainer can merge (from `m*` rule). - **Allowed to push and merge**: Developer + Maintainer can push (from `m*` rule). - Branch `release-v1.0` matches one pattern: - **Allowed to merge**: No one can merge (from `r*` rule). - **Allowed to push and merge**: No one can push (from `r*` rule). ### Code owner requirements Code owner approval works differently from other branch protection settings. When multiple rules match, the most restrictive rule applies instead of the most permissive. | Branch pattern | Code owner approval required | |----------------|------------------------------| | `production` | Yes | | `prod*` | No | | `p*` | Yes | - Branch `production` matches all three patterns. The most restrictive rule applies: - **Code owner approval**: Required (from `production` and `p*` rules). - Branch `product-v1.0` matches two patterns (`prod*` and `p*`). The most restrictive rule applies: - **Code owner approval**: Required (from `p*` rule). ### Ensure strict protection To ensure strict protection that cannot be overridden by more permissive patterns, configure all matching patterns with the same restrictive settings. | Branch pattern | Allowed to merge | Allowed to push and merge | |----------------|------------------|---------------------------| | `production` | Maintainer | No one | | `prod*` | Maintainer | No one | | `p*` | Maintainer | No one | | `*` | Maintainer | No one | Now branch `production` has restrictive push permissions because all matching rules specify **No one** can push. ## Related topics - [Protected branches](protected.md) - [Protected branches API](../../../../api/protected_branches.md) - [Branch rules](branch_rules.md) - [Code Owners](../../codeowners/_index.md#code-owners-and-protected-branches)
https://docs.gitlab.com/user/project/repository/protected
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/repository/protected.md
2025-08-13
doc/user/project/repository/branches
[ "doc", "user", "project", "repository", "branches" ]
protected.md
Create
Source Code
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Protected branches
Protected branches in GitLab restrict who can push to, merge, or modify a Git branch.
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} Protected branches enforce specific [permissions](../../../permissions.md) on branches in GitLab to ensure code stability and quality. Protected branches: - Control which users can merge and push code changes. - Prevent accidental deletion of critical branches. - Enforce code review and approval processes. - Manage [Code Owner approval](protection_rules.md#code-owner-approval) requirements. - Regulate force push permissions to maintain commit history. - Control access through both the UI and the [Protected branches API](../../../../api/protected_branches.md). {{< alert type="note" >}} The [default branch](default.md) for your repository is protected by default. {{< /alert >}} For information about how protection rules behave when a branch matches multiple rules or has complex permission requirements, see [Protection rules and permissions](protection_rules.md). ## Protect a branch Configure protected branches for individual projects or for all projects in a group. ### In a project Prerequisites: - You must have at least the Maintainer role. - When granting a group **Allowed to merge** or **Allowed to push and merge** permissions on a protected branch, the project must be accessible and shared with the group. For more information, see [Shared projects](../../members/sharing_projects_groups.md). To protect a branch: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Repository**. 1. Expand **Protected branches**. 1. Select **Add protected branch**. 1. From the **Branch** dropdown list, select the branch you want to protect. 1. From the **Allowed to merge** list, select a role that can merge into this branch. 1. From the **Allowed to push and merge** list, select a role that can push to this branch. {{< alert type="note" >}} In GitLab Premium and Ultimate, you can also add groups or individual users to **Allowed to merge** and **Allowed to push and merge**. {{< /alert >}} 1. Select **Protect**. The protected branch displays in the list of protected branches. ### In a group {{< details >}} - Tier: Premium, Ultimate - Offering: GitLab Self-Managed {{< /details >}} {{< history >}} - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/issues/500250) in GitLab 17.6. Feature flag `group_protected_branches` removed. {{< /history >}} Group owners can create protected branches for a group. These settings are inherited by all projects in the group and can't be overridden by project settings. Prerequisites: - You must have the Owner role for the group. - The group must be a top-level group. Subgroups are not supported. To protect a branch for all the projects in a group: 1. On the left sidebar, select **Search or go to** and find your group. 1. Select **Settings > Repository**. 1. Expand **Protected branches**. 1. Select **Add protected branch**. 1. In the **Branch** text box, type the branch name or a [wildcard](#use-wildcard-rules) (`*`). Branch names and wildcards [are case-sensitive](_index.md#name-your-branch). 1. From the **Allowed to merge** list, select a role that can merge into this branch. 1. From the **Allowed to push and merge** list, select a role that can push to this branch. 1. Select **Protect**. The protected branch is added to the list of protected branches. ## Default branch protection settings Administrators can [set a default branch protection level](default.md#for-all-projects-in-an-instance) in the **Admin** area. ## Use wildcard rules When using wildcards, multiple rules can apply to a single branch. If more than one rule applies to a branch, the most permissive rule controls how the branch behaves. For merge controls to work properly, set **Allowed to push and merge** to a broader set of users than **Allowed to merge**. Prerequisites: - You must have at least the Maintainer role. To protect multiple branches at the same time: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Repository**. 1. Expand **Protected branches**. 1. Select **Add protected branch**. 1. From the **Branch** dropdown list, type the branch name and a wildcard (`*`). Branch names and wildcards [are case-sensitive](_index.md#name-your-branch). For example: | Wildcard protected branch | Matching branches | |---------------------------|--------------------------------------------------------| | `*-stable` | `production-stable`, `staging-stable` | | `production/*` | `production/app-server`, `production/load-balancer` | | `*gitlab*` | `gitlab`, `gitlab/staging`, `master/gitlab/production` | 1. From the **Allowed to merge** list, select a role that can merge into this branch. 1. From the **Allowed to push and merge** list, select a role that can push to this branch. In GitLab Premium or Ultimate, you can also add groups or individual users. 1. Select **Protect**. The protected branch displays in the list of protected branches. ## Configure protection options You can set various protection options to secure your branches. ### Require merge requests You can force everyone to submit a merge request, rather than allowing them to check in directly to a protected branch: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Repository**. 1. Expand **Protected branches**. 1. Select **Add protected branch**. 1. From the **Branch** dropdown list, select the branch you want to protect. 1. From the **Allowed to merge** list, select **Developers + Maintainers**. 1. From the **Allowed to push and merge** list, select **No one**. 1. Select **Protect**. Alternatively, you can [create](branch_rules.md#create-a-branch-rule) or [edit](branch_rules.md#edit-a-branch-rule-target) a branch rule. Then: 1. Select **Edit** in the **Allowed to merge** section. 1. Select **Developers and Maintainers**. 1. Select **Save changes**. ### Allow direct push You can allow everyone with write access to push directly to the protected branch. 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Repository**. 1. Expand **Protected branches**. 1. Select **Add protected branch**. 1. From the **Branch** dropdown list, select the branch you want to protect. 1. From the **Allowed to push and merge** list, select **Developers + Maintainers**. 1. Select **Protect**. Alternatively, you can [create](branch_rules.md#create-a-branch-rule) or [edit](branch_rules.md#edit-a-branch-rule-target) a branch rule. Then: 1. Select **Edit** in the **Allowed to push and merge** section. 1. Select **Developers and Maintainers**. 1. Select **Save changes**. ### With group permissions To set the members of a group or subgroup as **Allowed to merge** or **Allowed to push and merge** to a protected branch: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Repository**. 1. Expand **Protected branches**. 1. Add groups to the following fields: ```plaintext # Allow group members to merge into this branch Allowed to merge: @group-x # Allow group members to push and merge into this branch Allowed to push and merge: @group-x/subgroup-y ``` {{< alert type="note" >}} When you assign a group to a protected branch, only direct members of that group are included. Members from parent groups are not automatically granted permissions to the protected branch. {{< /alert >}} #### Group inheritance requirements ```mermaid %%{init: { "fontFamily": "GitLab Sans" }}%% graph TD accTitle: Diagram of group inheritance for protected branches accDescr: If a project is shared with a group, the group members inherit permissions for protected branches. A[Parent group X] -->|owns| B[Project A] A -->|contains| C[Subgroup Y] B -->|shared with| C C -->|members inherit permissions| B ``` In this example: - Parent group X (`group-x`) owns Project A. - Parent group X also contains a subgroup, Subgroup Y. (`group-x/subgroup-y`) - Project A is shared with Subgroup Y. The eligible groups for protected branch permissions are: - Project A: Both Group X and Subgroup Y, because Project A is shared with Subgroup Y. #### Share projects with groups You can share the project with a group or subgroup so that their members are eligible for protected branch permissions. ```mermaid %%{init: { "fontFamily": "GitLab Sans" }}%% graph LR accTitle: Diagram of project sharing for protected branch permissions accDescr: Sharing a project with a group affects whether their members can have protected branch permissions. A[Parent group X] -->|owns| B[Project A] A -->|also contains| C[Subgroup Y] C -.->D{Share Project A<br/>with Subgroup Y?} -.->|yes| E[Members of Subgroup Y<br/>can have protected<br/>branch permissions] D{Share Project A<br/>with Subgroup Y?} -.->|no| F[Members of Subgroup Y<br />cannot have protected<br/>branch permissions] E -.->|Add Subgroup Y<br/> to protected branch settings| I[Subgroup Y members<br/>can merge/push] -.-> B F -.-> |Add Subgroup Y<br/> to protected branch settings| J[Settings will not<br/>take effect] -.-> B ``` To grant access to Subgroup Y members for Project A, you must share the project with the subgroup. Adding the subgroup directly to the protected branch settings is not effective and isn't applicable to subgroup members. {{< alert type="note" >}} For a group to have protected branch permissions, the project must be directly shared with the group. Inherited project membership from parent groups is not sufficient for protected branch permissions. {{< /alert >}} ### Enable deploy key access You can push to a protected branch with a [deploy key](../../deploy_keys/_index.md). Prerequisites: - The deploy key must be enabled for your project. A project deploy key is enabled by default when it is created. However, a public deploy key must be [granted](../../deploy_keys/_index.md#grant-project-access-to-a-public-deploy-key) access to the project. - The deploy key must have [write access](../../deploy_keys/_index.md#permissions) to your project repository. - The owner of the deploy key must have at least read access to the project. - The owner of the deploy key must also be a member of the project. To allow a deploy key to push to a protected branch: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Repository**. 1. Expand **Protected branches**. 1. Select **Add protected branch**. 1. From the **Branch** dropdown list, select the branch you want to protect. 1. From the **Allowed to push and merge** list, select the deploy key. 1. Select **Protect**. Deploy keys are not available in the **Allowed to merge** dropdown list. ### Allow force push You can allow [force pushes](../../../../topics/git/git_rebase.md#force-push-to-a-remote-branch) to protected branches. To protect a new branch and enable force push: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Repository**. 1. Expand **Protected branches**. 1. Select **Add protected branch**. 1. From the **Branch** dropdown list, select the branch you want to protect. 1. From the **Allowed to push and merge** and **Allowed to merge** lists, select the settings you want. 1. To allow all users with push access to force push, turn on the **Allowed to force push** toggle. 1. Select **Protect**. To enable force pushes on branches that are already protected: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Repository**. 1. Expand **Protected branches**. 1. Select **Add protected branch**. 1. In the list of protected branches, next to the branch, turn on the **Allowed to force push** toggle. Alternatively, you can [create](branch_rules.md#create-a-branch-rule) or [edit](branch_rules.md#edit-a-branch-rule-target) a branch rule. Then: 1. In the list of protected branches, next to the branch, turn on the **Allowed to force push** toggle. Members who can push to this branch can now also force push. ### Require Code Owner approval {{< details >}} - Tier: Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} For a protected branch, you can require at least one approval by a [Code Owner](../../codeowners/_index.md). If a branch is protected by multiple rules, code owner approval is required if any of the applicable rules have **Required approval from code owners** enabled. To protect a new branch and enable Code Owner's approval: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Repository**. 1. Expand **Protected branches**. 1. Select **Add protected branch**. 1. From the **Branch** dropdown list, select the branch you want to protect. 1. From the **Allowed to push and merge** and **Allowed to merge** lists, select the settings you want. 1. Turn on the **Require approval from code owners** toggle. 1. Select **Protect**. To enable Code Owner's approval on branches that are already protected: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Repository**. 1. Expand **Protected branches**. 1. Select **Add protected branch**. 1. In the list of protected branches, next to the branch, turn on the **Code owner approval** toggle. Alternatively, you can [create](branch_rules.md#create-a-branch-rule) or [edit](branch_rules.md#edit-a-branch-rule-target) a branch rule. Then, in the list of protected branches, next to the branch, turn on the **Code owner approval** toggle. When enabled, all merge requests for these branches require approval by a Code Owner per matched rule before they can be merged. Additionally, direct pushes to the protected branch are denied if a rule is matched. Any user who is not specified in the `CODEOWNERS` file cannot push changes for the specified files or paths, unless they are specifically allowed to. You don't have to restrict developers from pushing directly to the protected branch. Instead, you can restrict pushing to certain files where a review by Code Owners is required. In [GitLab Premium 13.5 and later](https://gitlab.com/gitlab-org/gitlab/-/issues/35097), users and groups who are allowed to push to protected branches do not need a merge request to merge their feature branches. Thus, they can skip merge request approval rules, Code Owners included. ## CI/CD on protected branches The permission to merge or push to protected branches defines whether or not a user can run CI/CD pipelines and execute actions on jobs. Merge request pipelines run on the source branch or a merge request reference based on the source branch. A pipeline isn't created if the user doesn't have permission to merge or push to the source branch. When a merge request is between protected branches, [protected variables and runners are available to the pipeline](../../../../ci/pipelines/merge_request_pipelines.md#control-access-to-protected-variables-and-runners) if the user has permission to update both the source and target branches. See [Security on protected branches](../../../../ci/pipelines/_index.md#pipeline-security-on-protected-branches) for details about the pipelines security model. ## Create protected branches Prerequisites: - You must have at least the Developer role. - To create a protected branch, branch protection must be configured to [require everyone to submit merge requests for a protected branch](#require-merge-requests). To create a new branch with protections: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Code > Branches**. 1. Select **New branch**. 1. Fill in the branch name and select an existing branch, tag, or commit to base the new branch on. If you [require everyone to submit merge requests for a protected branch](#require-merge-requests), only existing protected branches and commits that are already in protected branches are accepted. You can also use [the Branches API](../../../../api/branches.md) to create a branch with protections. If branch protection is configured to [allow everyone to push directly to a protected branch](#allow-direct-push), a branch with protections can also be created from the command line or a Git client application. ## Delete protected branches Users with at least the Maintainer role can manually delete protected branches by using the GitLab web interface: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Code > Branches**. 1. Next to the branch you want to delete, select **Delete** ({{< icon name="remove" >}}). 1. On the confirmation dialog, enter the branch name and select **Yes, delete protected branch**. Branch names [are case-sensitive](_index.md#name-your-branch). Protected branches can only be deleted by using GitLab either from the UI or API. This prevents accidentally deleting a branch through local Git commands or third-party Git clients. ## Policy enforcement For security and compliance, you may implement a [merge request approval policy](../../../application_security/policies/merge_request_approval_policies.md#approval_settings) which affects settings otherwise defined in your instance, group, or projects. Policies may affect users ability to unprotect or delete branches, push or force push. ## Related topics - [Protection rules and permissions](protection_rules.md) - [Protected branches API](../../../../api/protected_branches.md) - [Branches](_index.md) - [Branches API](../../../../api/branches.md) - [Commits API](../../../../api/commits.md) - [Code Owners](../../codeowners/_index.md#code-owners-and-protected-branches) ## Troubleshooting ### Branch names are case-sensitive Branch names in `git` are case-sensitive. When configuring your protected branch, or your [target branch workflow](_index.md#configure-workflows-for-target-branches), `dev` is not the same `DEV` or `Dev`.
--- stage: Create group: Source Code info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments description: Protected branches in GitLab restrict who can push to, merge, or modify a Git branch. title: Protected branches breadcrumbs: - doc - user - project - repository - branches --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} Protected branches enforce specific [permissions](../../../permissions.md) on branches in GitLab to ensure code stability and quality. Protected branches: - Control which users can merge and push code changes. - Prevent accidental deletion of critical branches. - Enforce code review and approval processes. - Manage [Code Owner approval](protection_rules.md#code-owner-approval) requirements. - Regulate force push permissions to maintain commit history. - Control access through both the UI and the [Protected branches API](../../../../api/protected_branches.md). {{< alert type="note" >}} The [default branch](default.md) for your repository is protected by default. {{< /alert >}} For information about how protection rules behave when a branch matches multiple rules or has complex permission requirements, see [Protection rules and permissions](protection_rules.md). ## Protect a branch Configure protected branches for individual projects or for all projects in a group. ### In a project Prerequisites: - You must have at least the Maintainer role. - When granting a group **Allowed to merge** or **Allowed to push and merge** permissions on a protected branch, the project must be accessible and shared with the group. For more information, see [Shared projects](../../members/sharing_projects_groups.md). To protect a branch: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Repository**. 1. Expand **Protected branches**. 1. Select **Add protected branch**. 1. From the **Branch** dropdown list, select the branch you want to protect. 1. From the **Allowed to merge** list, select a role that can merge into this branch. 1. From the **Allowed to push and merge** list, select a role that can push to this branch. {{< alert type="note" >}} In GitLab Premium and Ultimate, you can also add groups or individual users to **Allowed to merge** and **Allowed to push and merge**. {{< /alert >}} 1. Select **Protect**. The protected branch displays in the list of protected branches. ### In a group {{< details >}} - Tier: Premium, Ultimate - Offering: GitLab Self-Managed {{< /details >}} {{< history >}} - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/issues/500250) in GitLab 17.6. Feature flag `group_protected_branches` removed. {{< /history >}} Group owners can create protected branches for a group. These settings are inherited by all projects in the group and can't be overridden by project settings. Prerequisites: - You must have the Owner role for the group. - The group must be a top-level group. Subgroups are not supported. To protect a branch for all the projects in a group: 1. On the left sidebar, select **Search or go to** and find your group. 1. Select **Settings > Repository**. 1. Expand **Protected branches**. 1. Select **Add protected branch**. 1. In the **Branch** text box, type the branch name or a [wildcard](#use-wildcard-rules) (`*`). Branch names and wildcards [are case-sensitive](_index.md#name-your-branch). 1. From the **Allowed to merge** list, select a role that can merge into this branch. 1. From the **Allowed to push and merge** list, select a role that can push to this branch. 1. Select **Protect**. The protected branch is added to the list of protected branches. ## Default branch protection settings Administrators can [set a default branch protection level](default.md#for-all-projects-in-an-instance) in the **Admin** area. ## Use wildcard rules When using wildcards, multiple rules can apply to a single branch. If more than one rule applies to a branch, the most permissive rule controls how the branch behaves. For merge controls to work properly, set **Allowed to push and merge** to a broader set of users than **Allowed to merge**. Prerequisites: - You must have at least the Maintainer role. To protect multiple branches at the same time: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Repository**. 1. Expand **Protected branches**. 1. Select **Add protected branch**. 1. From the **Branch** dropdown list, type the branch name and a wildcard (`*`). Branch names and wildcards [are case-sensitive](_index.md#name-your-branch). For example: | Wildcard protected branch | Matching branches | |---------------------------|--------------------------------------------------------| | `*-stable` | `production-stable`, `staging-stable` | | `production/*` | `production/app-server`, `production/load-balancer` | | `*gitlab*` | `gitlab`, `gitlab/staging`, `master/gitlab/production` | 1. From the **Allowed to merge** list, select a role that can merge into this branch. 1. From the **Allowed to push and merge** list, select a role that can push to this branch. In GitLab Premium or Ultimate, you can also add groups or individual users. 1. Select **Protect**. The protected branch displays in the list of protected branches. ## Configure protection options You can set various protection options to secure your branches. ### Require merge requests You can force everyone to submit a merge request, rather than allowing them to check in directly to a protected branch: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Repository**. 1. Expand **Protected branches**. 1. Select **Add protected branch**. 1. From the **Branch** dropdown list, select the branch you want to protect. 1. From the **Allowed to merge** list, select **Developers + Maintainers**. 1. From the **Allowed to push and merge** list, select **No one**. 1. Select **Protect**. Alternatively, you can [create](branch_rules.md#create-a-branch-rule) or [edit](branch_rules.md#edit-a-branch-rule-target) a branch rule. Then: 1. Select **Edit** in the **Allowed to merge** section. 1. Select **Developers and Maintainers**. 1. Select **Save changes**. ### Allow direct push You can allow everyone with write access to push directly to the protected branch. 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Repository**. 1. Expand **Protected branches**. 1. Select **Add protected branch**. 1. From the **Branch** dropdown list, select the branch you want to protect. 1. From the **Allowed to push and merge** list, select **Developers + Maintainers**. 1. Select **Protect**. Alternatively, you can [create](branch_rules.md#create-a-branch-rule) or [edit](branch_rules.md#edit-a-branch-rule-target) a branch rule. Then: 1. Select **Edit** in the **Allowed to push and merge** section. 1. Select **Developers and Maintainers**. 1. Select **Save changes**. ### With group permissions To set the members of a group or subgroup as **Allowed to merge** or **Allowed to push and merge** to a protected branch: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Repository**. 1. Expand **Protected branches**. 1. Add groups to the following fields: ```plaintext # Allow group members to merge into this branch Allowed to merge: @group-x # Allow group members to push and merge into this branch Allowed to push and merge: @group-x/subgroup-y ``` {{< alert type="note" >}} When you assign a group to a protected branch, only direct members of that group are included. Members from parent groups are not automatically granted permissions to the protected branch. {{< /alert >}} #### Group inheritance requirements ```mermaid %%{init: { "fontFamily": "GitLab Sans" }}%% graph TD accTitle: Diagram of group inheritance for protected branches accDescr: If a project is shared with a group, the group members inherit permissions for protected branches. A[Parent group X] -->|owns| B[Project A] A -->|contains| C[Subgroup Y] B -->|shared with| C C -->|members inherit permissions| B ``` In this example: - Parent group X (`group-x`) owns Project A. - Parent group X also contains a subgroup, Subgroup Y. (`group-x/subgroup-y`) - Project A is shared with Subgroup Y. The eligible groups for protected branch permissions are: - Project A: Both Group X and Subgroup Y, because Project A is shared with Subgroup Y. #### Share projects with groups You can share the project with a group or subgroup so that their members are eligible for protected branch permissions. ```mermaid %%{init: { "fontFamily": "GitLab Sans" }}%% graph LR accTitle: Diagram of project sharing for protected branch permissions accDescr: Sharing a project with a group affects whether their members can have protected branch permissions. A[Parent group X] -->|owns| B[Project A] A -->|also contains| C[Subgroup Y] C -.->D{Share Project A<br/>with Subgroup Y?} -.->|yes| E[Members of Subgroup Y<br/>can have protected<br/>branch permissions] D{Share Project A<br/>with Subgroup Y?} -.->|no| F[Members of Subgroup Y<br />cannot have protected<br/>branch permissions] E -.->|Add Subgroup Y<br/> to protected branch settings| I[Subgroup Y members<br/>can merge/push] -.-> B F -.-> |Add Subgroup Y<br/> to protected branch settings| J[Settings will not<br/>take effect] -.-> B ``` To grant access to Subgroup Y members for Project A, you must share the project with the subgroup. Adding the subgroup directly to the protected branch settings is not effective and isn't applicable to subgroup members. {{< alert type="note" >}} For a group to have protected branch permissions, the project must be directly shared with the group. Inherited project membership from parent groups is not sufficient for protected branch permissions. {{< /alert >}} ### Enable deploy key access You can push to a protected branch with a [deploy key](../../deploy_keys/_index.md). Prerequisites: - The deploy key must be enabled for your project. A project deploy key is enabled by default when it is created. However, a public deploy key must be [granted](../../deploy_keys/_index.md#grant-project-access-to-a-public-deploy-key) access to the project. - The deploy key must have [write access](../../deploy_keys/_index.md#permissions) to your project repository. - The owner of the deploy key must have at least read access to the project. - The owner of the deploy key must also be a member of the project. To allow a deploy key to push to a protected branch: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Repository**. 1. Expand **Protected branches**. 1. Select **Add protected branch**. 1. From the **Branch** dropdown list, select the branch you want to protect. 1. From the **Allowed to push and merge** list, select the deploy key. 1. Select **Protect**. Deploy keys are not available in the **Allowed to merge** dropdown list. ### Allow force push You can allow [force pushes](../../../../topics/git/git_rebase.md#force-push-to-a-remote-branch) to protected branches. To protect a new branch and enable force push: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Repository**. 1. Expand **Protected branches**. 1. Select **Add protected branch**. 1. From the **Branch** dropdown list, select the branch you want to protect. 1. From the **Allowed to push and merge** and **Allowed to merge** lists, select the settings you want. 1. To allow all users with push access to force push, turn on the **Allowed to force push** toggle. 1. Select **Protect**. To enable force pushes on branches that are already protected: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Repository**. 1. Expand **Protected branches**. 1. Select **Add protected branch**. 1. In the list of protected branches, next to the branch, turn on the **Allowed to force push** toggle. Alternatively, you can [create](branch_rules.md#create-a-branch-rule) or [edit](branch_rules.md#edit-a-branch-rule-target) a branch rule. Then: 1. In the list of protected branches, next to the branch, turn on the **Allowed to force push** toggle. Members who can push to this branch can now also force push. ### Require Code Owner approval {{< details >}} - Tier: Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} For a protected branch, you can require at least one approval by a [Code Owner](../../codeowners/_index.md). If a branch is protected by multiple rules, code owner approval is required if any of the applicable rules have **Required approval from code owners** enabled. To protect a new branch and enable Code Owner's approval: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Repository**. 1. Expand **Protected branches**. 1. Select **Add protected branch**. 1. From the **Branch** dropdown list, select the branch you want to protect. 1. From the **Allowed to push and merge** and **Allowed to merge** lists, select the settings you want. 1. Turn on the **Require approval from code owners** toggle. 1. Select **Protect**. To enable Code Owner's approval on branches that are already protected: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Repository**. 1. Expand **Protected branches**. 1. Select **Add protected branch**. 1. In the list of protected branches, next to the branch, turn on the **Code owner approval** toggle. Alternatively, you can [create](branch_rules.md#create-a-branch-rule) or [edit](branch_rules.md#edit-a-branch-rule-target) a branch rule. Then, in the list of protected branches, next to the branch, turn on the **Code owner approval** toggle. When enabled, all merge requests for these branches require approval by a Code Owner per matched rule before they can be merged. Additionally, direct pushes to the protected branch are denied if a rule is matched. Any user who is not specified in the `CODEOWNERS` file cannot push changes for the specified files or paths, unless they are specifically allowed to. You don't have to restrict developers from pushing directly to the protected branch. Instead, you can restrict pushing to certain files where a review by Code Owners is required. In [GitLab Premium 13.5 and later](https://gitlab.com/gitlab-org/gitlab/-/issues/35097), users and groups who are allowed to push to protected branches do not need a merge request to merge their feature branches. Thus, they can skip merge request approval rules, Code Owners included. ## CI/CD on protected branches The permission to merge or push to protected branches defines whether or not a user can run CI/CD pipelines and execute actions on jobs. Merge request pipelines run on the source branch or a merge request reference based on the source branch. A pipeline isn't created if the user doesn't have permission to merge or push to the source branch. When a merge request is between protected branches, [protected variables and runners are available to the pipeline](../../../../ci/pipelines/merge_request_pipelines.md#control-access-to-protected-variables-and-runners) if the user has permission to update both the source and target branches. See [Security on protected branches](../../../../ci/pipelines/_index.md#pipeline-security-on-protected-branches) for details about the pipelines security model. ## Create protected branches Prerequisites: - You must have at least the Developer role. - To create a protected branch, branch protection must be configured to [require everyone to submit merge requests for a protected branch](#require-merge-requests). To create a new branch with protections: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Code > Branches**. 1. Select **New branch**. 1. Fill in the branch name and select an existing branch, tag, or commit to base the new branch on. If you [require everyone to submit merge requests for a protected branch](#require-merge-requests), only existing protected branches and commits that are already in protected branches are accepted. You can also use [the Branches API](../../../../api/branches.md) to create a branch with protections. If branch protection is configured to [allow everyone to push directly to a protected branch](#allow-direct-push), a branch with protections can also be created from the command line or a Git client application. ## Delete protected branches Users with at least the Maintainer role can manually delete protected branches by using the GitLab web interface: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Code > Branches**. 1. Next to the branch you want to delete, select **Delete** ({{< icon name="remove" >}}). 1. On the confirmation dialog, enter the branch name and select **Yes, delete protected branch**. Branch names [are case-sensitive](_index.md#name-your-branch). Protected branches can only be deleted by using GitLab either from the UI or API. This prevents accidentally deleting a branch through local Git commands or third-party Git clients. ## Policy enforcement For security and compliance, you may implement a [merge request approval policy](../../../application_security/policies/merge_request_approval_policies.md#approval_settings) which affects settings otherwise defined in your instance, group, or projects. Policies may affect users ability to unprotect or delete branches, push or force push. ## Related topics - [Protection rules and permissions](protection_rules.md) - [Protected branches API](../../../../api/protected_branches.md) - [Branches](_index.md) - [Branches API](../../../../api/branches.md) - [Commits API](../../../../api/commits.md) - [Code Owners](../../codeowners/_index.md#code-owners-and-protected-branches) ## Troubleshooting ### Branch names are case-sensitive Branch names in `git` are case-sensitive. When configuring your protected branch, or your [target branch workflow](_index.md#configure-workflows-for-target-branches), `dev` is not the same `DEV` or `Dev`.
https://docs.gitlab.com/user/project/repository/branches
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/repository/_index.md
2025-08-13
doc/user/project/repository/branches
[ "doc", "user", "project", "repository", "branches" ]
_index.md
Create
Source Code
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Branches
Understand how to name, manage, and protect Git branches.
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} Branches keep your team's development work organized and separated. When multiple people work on different features simultaneously, branches prevent changes from conflicting with each other. Each branch acts as an isolated workspace where you implement new features, fix bugs, or experiment with ideas. With branches, your team can: - Work on separate features without disrupting the main codebase. - Review proposed changes before they affect the rest of the project. - Roll back problematic changes without affecting other work. - Deploy changes to production in a controlled, predictable way. The development workflow for branches is: 1. [Create a branch](#create-a-branch) and add commits to it. To streamline this process, you should follow [branch naming patterns](#prefix-branch-names-with-a-number). 1. When the work is ready for review, create a [merge request](../../merge_requests/_index.md) to propose merging the changes in your branch. 1. Preview the changes with a [review app](../../../../ci/review_apps/_index.md). 1. [Request a review](../../merge_requests/reviews/_index.md#request-a-review). 1. After your merge request is approved, merge your branch to the origin branch. The [merge method](../../merge_requests/methods/_index.md) determines how merge requests are handled in your project. 1. After the contents of your branch are merged, [delete the merged branch](#delete-merged-branches). ## View all branches To view and manage your branches in the GitLab user interface: 1. On the left sidebar, select **Search or go to** and find your project. 1. On the left sidebar, select **Code > Branches**. On this page, you can: - See all branches, or filter to see only active or stale branches. A branch is considered active if a commit has been made to it in the last three months. Otherwise it is considered stale. - [Create new branches](#create-a-branch). - [Compare branches](#compare-branches). - [Delete merged branches](#delete-merged-branches). - See merge request links that point to the default branch. Branches with merge requests that do not point to the default branch display the {{< icon name="merge-request" >}} **New** merge request button. - [View branch rules](branch_rules.md#view-branch-rules). - See latest pipeline status on the branch. ## Create a branch Prerequisites: - You must have at least the Developer role for the project. To create a new branch from the GitLab UI: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Code > Branches**. 1. In the upper-right corner, select **New branch**. 1. Enter a **Branch name**. 1. In **Create from**, select the base of your branch: an existing branch, an existing tag, or a commit SHA. 1. Select **Create branch**. ### In a blank project A [blank project](../../_index.md#create-a-blank-project) does not contain a branch, but you can add one. Prerequisites: - You must have at least the Developer role for the project. - If you don't have the Maintainer or Owner role, the [default branch protection](../../../group/manage.md#change-the-default-branch-protection-of-a-group) must be set to `Partially protected` or `Not protected` for you to push a commit to the default branch. To add a [default branch](default.md) to a blank project: 1. On the left sidebar, select **Search or go to** and find your project. 1. Scroll to **The repository for this project is empty** and select the type of file you want to add. 1. In the Web IDE, make any desired changes to this file, then select **Create commit**. 1. Enter a commit message, and select **Commit**. GitLab creates a default branch and adds your file to it. ### From an issue When viewing an issue, you can create an associated branch directly from that page. Branches created this way use the [default pattern for branch names from issues](#configure-default-pattern-for-branch-names-from-issues), including variables. Prerequisites: - You must have at least the Developer role for the project. To create a branch from an issue: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Plan > Issues** and find your issue. 1. Below the issue description, select **Create merge request** {{< icon name="chevron-down" >}} to display the dropdown list. 1. Select **Create branch**. 1. In the dialog, from the **Source (branch or tag)** dropdown list, select a source branch or tag. 1. Review the suggested branch name. It's based on your project's [default branch name pattern](#configure-default-pattern-for-branch-names-from-issues). 1. Optional. If you need to use a different branch name, enter it in the **Branch name** text box. 1. Select **Create branch**. For information about creating branches in empty repositories, see [Empty repository behavior](#empty-repository-behavior). If the name of the created branch is [prefixed with the issue number](#prefix-branch-names-with-a-number), GitLab cross-links the issue and related merge request. ### From a task Prerequisites: - You must have at least the Developer role for the project. To create a branch directly from a task: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Plan > Issues**. 1. In the issue list, find your task. 1. Below the task description, select **Create merge request** {{< icon name="chevron-down" >}} to display the dropdown list. 1. Select **Create branch**. 1. In the dialog, from the **Source branch or tag** dropdown list, select a source branch or tag. 1. Review the suggested branch name. It's based on your project's [default branch name pattern](#configure-default-pattern-for-branch-names-from-issues). 1. Optional. If you need to use a different branch name, enter it in the **Branch name** text box. 1. Select **Create branch**. For information about creating branches in empty repositories, see [Empty repository behavior](#empty-repository-behavior). If the name of the created branch is [prefixed with the task number](#prefix-branch-names-with-a-number), GitLab cross-links the issue and related merge request. ### Empty repository behavior If your Git repository is empty, GitLab: - Creates a default branch. - Commits a blank `README.md` file to it. - Creates and redirects you to a new branch based on the issue title. - If your project is [configured with a deployment service](../../integrations/_index.md) like Kubernetes, GitLab prompts you to set up [auto deploy](../../../../topics/autodevops/stages.md#auto-deploy) by helping you create a `.gitlab-ci.yml` file. ## Name your branch Git enforces [branch name rules](https://git-scm.com/docs/git-check-ref-format) to help ensure branch names remain compatible with other tools. GitLab adds extra requirements for branch names, and provides benefits for well-structured branch names. GitLab enforces these additional rules on all branches: - No spaces are allowed in branch names. - Branch names with 40 hexadecimal characters are prohibited, because they are similar to Git commit hashes. - Branch names are case-sensitive. Common software packages, like Docker, can enforce [additional branch naming restrictions](../../../../administration/packages/container_registry_troubleshooting.md#docker-connection-error). For the best compatibility with other software packages, use only: - Numbers - Hyphens (`-`) - Underscores (`_`) - Lowercase letters from the ASCII standard table You can use forward slashes (`/`) and emoji in branch names, but compatibility with other software packages cannot be guaranteed. Branch names with specific formatting offer extra benefits: - Streamline your merge request workflow by [prefixing branch names with issue numbers](#prefix-branch-names-with-a-number). - Automate [branch protections](protected.md) based on branch name. - Test branch names with [push rules](../push_rules.md) before branches are pushed up to GitLab. - Define which [CI/CD jobs](../../../../ci/jobs/_index.md) to run on merge requests. ### Configure default pattern for branch names from issues By default, GitLab uses the pattern `%{id}-%{title}` when creating a branch from an issue, but you can change this pattern. Prerequisites: - You must have at least the Maintainer role for the project. To change the default pattern for branches created from issues: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Repository**. 1. Expand **Branch defaults**. 1. Scroll to **Branch name template** and enter a value. The field supports these variables: - `%{id}`: The numeric ID of the issue. - `%{title}`: The title of the issue, modified to use only characters acceptable in Git branch names. 1. Select **Save changes**. ### Prefix branch names with a number To streamline the creation of merge requests, start your Git branch name with the issue or task number, followed by a hyphen. For example, to link a branch to issue `#123`, start the branch name with `123-`. The branch must be in the same project as the issue or task. GitLab uses this number to import data into the merge request: - The item is marked as related to the merge request, and they display links to each other. - The branch is connected to the issue or task. - If your project is configured with a [default closing pattern](../../issues/managing_issues.md#default-closing-pattern), merging the merge request [also closes](../../issues/managing_issues.md#closing-issues-automatically) the related issue. - If the merge request is in the same project, and not a fork, the issue milestone and labels are copied to the merge request. ## Manage and protect branches GitLab provides multiple methods to protect individual branches. These methods ensure your branches receive oversight and quality checks from their creation to their deletion. To view and edit branch protections, see [Branch rules](branch_rules.md). ## Compare branches To compare branches in a repository: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Code > Compare revisions**. 1. Select the **Source** branch to search for your desired branch. Exact matches are shown first. You can refine your search with operators: - `^` matches the beginning of the branch name: `^feat` matches `feat/user-authentication`. - `$` matches the end of the branch name: `widget$` matches `feat/search-box-widget`. - `*` matches using a wildcard: `branch*cache*` matches `fix/branch-search-cache-expiration`. - You can combine operators: `^chore/*migration$` matches `chore/user-data-migration`. 1. Select the **Target** repository and branch. Exact matches are shown first. 1. Below **Show changes**, select the method to compare branches: <!-- vale gitlab_base.SubstitutionWarning = NO --> <!-- Disable Vale gitlab_base.SubstitutionWarning rule so that Vale doesn't flag "since" --> - **Only incoming changes from source** (default) shows differences from the source branch since the latest common commit on both branches. It doesn't include unrelated changes made to the target branch after the source branch was created. This method uses the `git diff <from>...<to>` [Git command](../../../../topics/git/commands.md). To compare branches, this method uses the merge base instead of the actual commit, so changes from cherry-picked commits are shown as new changes. - **Include changes to target since source was created** shows all the differences between the two branches. This method uses the `git diff <from> <to>` [Git command](../../../../topics/git/commands.md). <!-- vale gitlab_base.SubstitutionWarning = YES --> 1. Select **Compare** to show the list of commits, and changed files. 1. Optional. To reverse the **Source** and **Target**, select **Swap revisions** ({{< icon name="substitute" >}}). ### Download branch comparisons {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/217206) in GitLab 18.3. {{< /history >}} You can download the comparison between branches as a diff or patch file for use outside of GitLab. #### As a diff To download the branch comparison as a diff, add `format=diff` to the compare URL: - If the URL has no query parameters, append `?format=diff`: ```plaintext https://gitlab.example.com/my-group/my-project/-/compare/main...feature-branch?format=diff ``` - If the URL already has query parameters, append `&format=diff`: ```plaintext https://gitlab.example.com/my-group/my-project/-/compare/main...feature-branch?from_project_id=2&format=diff ``` To download and apply the diff: ```shell curl "https://gitlab.example.com/my-group/my-project/-/compare/main...feature-branch?format=diff" | git apply ``` #### As a patch file To download the branch comparison as a patch file, add `format=patch` to the compare URL: - If the URL has no query parameters, append `?format=patch`: ```plaintext https://gitlab.example.com/my-group/my-project/-/compare/main...feature-branch?format=patch ``` - If the URL already has query parameters, append `&format=patch`: ```plaintext https://gitlab.example.com/my-group/my-project/-/compare/main...feature-branch?from_project_id=2&format=patch ``` To download and apply the patch using [`git am`](https://git-scm.com/docs/git-am): ```shell # Download and preview the patch curl "https://gitlab.example.com/my-group/my-project/-/compare/main...feature-branch?format=patch" > changes.patch git apply --check changes.patch # Apply the patch git am changes.patch ``` You can also download and apply the patch in a single command: ```shell curl "https://gitlab.example.com/my-group/my-project/-/compare/main...feature-branch?format=patch" | git am ``` ## Delete merged branches Merged branches can be deleted in bulk if they meet all of these criteria: - They are not [protected branches](protected.md). - They have been merged into the project's default branch. Prerequisites: - You must have at least the Developer role for the project. To do this: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Code > Branches**. 1. In the upper right corner of the page, select **More** {{< icon name="ellipsis_v" >}}. 1. Select **Delete merged branches**. 1. In the dialog, enter the word `delete` to confirm, then select **Delete merged branches**. {{< alert type="note" >}} Deleting a branch does not completely erase all related data. Some information persists to maintain project history and to support recovery processes. For more information, see [Handle sensitive information](../../../../topics/git/undo.md#handle-sensitive-information). {{< /alert >}} ## Configure workflows for target branches {{< details >}} - Tier: Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/127115) in GitLab 16.4 [with a flag](../../../../administration/feature_flags/_index.md) named `target_branch_rules_flag`. Enabled by default. - [Feature flag removed](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/136431) in GitLab 16.7. {{< /history >}} Some projects use multiple long-term branches for development, like `develop` and `qa`. In these projects, you might want to keep `main` as the default branch, but expect merge requests to target `develop` or `qa` instead. Target branch workflows help ensure merge requests target the appropriate development branch for your project. When you create a merge request, the workflow checks the name of the branch. If the branch name matches the workflow, the merge request targets the branch you specify. If the branch name does not match, the merge request targets the default branch of the project. Rules are processed on a "first-match" basis - if two rules match the same branch name, the top-most rule is applied. Prerequisites: - You must have at least the Maintainer role. To create a target branch workflow: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Merge requests**. 1. Scroll down to **Merge request branch workflow** 1. Select **Add branch target**. 1. For **Branch name pattern**, provide a string or wild card to compare against branch names. 1. Select the **Target branch** to use when the branch name matches the **Branch name pattern**. 1. Select **Save**. ### Target branch workflow example You could configure your project to have the following target branch workflows: | Branch name pattern | Target branch | |-------------|---------------| | `feature/*` | `develop` | | `bug/*` | `develop` | | `release/*` | `main` | These target branches simplify the process of creating merge requests for a project that: - Uses `main` to represent the deployed state of your application. - Tracks current, unreleased development work in another long-running branch, like `develop`. If your workflow initially places new features in `develop` instead of `main`, these target branches ensure all branches matching either `feature/*` or `bug/*` do not target `main` by mistake. When you're ready to release to `main`, create a branch named `release/*`, and ensure this branch targets `main`. ### Delete a target branch workflow When you remove a target branch workflow, existing merge requests remain unchanged. Prerequisites: - You must have at least the Maintainer role. To do this: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Merge requests**. 1. Select **Delete** on the branch target you want to delete. ## Related topics - [Protected branches](protected.md) - [Branch rules](branch_rules.md) - [Compare changes in merge requests](../../merge_requests/changes.md) - [Download merge request changes](../../merge_requests/changes.md#download-merge-request-changes) - [Branches API](../../../../api/branches.md) - [Protected Branches API](../../../../api/protected_branches.md) - [Getting started with Git](../../../../topics/git/_index.md) - [Branches in a Nutshell](https://git-scm.com/book/en/v2/Git-Branching-Branches-in-a-Nutshell) ## Troubleshooting ### Multiple branches containing the same commit At a deeper technical level, Git branches aren't separate entities, but labels attached to a set of commit SHAs. When GitLab determines whether or not a branch has been merged, it checks the target branch for the existence of those commit SHAs. This behavior can cause unexpected results when two merge requests contain the same commits. In this example, branches `B` and `C` both start from the same commit (`3`) on branch `A`: ```mermaid %%{init: { "fontFamily": "GitLab Sans" }}%% gitGraph accTitle: Diagram of multiple branches with the same commit accDescr: Branches A and B contain the same commit, but branch B also contains other commits. Merging branch B makes branch A appear as merged, because all its commits are merged. commit id:"a" branch "branch A" commit id:"b" commit id:"c" type: HIGHLIGHT branch "branch B" commit id:"d" checkout "branch A" branch "branch C" commit id:"e" checkout main merge "branch B" id:"merges commits b, c, d" ``` If you merge branch `B`, branch `A` also appears as merged (without any action from you) because all commits from branch `A` now appear in the target branch `main`. Branch `C` remains unmerged, because commit `5` wasn't part of branch `A` or `B`. Merge request `A` remains merged, even if you attempt to push new commits to its branch. If any changes in merge request `A` remain unmerged (because they weren't part of merge request `A`), open a new merge request for them. ### Error: ambiguous `HEAD` branch exists In versions of Git earlier than 2.16.0, you could create a branch named `HEAD`. This branch named `HEAD` collides with the internal reference (also named `HEAD`) Git uses to describe the active (checked out) branch. This naming collision can prevent you from updating the default branch of your repository: ```plaintext Error: Could not set the default branch. Do you have a branch named 'HEAD' in your repository? ``` To fix this problem: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Code > Branches**. 1. Search for a branch named `HEAD`. 1. Make sure the branch has no uncommitted changes. 1. Select **Delete branch**, then **Yes, delete branch**. Git versions [2.16.0 and later](https://github.com/git/git/commit/a625b092cc59940521789fe8a3ff69c8d6b14eb2), prevent you from creating a branch with this name. ### Find all branches you've authored To find all branches you've authored in a project, run this command in a Git repository: ```shell git for-each-ref --format='%(authoremail) %(refname:short)' | grep $(git config --get user.email) ``` To get a total of all branches in a project, sorted by author, run this command in a Git repository: ```shell git for-each-ref --format='%(authoremail)' | sort | uniq -c | sort -g ``` ### Error: `Failed to create branch 4:Deadline Exceeded` This error is caused by a timeout in Gitaly. It occurs when creating a branch take longer to complete than the configured timeout period. To resolve this issue, choose one of the following: - Disable time-consuming [server hooks](../../../../administration/server_hooks.md). - Increase [Gitaly timeout](../../../../administration/settings/gitaly_timeouts.md) settings.
--- stage: Create group: Source Code info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments description: Understand how to name, manage, and protect Git branches. title: Branches breadcrumbs: - doc - user - project - repository - branches --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} Branches keep your team's development work organized and separated. When multiple people work on different features simultaneously, branches prevent changes from conflicting with each other. Each branch acts as an isolated workspace where you implement new features, fix bugs, or experiment with ideas. With branches, your team can: - Work on separate features without disrupting the main codebase. - Review proposed changes before they affect the rest of the project. - Roll back problematic changes without affecting other work. - Deploy changes to production in a controlled, predictable way. The development workflow for branches is: 1. [Create a branch](#create-a-branch) and add commits to it. To streamline this process, you should follow [branch naming patterns](#prefix-branch-names-with-a-number). 1. When the work is ready for review, create a [merge request](../../merge_requests/_index.md) to propose merging the changes in your branch. 1. Preview the changes with a [review app](../../../../ci/review_apps/_index.md). 1. [Request a review](../../merge_requests/reviews/_index.md#request-a-review). 1. After your merge request is approved, merge your branch to the origin branch. The [merge method](../../merge_requests/methods/_index.md) determines how merge requests are handled in your project. 1. After the contents of your branch are merged, [delete the merged branch](#delete-merged-branches). ## View all branches To view and manage your branches in the GitLab user interface: 1. On the left sidebar, select **Search or go to** and find your project. 1. On the left sidebar, select **Code > Branches**. On this page, you can: - See all branches, or filter to see only active or stale branches. A branch is considered active if a commit has been made to it in the last three months. Otherwise it is considered stale. - [Create new branches](#create-a-branch). - [Compare branches](#compare-branches). - [Delete merged branches](#delete-merged-branches). - See merge request links that point to the default branch. Branches with merge requests that do not point to the default branch display the {{< icon name="merge-request" >}} **New** merge request button. - [View branch rules](branch_rules.md#view-branch-rules). - See latest pipeline status on the branch. ## Create a branch Prerequisites: - You must have at least the Developer role for the project. To create a new branch from the GitLab UI: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Code > Branches**. 1. In the upper-right corner, select **New branch**. 1. Enter a **Branch name**. 1. In **Create from**, select the base of your branch: an existing branch, an existing tag, or a commit SHA. 1. Select **Create branch**. ### In a blank project A [blank project](../../_index.md#create-a-blank-project) does not contain a branch, but you can add one. Prerequisites: - You must have at least the Developer role for the project. - If you don't have the Maintainer or Owner role, the [default branch protection](../../../group/manage.md#change-the-default-branch-protection-of-a-group) must be set to `Partially protected` or `Not protected` for you to push a commit to the default branch. To add a [default branch](default.md) to a blank project: 1. On the left sidebar, select **Search or go to** and find your project. 1. Scroll to **The repository for this project is empty** and select the type of file you want to add. 1. In the Web IDE, make any desired changes to this file, then select **Create commit**. 1. Enter a commit message, and select **Commit**. GitLab creates a default branch and adds your file to it. ### From an issue When viewing an issue, you can create an associated branch directly from that page. Branches created this way use the [default pattern for branch names from issues](#configure-default-pattern-for-branch-names-from-issues), including variables. Prerequisites: - You must have at least the Developer role for the project. To create a branch from an issue: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Plan > Issues** and find your issue. 1. Below the issue description, select **Create merge request** {{< icon name="chevron-down" >}} to display the dropdown list. 1. Select **Create branch**. 1. In the dialog, from the **Source (branch or tag)** dropdown list, select a source branch or tag. 1. Review the suggested branch name. It's based on your project's [default branch name pattern](#configure-default-pattern-for-branch-names-from-issues). 1. Optional. If you need to use a different branch name, enter it in the **Branch name** text box. 1. Select **Create branch**. For information about creating branches in empty repositories, see [Empty repository behavior](#empty-repository-behavior). If the name of the created branch is [prefixed with the issue number](#prefix-branch-names-with-a-number), GitLab cross-links the issue and related merge request. ### From a task Prerequisites: - You must have at least the Developer role for the project. To create a branch directly from a task: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Plan > Issues**. 1. In the issue list, find your task. 1. Below the task description, select **Create merge request** {{< icon name="chevron-down" >}} to display the dropdown list. 1. Select **Create branch**. 1. In the dialog, from the **Source branch or tag** dropdown list, select a source branch or tag. 1. Review the suggested branch name. It's based on your project's [default branch name pattern](#configure-default-pattern-for-branch-names-from-issues). 1. Optional. If you need to use a different branch name, enter it in the **Branch name** text box. 1. Select **Create branch**. For information about creating branches in empty repositories, see [Empty repository behavior](#empty-repository-behavior). If the name of the created branch is [prefixed with the task number](#prefix-branch-names-with-a-number), GitLab cross-links the issue and related merge request. ### Empty repository behavior If your Git repository is empty, GitLab: - Creates a default branch. - Commits a blank `README.md` file to it. - Creates and redirects you to a new branch based on the issue title. - If your project is [configured with a deployment service](../../integrations/_index.md) like Kubernetes, GitLab prompts you to set up [auto deploy](../../../../topics/autodevops/stages.md#auto-deploy) by helping you create a `.gitlab-ci.yml` file. ## Name your branch Git enforces [branch name rules](https://git-scm.com/docs/git-check-ref-format) to help ensure branch names remain compatible with other tools. GitLab adds extra requirements for branch names, and provides benefits for well-structured branch names. GitLab enforces these additional rules on all branches: - No spaces are allowed in branch names. - Branch names with 40 hexadecimal characters are prohibited, because they are similar to Git commit hashes. - Branch names are case-sensitive. Common software packages, like Docker, can enforce [additional branch naming restrictions](../../../../administration/packages/container_registry_troubleshooting.md#docker-connection-error). For the best compatibility with other software packages, use only: - Numbers - Hyphens (`-`) - Underscores (`_`) - Lowercase letters from the ASCII standard table You can use forward slashes (`/`) and emoji in branch names, but compatibility with other software packages cannot be guaranteed. Branch names with specific formatting offer extra benefits: - Streamline your merge request workflow by [prefixing branch names with issue numbers](#prefix-branch-names-with-a-number). - Automate [branch protections](protected.md) based on branch name. - Test branch names with [push rules](../push_rules.md) before branches are pushed up to GitLab. - Define which [CI/CD jobs](../../../../ci/jobs/_index.md) to run on merge requests. ### Configure default pattern for branch names from issues By default, GitLab uses the pattern `%{id}-%{title}` when creating a branch from an issue, but you can change this pattern. Prerequisites: - You must have at least the Maintainer role for the project. To change the default pattern for branches created from issues: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Repository**. 1. Expand **Branch defaults**. 1. Scroll to **Branch name template** and enter a value. The field supports these variables: - `%{id}`: The numeric ID of the issue. - `%{title}`: The title of the issue, modified to use only characters acceptable in Git branch names. 1. Select **Save changes**. ### Prefix branch names with a number To streamline the creation of merge requests, start your Git branch name with the issue or task number, followed by a hyphen. For example, to link a branch to issue `#123`, start the branch name with `123-`. The branch must be in the same project as the issue or task. GitLab uses this number to import data into the merge request: - The item is marked as related to the merge request, and they display links to each other. - The branch is connected to the issue or task. - If your project is configured with a [default closing pattern](../../issues/managing_issues.md#default-closing-pattern), merging the merge request [also closes](../../issues/managing_issues.md#closing-issues-automatically) the related issue. - If the merge request is in the same project, and not a fork, the issue milestone and labels are copied to the merge request. ## Manage and protect branches GitLab provides multiple methods to protect individual branches. These methods ensure your branches receive oversight and quality checks from their creation to their deletion. To view and edit branch protections, see [Branch rules](branch_rules.md). ## Compare branches To compare branches in a repository: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Code > Compare revisions**. 1. Select the **Source** branch to search for your desired branch. Exact matches are shown first. You can refine your search with operators: - `^` matches the beginning of the branch name: `^feat` matches `feat/user-authentication`. - `$` matches the end of the branch name: `widget$` matches `feat/search-box-widget`. - `*` matches using a wildcard: `branch*cache*` matches `fix/branch-search-cache-expiration`. - You can combine operators: `^chore/*migration$` matches `chore/user-data-migration`. 1. Select the **Target** repository and branch. Exact matches are shown first. 1. Below **Show changes**, select the method to compare branches: <!-- vale gitlab_base.SubstitutionWarning = NO --> <!-- Disable Vale gitlab_base.SubstitutionWarning rule so that Vale doesn't flag "since" --> - **Only incoming changes from source** (default) shows differences from the source branch since the latest common commit on both branches. It doesn't include unrelated changes made to the target branch after the source branch was created. This method uses the `git diff <from>...<to>` [Git command](../../../../topics/git/commands.md). To compare branches, this method uses the merge base instead of the actual commit, so changes from cherry-picked commits are shown as new changes. - **Include changes to target since source was created** shows all the differences between the two branches. This method uses the `git diff <from> <to>` [Git command](../../../../topics/git/commands.md). <!-- vale gitlab_base.SubstitutionWarning = YES --> 1. Select **Compare** to show the list of commits, and changed files. 1. Optional. To reverse the **Source** and **Target**, select **Swap revisions** ({{< icon name="substitute" >}}). ### Download branch comparisons {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/217206) in GitLab 18.3. {{< /history >}} You can download the comparison between branches as a diff or patch file for use outside of GitLab. #### As a diff To download the branch comparison as a diff, add `format=diff` to the compare URL: - If the URL has no query parameters, append `?format=diff`: ```plaintext https://gitlab.example.com/my-group/my-project/-/compare/main...feature-branch?format=diff ``` - If the URL already has query parameters, append `&format=diff`: ```plaintext https://gitlab.example.com/my-group/my-project/-/compare/main...feature-branch?from_project_id=2&format=diff ``` To download and apply the diff: ```shell curl "https://gitlab.example.com/my-group/my-project/-/compare/main...feature-branch?format=diff" | git apply ``` #### As a patch file To download the branch comparison as a patch file, add `format=patch` to the compare URL: - If the URL has no query parameters, append `?format=patch`: ```plaintext https://gitlab.example.com/my-group/my-project/-/compare/main...feature-branch?format=patch ``` - If the URL already has query parameters, append `&format=patch`: ```plaintext https://gitlab.example.com/my-group/my-project/-/compare/main...feature-branch?from_project_id=2&format=patch ``` To download and apply the patch using [`git am`](https://git-scm.com/docs/git-am): ```shell # Download and preview the patch curl "https://gitlab.example.com/my-group/my-project/-/compare/main...feature-branch?format=patch" > changes.patch git apply --check changes.patch # Apply the patch git am changes.patch ``` You can also download and apply the patch in a single command: ```shell curl "https://gitlab.example.com/my-group/my-project/-/compare/main...feature-branch?format=patch" | git am ``` ## Delete merged branches Merged branches can be deleted in bulk if they meet all of these criteria: - They are not [protected branches](protected.md). - They have been merged into the project's default branch. Prerequisites: - You must have at least the Developer role for the project. To do this: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Code > Branches**. 1. In the upper right corner of the page, select **More** {{< icon name="ellipsis_v" >}}. 1. Select **Delete merged branches**. 1. In the dialog, enter the word `delete` to confirm, then select **Delete merged branches**. {{< alert type="note" >}} Deleting a branch does not completely erase all related data. Some information persists to maintain project history and to support recovery processes. For more information, see [Handle sensitive information](../../../../topics/git/undo.md#handle-sensitive-information). {{< /alert >}} ## Configure workflows for target branches {{< details >}} - Tier: Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/127115) in GitLab 16.4 [with a flag](../../../../administration/feature_flags/_index.md) named `target_branch_rules_flag`. Enabled by default. - [Feature flag removed](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/136431) in GitLab 16.7. {{< /history >}} Some projects use multiple long-term branches for development, like `develop` and `qa`. In these projects, you might want to keep `main` as the default branch, but expect merge requests to target `develop` or `qa` instead. Target branch workflows help ensure merge requests target the appropriate development branch for your project. When you create a merge request, the workflow checks the name of the branch. If the branch name matches the workflow, the merge request targets the branch you specify. If the branch name does not match, the merge request targets the default branch of the project. Rules are processed on a "first-match" basis - if two rules match the same branch name, the top-most rule is applied. Prerequisites: - You must have at least the Maintainer role. To create a target branch workflow: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Merge requests**. 1. Scroll down to **Merge request branch workflow** 1. Select **Add branch target**. 1. For **Branch name pattern**, provide a string or wild card to compare against branch names. 1. Select the **Target branch** to use when the branch name matches the **Branch name pattern**. 1. Select **Save**. ### Target branch workflow example You could configure your project to have the following target branch workflows: | Branch name pattern | Target branch | |-------------|---------------| | `feature/*` | `develop` | | `bug/*` | `develop` | | `release/*` | `main` | These target branches simplify the process of creating merge requests for a project that: - Uses `main` to represent the deployed state of your application. - Tracks current, unreleased development work in another long-running branch, like `develop`. If your workflow initially places new features in `develop` instead of `main`, these target branches ensure all branches matching either `feature/*` or `bug/*` do not target `main` by mistake. When you're ready to release to `main`, create a branch named `release/*`, and ensure this branch targets `main`. ### Delete a target branch workflow When you remove a target branch workflow, existing merge requests remain unchanged. Prerequisites: - You must have at least the Maintainer role. To do this: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Merge requests**. 1. Select **Delete** on the branch target you want to delete. ## Related topics - [Protected branches](protected.md) - [Branch rules](branch_rules.md) - [Compare changes in merge requests](../../merge_requests/changes.md) - [Download merge request changes](../../merge_requests/changes.md#download-merge-request-changes) - [Branches API](../../../../api/branches.md) - [Protected Branches API](../../../../api/protected_branches.md) - [Getting started with Git](../../../../topics/git/_index.md) - [Branches in a Nutshell](https://git-scm.com/book/en/v2/Git-Branching-Branches-in-a-Nutshell) ## Troubleshooting ### Multiple branches containing the same commit At a deeper technical level, Git branches aren't separate entities, but labels attached to a set of commit SHAs. When GitLab determines whether or not a branch has been merged, it checks the target branch for the existence of those commit SHAs. This behavior can cause unexpected results when two merge requests contain the same commits. In this example, branches `B` and `C` both start from the same commit (`3`) on branch `A`: ```mermaid %%{init: { "fontFamily": "GitLab Sans" }}%% gitGraph accTitle: Diagram of multiple branches with the same commit accDescr: Branches A and B contain the same commit, but branch B also contains other commits. Merging branch B makes branch A appear as merged, because all its commits are merged. commit id:"a" branch "branch A" commit id:"b" commit id:"c" type: HIGHLIGHT branch "branch B" commit id:"d" checkout "branch A" branch "branch C" commit id:"e" checkout main merge "branch B" id:"merges commits b, c, d" ``` If you merge branch `B`, branch `A` also appears as merged (without any action from you) because all commits from branch `A` now appear in the target branch `main`. Branch `C` remains unmerged, because commit `5` wasn't part of branch `A` or `B`. Merge request `A` remains merged, even if you attempt to push new commits to its branch. If any changes in merge request `A` remain unmerged (because they weren't part of merge request `A`), open a new merge request for them. ### Error: ambiguous `HEAD` branch exists In versions of Git earlier than 2.16.0, you could create a branch named `HEAD`. This branch named `HEAD` collides with the internal reference (also named `HEAD`) Git uses to describe the active (checked out) branch. This naming collision can prevent you from updating the default branch of your repository: ```plaintext Error: Could not set the default branch. Do you have a branch named 'HEAD' in your repository? ``` To fix this problem: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Code > Branches**. 1. Search for a branch named `HEAD`. 1. Make sure the branch has no uncommitted changes. 1. Select **Delete branch**, then **Yes, delete branch**. Git versions [2.16.0 and later](https://github.com/git/git/commit/a625b092cc59940521789fe8a3ff69c8d6b14eb2), prevent you from creating a branch with this name. ### Find all branches you've authored To find all branches you've authored in a project, run this command in a Git repository: ```shell git for-each-ref --format='%(authoremail) %(refname:short)' | grep $(git config --get user.email) ``` To get a total of all branches in a project, sorted by author, run this command in a Git repository: ```shell git for-each-ref --format='%(authoremail)' | sort | uniq -c | sort -g ``` ### Error: `Failed to create branch 4:Deadline Exceeded` This error is caused by a timeout in Gitaly. It occurs when creating a branch take longer to complete than the configured timeout period. To resolve this issue, choose one of the following: - Disable time-consuming [server hooks](../../../../administration/server_hooks.md). - Increase [Gitaly timeout](../../../../administration/settings/gitaly_timeouts.md) settings.
https://docs.gitlab.com/user/project/repository/default
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/repository/default.md
2025-08-13
doc/user/project/repository/branches
[ "doc", "user", "project", "repository", "branches" ]
default.md
Create
Source Code
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Default branch
Use Git branches to develop new features. Add branch protections to critical branches to ensure only trusted users can merge into them.
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} When you create a new [project](../../_index.md), GitLab creates a default branch in the repository. A default branch has special configuration options not shared by other branches: - It cannot be deleted. - It's [initially protected](protected.md) against forced pushes. - When a merge request uses an [issue closing pattern](../../issues/managing_issues.md#closing-issues-automatically) to close an issue, the work is merged into this branch. The name of your [new project's](../../_index.md) default branch depends on any configuration changes made to your instance or group by your GitLab administrator. GitLab checks first for specific customizations, then checks at a broader level, using the GitLab default only if no customizations are set: 1. A [project-specific](#change-the-default-branch-name-for-a-project) custom default branch name. 1. [Custom group default branch name](#change-the-default-branch-name-for-new-projects-in-a-group) specified in a project's direct subgroup. 1. Custom group default branch name specified in a project's top-level group. 1. A custom default branch name set for the [instance](#change-the-default-branch-name-for-new-projects-in-an-instance). 1. If no custom default branch name is set at any level, GitLab defaults to `main`. In the GitLab UI, you can change the defaults at any level. GitLab also provides the [Git commands you need](#update-the-default-branch-name-in-your-repository) to update your copy of the repository. ## Change the default branch name for a project Prerequisites: - You have the Owner or Maintainer role for the project. To update the default branch for an individual [project](../../_index.md): 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Repository**. 1. Expand **Branch defaults**. For **Default branch**, select a new default branch. 1. Optional. Select the **Auto-close referenced issues on default branch** checkbox to close issues when a merge request [uses a closing pattern](../../issues/managing_issues.md#closing-issues-automatically). 1. Select **Save changes**. API users can also use the `default_branch` attribute of the [Projects API](../../../../api/projects.md) when creating or editing a project. ## Change the default branch name for new projects in an instance {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab Self-Managed, GitLab Dedicated {{< /details >}} [Administrators](../../../permissions.md) of GitLab Self-Managed can customize the initial branch for projects hosted on that instance. Individual groups and subgroups can override the instance default for their projects. 1. On the left sidebar, at the bottom, select **Admin**. 1. Select **Settings > Repository**. 1. Expand **Default branch**. 1. For **Initial default branch name**, select a new default branch. 1. Select **Save changes**. Projects created on this instance after you change the setting use the custom branch name, unless a group or subgroup configuration overrides it. ## Change the default branch name for new projects in a group Prerequisites: - You must have the Owner role for the group and subgroups. To change the default branch name for new projects in a group: 1. On the left sidebar, select **Search or go to** and find your group. 1. Select **Settings > Repository**. 1. Expand **Default branch**. 1. For **Initial default branch name**, select a new default branch. 1. Select **Save changes**. Projects created in this group after you change the setting use the custom branch name, unless a subgroup configuration overrides it. ## Protect initial default branches {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} {{< history >}} - Full protection after initial push [introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/118729) in GitLab 16.0. {{< /history >}} GitLab administrators and group owners can define [branch protections](protected.md) to apply to every repository's default branch for the instance, or for individual groups, with one of these options: - **Fully protected** - Default value. Developers cannot push new commits, but maintainers can. No one can force push. - **Fully protected after initial push** - Developers can push the initial commit to a repository, but none afterward. Maintainers can always push. No one can force push. - **Protected against pushes** - Developers cannot push new commits, but are allowed to accept merge requests to the branch. Maintainers can push to the branch. - **Partially protected** - Both developers and maintainers can push new commits, but cannot force push. - **Not protected** - Both developers and maintainers can push new commits and force push. {{< alert type="warning" >}} Unless **Fully protected** is chosen, a malicious developer could attempt to steal your sensitive data. For example, a malicious `.gitlab-ci.yml` file could be committed to a protected branch and later, if a pipeline is run against that branch, result in exfiltration of group CI/CD variables. {{< /alert >}} ### For all projects in an instance {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab Self-Managed, GitLab Dedicated {{< /details >}} This setting applies only to each repository's default branch. To protect other branches, you must either: - Configure [branch protection in the repository](protected.md). - Configure [branch protection for groups](../../../group/manage.md#change-the-default-branch-protection-of-a-group). Administrators of GitLab Self-Managed instances can customize the initial default branch protection for projects hosted on that instance. Individual groups and subgroups can override the instance default setting for their projects. 1. On the left sidebar, at the bottom, select **Admin**. 1. Select **Settings > Repository**. 1. Expand **Default branch**. 1. Select [**Initial default branch protection**](#protect-initial-default-branches). 1. To allow group owners to override the instance's default branch protection, select [**Allow owners to manage default branch protection per group**](#prevent-overrides-of-default-branch-protection). 1. Select **Save changes**. #### Prevent overrides of default branch protection {{< details >}} - Tier: Premium, Ultimate - Offering: GitLab Self-Managed, GitLab Dedicated {{< /details >}} Group owners can override protections for default branches set for an entire instance on a per-group basis. In [GitLab Premium or Ultimate](https://about.gitlab.com/pricing/), GitLab administrators can disable this privilege for group owners, enforcing the protection rule set for the instance: 1. On the left sidebar, at the bottom, select **Admin**. 1. Select **Settings > Repository**. 1. Expand the **Default branch** section. 1. Clear the **Allow owners to manage default branch protection per group** checkbox. 1. Select **Save changes**. {{< alert type="note" >}} GitLab administrators can still update the default branch protection of a group. {{< /alert >}} ### For all projects in a group {{< details >}} - Tier: Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} Group owners can override protections for default branches set for an entire instance on a per-group basis. In [GitLab Premium or Ultimate](https://about.gitlab.com/pricing/), GitLab administrators can [enforce protection of initial default branches](#prevent-overrides-of-default-branch-protection) which locks this setting for group owners. 1. On the left sidebar, select **Search or go to** and find your group. 1. Select **Settings > Repository**. 1. Expand **Default branch**. 1. Select [**Initial default branch protection**](#protect-initial-default-branches). 1. Select **Save changes**. ## Update the default branch name in your repository {{< alert type="warning" >}} Changing the name of your default branch can potentially break tests, CI/CD configuration, services, helper utilities, and any integrations your repository uses. Before you change this branch name, consult with your project owners and maintainers. Ensure they understand the scope of this change includes references to the old branch name in related code and scripts. {{< /alert >}} When you change the default branch name for an existing repository, don't create a new branch. Preserve the history of your default branch by renaming it. This example renames a Git repository's (`example`) default branch: 1. On your local command line, go to your `example` repository, and ensure you're on the default branch: ```plaintext cd example git checkout master ``` 1. Rename the existing default branch to the new name (`main`). The argument `-m` transfers all commit history to the new branch: ```plaintext git branch -m master main ``` 1. Push the newly created `main` branch upstream, and set your local branch to track the remote branch with the same name: ```plaintext git push -u origin main ``` 1. If you plan to remove the old default branch, update `HEAD` to point to your new default branch, `main`: ```plaintext git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/main ``` 1. Sign in to GitLab with at least the Maintainer role and follow the instructions to [change the default branch for this project](#change-the-default-branch-name-for-a-project). Select `main` as your new default branch. 1. Protect your new `main` branch as described in the [protected branches documentation](protected.md). 1. Optional. If you want to delete the old default branch: 1. Verify that nothing is pointing to it. 1. Delete the branch on the remote: ```plaintext git push origin --delete master ``` You can delete the branch at a later time, after you confirm the new default branch is working as expected. 1. Notify your project contributors of this change, because they must also take some steps: - Contributors should pull the new default branch to their local copy of the repository. - Contributors with open merge requests that target the old default branch should manually re-point the merge requests to use `main` instead. 1. In your repository, update any references to the old branch name in your code. 1. Update references to the old branch name in related code and scripts that reside outside your repository, such as helper utilities and integrations. ## Default branch rename redirect URLs for specific files or directories in a project embed the project's default branch name, and are often found in documentation or browser bookmarks. When you [update the default branch name in your repository](#update-the-default-branch-name-in-your-repository), these URLs change, and must be updated. To ease the transition period, whenever the default branch for a project is changed, GitLab records the name of the old default branch. If that branch is deleted, attempts to view a file or directory on it are redirected to the current default branch, instead of displaying the "not found" page. ## Related topics - [Configure a default branch for your wiki](../../wiki/_index.md) - [Discussion of default branch renaming](https://lore.kernel.org/git/pull.656.v4.git.1593009996.gitgitgadget@gmail.com/) on the Git mailing list - [March 2021 blog post: The new Git default branch name](https://about.gitlab.com/blog/2021/03/10/new-git-default-branch-name/) ## Troubleshooting ### Unable to change default branch: resets to current branch We are tracking this problem in [issue 20474](https://gitlab.com/gitlab-org/gitlab/-/issues/20474). This issue often occurs when a branch named `HEAD` is present in the repository. To fix the problem: 1. In your local repository, create a new temporary branch and push it: ```shell git checkout -b tmp_default && git push -u origin tmp_default ``` 1. In GitLab, proceed to [change the default branch](#change-the-default-branch-name-for-a-project) to that temporary branch. 1. From your local repository, delete the `HEAD` branch: ```shell git push -d origin HEAD ``` 1. In GitLab, [change the default branch](#change-the-default-branch-name-for-a-project) to the one you intend to use. ### Query GraphQL for default branches You can use a [GraphQL query](../../../../api/graphql/_index.md) to retrieve the default branches for all projects in a group. To return all projects in a single page of results, replace `GROUPNAME` with the full path to your group. GitLab returns the first page of results. If `hasNextPage` is `true`, you can request the next page by replacing the `null` in `after: null` with the value of `endCursor`: ```graphql { group(fullPath: "GROUPNAME") { projects(after: null) { pageInfo { hasNextPage endCursor } nodes { name repository { rootRef } } } } } ``` ### New subgroups do not inherit default branch name from a higher-level subgroup When you configured a default branch in a subgroup that contains another subgroup that contains a project, the default branch is not inherited. We are tracking this problem in [issue 327208](https://gitlab.com/gitlab-org/gitlab/-/issues/327208).
--- stage: Create group: Source Code info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments description: Use Git branches to develop new features. Add branch protections to critical branches to ensure only trusted users can merge into them. title: Default branch breadcrumbs: - doc - user - project - repository - branches --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} When you create a new [project](../../_index.md), GitLab creates a default branch in the repository. A default branch has special configuration options not shared by other branches: - It cannot be deleted. - It's [initially protected](protected.md) against forced pushes. - When a merge request uses an [issue closing pattern](../../issues/managing_issues.md#closing-issues-automatically) to close an issue, the work is merged into this branch. The name of your [new project's](../../_index.md) default branch depends on any configuration changes made to your instance or group by your GitLab administrator. GitLab checks first for specific customizations, then checks at a broader level, using the GitLab default only if no customizations are set: 1. A [project-specific](#change-the-default-branch-name-for-a-project) custom default branch name. 1. [Custom group default branch name](#change-the-default-branch-name-for-new-projects-in-a-group) specified in a project's direct subgroup. 1. Custom group default branch name specified in a project's top-level group. 1. A custom default branch name set for the [instance](#change-the-default-branch-name-for-new-projects-in-an-instance). 1. If no custom default branch name is set at any level, GitLab defaults to `main`. In the GitLab UI, you can change the defaults at any level. GitLab also provides the [Git commands you need](#update-the-default-branch-name-in-your-repository) to update your copy of the repository. ## Change the default branch name for a project Prerequisites: - You have the Owner or Maintainer role for the project. To update the default branch for an individual [project](../../_index.md): 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Repository**. 1. Expand **Branch defaults**. For **Default branch**, select a new default branch. 1. Optional. Select the **Auto-close referenced issues on default branch** checkbox to close issues when a merge request [uses a closing pattern](../../issues/managing_issues.md#closing-issues-automatically). 1. Select **Save changes**. API users can also use the `default_branch` attribute of the [Projects API](../../../../api/projects.md) when creating or editing a project. ## Change the default branch name for new projects in an instance {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab Self-Managed, GitLab Dedicated {{< /details >}} [Administrators](../../../permissions.md) of GitLab Self-Managed can customize the initial branch for projects hosted on that instance. Individual groups and subgroups can override the instance default for their projects. 1. On the left sidebar, at the bottom, select **Admin**. 1. Select **Settings > Repository**. 1. Expand **Default branch**. 1. For **Initial default branch name**, select a new default branch. 1. Select **Save changes**. Projects created on this instance after you change the setting use the custom branch name, unless a group or subgroup configuration overrides it. ## Change the default branch name for new projects in a group Prerequisites: - You must have the Owner role for the group and subgroups. To change the default branch name for new projects in a group: 1. On the left sidebar, select **Search or go to** and find your group. 1. Select **Settings > Repository**. 1. Expand **Default branch**. 1. For **Initial default branch name**, select a new default branch. 1. Select **Save changes**. Projects created in this group after you change the setting use the custom branch name, unless a subgroup configuration overrides it. ## Protect initial default branches {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} {{< history >}} - Full protection after initial push [introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/118729) in GitLab 16.0. {{< /history >}} GitLab administrators and group owners can define [branch protections](protected.md) to apply to every repository's default branch for the instance, or for individual groups, with one of these options: - **Fully protected** - Default value. Developers cannot push new commits, but maintainers can. No one can force push. - **Fully protected after initial push** - Developers can push the initial commit to a repository, but none afterward. Maintainers can always push. No one can force push. - **Protected against pushes** - Developers cannot push new commits, but are allowed to accept merge requests to the branch. Maintainers can push to the branch. - **Partially protected** - Both developers and maintainers can push new commits, but cannot force push. - **Not protected** - Both developers and maintainers can push new commits and force push. {{< alert type="warning" >}} Unless **Fully protected** is chosen, a malicious developer could attempt to steal your sensitive data. For example, a malicious `.gitlab-ci.yml` file could be committed to a protected branch and later, if a pipeline is run against that branch, result in exfiltration of group CI/CD variables. {{< /alert >}} ### For all projects in an instance {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab Self-Managed, GitLab Dedicated {{< /details >}} This setting applies only to each repository's default branch. To protect other branches, you must either: - Configure [branch protection in the repository](protected.md). - Configure [branch protection for groups](../../../group/manage.md#change-the-default-branch-protection-of-a-group). Administrators of GitLab Self-Managed instances can customize the initial default branch protection for projects hosted on that instance. Individual groups and subgroups can override the instance default setting for their projects. 1. On the left sidebar, at the bottom, select **Admin**. 1. Select **Settings > Repository**. 1. Expand **Default branch**. 1. Select [**Initial default branch protection**](#protect-initial-default-branches). 1. To allow group owners to override the instance's default branch protection, select [**Allow owners to manage default branch protection per group**](#prevent-overrides-of-default-branch-protection). 1. Select **Save changes**. #### Prevent overrides of default branch protection {{< details >}} - Tier: Premium, Ultimate - Offering: GitLab Self-Managed, GitLab Dedicated {{< /details >}} Group owners can override protections for default branches set for an entire instance on a per-group basis. In [GitLab Premium or Ultimate](https://about.gitlab.com/pricing/), GitLab administrators can disable this privilege for group owners, enforcing the protection rule set for the instance: 1. On the left sidebar, at the bottom, select **Admin**. 1. Select **Settings > Repository**. 1. Expand the **Default branch** section. 1. Clear the **Allow owners to manage default branch protection per group** checkbox. 1. Select **Save changes**. {{< alert type="note" >}} GitLab administrators can still update the default branch protection of a group. {{< /alert >}} ### For all projects in a group {{< details >}} - Tier: Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} Group owners can override protections for default branches set for an entire instance on a per-group basis. In [GitLab Premium or Ultimate](https://about.gitlab.com/pricing/), GitLab administrators can [enforce protection of initial default branches](#prevent-overrides-of-default-branch-protection) which locks this setting for group owners. 1. On the left sidebar, select **Search or go to** and find your group. 1. Select **Settings > Repository**. 1. Expand **Default branch**. 1. Select [**Initial default branch protection**](#protect-initial-default-branches). 1. Select **Save changes**. ## Update the default branch name in your repository {{< alert type="warning" >}} Changing the name of your default branch can potentially break tests, CI/CD configuration, services, helper utilities, and any integrations your repository uses. Before you change this branch name, consult with your project owners and maintainers. Ensure they understand the scope of this change includes references to the old branch name in related code and scripts. {{< /alert >}} When you change the default branch name for an existing repository, don't create a new branch. Preserve the history of your default branch by renaming it. This example renames a Git repository's (`example`) default branch: 1. On your local command line, go to your `example` repository, and ensure you're on the default branch: ```plaintext cd example git checkout master ``` 1. Rename the existing default branch to the new name (`main`). The argument `-m` transfers all commit history to the new branch: ```plaintext git branch -m master main ``` 1. Push the newly created `main` branch upstream, and set your local branch to track the remote branch with the same name: ```plaintext git push -u origin main ``` 1. If you plan to remove the old default branch, update `HEAD` to point to your new default branch, `main`: ```plaintext git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/main ``` 1. Sign in to GitLab with at least the Maintainer role and follow the instructions to [change the default branch for this project](#change-the-default-branch-name-for-a-project). Select `main` as your new default branch. 1. Protect your new `main` branch as described in the [protected branches documentation](protected.md). 1. Optional. If you want to delete the old default branch: 1. Verify that nothing is pointing to it. 1. Delete the branch on the remote: ```plaintext git push origin --delete master ``` You can delete the branch at a later time, after you confirm the new default branch is working as expected. 1. Notify your project contributors of this change, because they must also take some steps: - Contributors should pull the new default branch to their local copy of the repository. - Contributors with open merge requests that target the old default branch should manually re-point the merge requests to use `main` instead. 1. In your repository, update any references to the old branch name in your code. 1. Update references to the old branch name in related code and scripts that reside outside your repository, such as helper utilities and integrations. ## Default branch rename redirect URLs for specific files or directories in a project embed the project's default branch name, and are often found in documentation or browser bookmarks. When you [update the default branch name in your repository](#update-the-default-branch-name-in-your-repository), these URLs change, and must be updated. To ease the transition period, whenever the default branch for a project is changed, GitLab records the name of the old default branch. If that branch is deleted, attempts to view a file or directory on it are redirected to the current default branch, instead of displaying the "not found" page. ## Related topics - [Configure a default branch for your wiki](../../wiki/_index.md) - [Discussion of default branch renaming](https://lore.kernel.org/git/pull.656.v4.git.1593009996.gitgitgadget@gmail.com/) on the Git mailing list - [March 2021 blog post: The new Git default branch name](https://about.gitlab.com/blog/2021/03/10/new-git-default-branch-name/) ## Troubleshooting ### Unable to change default branch: resets to current branch We are tracking this problem in [issue 20474](https://gitlab.com/gitlab-org/gitlab/-/issues/20474). This issue often occurs when a branch named `HEAD` is present in the repository. To fix the problem: 1. In your local repository, create a new temporary branch and push it: ```shell git checkout -b tmp_default && git push -u origin tmp_default ``` 1. In GitLab, proceed to [change the default branch](#change-the-default-branch-name-for-a-project) to that temporary branch. 1. From your local repository, delete the `HEAD` branch: ```shell git push -d origin HEAD ``` 1. In GitLab, [change the default branch](#change-the-default-branch-name-for-a-project) to the one you intend to use. ### Query GraphQL for default branches You can use a [GraphQL query](../../../../api/graphql/_index.md) to retrieve the default branches for all projects in a group. To return all projects in a single page of results, replace `GROUPNAME` with the full path to your group. GitLab returns the first page of results. If `hasNextPage` is `true`, you can request the next page by replacing the `null` in `after: null` with the value of `endCursor`: ```graphql { group(fullPath: "GROUPNAME") { projects(after: null) { pageInfo { hasNextPage endCursor } nodes { name repository { rootRef } } } } } ``` ### New subgroups do not inherit default branch name from a higher-level subgroup When you configured a default branch in a subgroup that contains another subgroup that contains a project, the default branch is not inherited. We are tracking this problem in [issue 327208](https://gitlab.com/gitlab-org/gitlab/-/issues/327208).
https://docs.gitlab.com/user/project/repository/branch_rules
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/repository/branch_rules.md
2025-08-13
doc/user/project/repository/branches
[ "doc", "user", "project", "repository", "branches" ]
branch_rules.md
Create
Source Code
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Branch rules
Understand how to name, manage, and protect Git branches.
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} GitLab provides multiple methods to protect individual branches. These methods ensure your branches receive oversight and quality checks from their creation to their deletion: - Apply enhanced security and protection to your project's [default branch](default.md). - Configure [protected branches](protected.md) to: - Limit who can push and merge to a branch. - Manage if users can force push to the branch. - Manage if changes to files listed in the `CODEOWNERS` file can be pushed directly to the branch. - Configure [approval rules](../../merge_requests/approvals/rules.md#approvals-for-protected-branches) to manage review requirements and implement [security-related approvals](../../merge_requests/approvals/rules.md#security-approvals). - Integrate with third-party [status checks](../../merge_requests/status_checks.md) to ensure the contents of your branch meets your defined quality standards. You can manage your branches: - With the GitLab user interface. - With Git on the command line. - With the [Branches API](../../../../api/branches.md). ## View branch rules {{< history >}} - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/123368) in GitLab 16.1. Feature flag `branch_rules` removed. {{< /history >}} The branch rules overview page shows all branches with any configured protections, and their protection methods: ![Example of a branch with configured protections](img/view_branch_protections_v15_10.png) Prerequisites: - You must have at least the Maintainer role for the project. To view the branch rules overview list: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Repository**. 1. Expand **Branch rules** to view all branches with protections. ### View branch rule details To view branch rules and protections for a single branch: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Repository**. 1. Expand **Branch rules** to view all branches with protections. 1. Identify the branch you want and select **View details**. ## Create a branch rule {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/88279) in GitLab 16.8 with a flag named `add_branch_rules`. Disabled by default. - Feature flag `add_branch_rules` [renamed](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/88279) to `edit_branch_rules` in GitLab 16.11. Disabled by default. - **All branches** and **All protected branches** options [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/388129) in GitLab 17.0. - [Enabled on GitLab.com](https://gitlab.com/gitlab-org/gitlab/-/issues/454501) in GitLab 17.4. - [Enabled on GitLab Self-Managed and GitLab Dedicated](https://gitlab.com/gitlab-org/gitlab/-/issues/454501) in GitLab 17.5. {{< /history >}} {{< alert type="flag" >}} The availability of this feature is controlled by a feature flag. For more information, see the history. {{< /alert >}} Prerequisites: - You must have at least the Maintainer role for the project. To create a branch rule: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Repository**. 1. Expand **Branch rules**. 1. Select **Add branch rule**. 1. Choose one of the following options: - To enter a specific branch name or pattern: 1. Select **Branch name or pattern**. 1. From the **Create branch rule** dropdown list, select a branch name or create a [wildcard](protected.md#use-wildcard-rules) with `*`. - To protect all branches in the project: 1. Select **All branches**. 1. On the rule's details page, under **Merge request approvals**, enter the required number of approvals for the rule. - To protect all branches in the project that are already specified as protected: 1. Select **All protected branches**. 1. On the rule's details page, under **Merge request approvals**, enter the required number of approvals for the rule. ### Add a branch rule protection {{< alert type="note" >}} Not available for `all branches`. {{< /alert >}} To add protections to a new branch: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Repository**. 1. Expand **Branch rules**. 1. Select **Add branch rule**. 1. Select one of **All protected branches** or **Branch name or pattern**. 1. Select **Create protected branch**. ### Add an approval rule {{< details >}} - Tier: Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} {{< alert type="note" >}} Not available for `all branches`. {{< /alert >}} Prerequisites: - You must have at least the Maintainer role for the project. To add a merge request approval rule: 1. From the [branch rule details](#view-branch-rule-details) page, go to the **Merge request approvals** section. 1. In the **Approval rules** section, select **Add approval rule**. 1. On the right sidebar, complete the fields: - Enter a **Rule name**. - In **Required number of approvals**, enter a value (`0`-`100`). A value of `0` makes [the rule optional](../../merge_requests/approvals/rules.md#configure-optional-approval-rules), and any number greater than `0` creates a required rule. The maximum number of required approvals is `100`. - Select users or groups that are [eligible to approve](../../merge_requests/approvals/rules.md#eligible-approvers). GitLab suggests approvers based on previous authors of the files changed by the merge request. 1. Select **Save changes**. For additional information, see [Approval rules](../../merge_requests/approvals/rules.md#approvals-for-protected-branches). ### Edit squash commits option {{< details >}} - Tier: Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/181370) in GitLab 17.9 with a flag named `branch_rule_squash_settings`. Disabled by default. - [Enabled on GitLab.com, GitLab Self-Managed, and GitLab Dedicated](https://gitlab.com/gitlab-org/gitlab/-/issues/506542) in GitLab 17.10. - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/issues/524860) in GitLab 17.11. Feature flag `branch_rule_squash_settings` removed. {{< /history >}} Prerequisites: - You must have at least the Maintainer role for the project. - In GitLab Free, this feature is available only if the branch rule targets **All branches**. - In GitLab Premium and GitLab Ultimate, this feature is available for all branch rules. To edit a squash option: 1. From the [branch rule details](#view-branch-rule-details) page, go to the **Squash commits when merging** section. 1. Select **Edit**. 1. Select one of the following options: - **Do not allow**: Squashing is never allowed and the checkbox is hidden. - **Allow**: Checkbox is visible and unselected by default. - **Encourage**: Checkbox is visible and selected by default. - **Require**: Squashing is always performed. Checkbox is visible and selected, and users cannot change it. 1. Select **Save changes**. ### Add a status check service {{< details >}} - Tier: Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} {{< history >}} - [Introduced](https://gitlab.com/groups/gitlab-org/-/epics/12522) in GitLab 17.4 [with a flag](../../../../administration/feature_flags/_index.md) named `edit_branch_rules`. Disabled by default. - [Enabled on GitLab.com](https://gitlab.com/gitlab-org/gitlab/-/issues/454501) in GitLab 17.4. - [Enabled on GitLab Self-Managed and GitLab Dedicated](https://gitlab.com/gitlab-org/gitlab/-/issues/454501) in GitLab 17.5. {{< /history >}} {{< alert type="note" >}} Not available for `all protected branches`. {{< /alert >}} To add a status check service: 1. From the [branch rule details](#view-branch-rule-details) page, go to the **Status checks** section. 1. Select **Add status check**. 1. Enter the **Service name**. 1. In the **API to check** field, enter the URL. You should use an HTTPS URL to protect your merge request data in transit. ![Branch rules status checks](img/branch_rule_status_check_v17_4.png) For more information, see [External status checks](../../merge_requests/status_checks.md). ## Edit a branch rule target {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/88279) in GitLab 16.8 with a flag named `add_branch_rules`. Disabled by default. - Feature flag `add_branch_rules` [renamed](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/88279) to `edit_branch_rules` in GitLab 16.11. Disabled by default. - [Enabled on GitLab.com](https://gitlab.com/gitlab-org/gitlab/-/issues/454501) in GitLab 17.4. - [Enabled on GitLab Self-Managed and GitLab Dedicated](https://gitlab.com/gitlab-org/gitlab/-/issues/454501) in GitLab 17.5. {{< /history >}} {{< alert type="flag" >}} The availability of this feature is controlled by a feature flag. For more information, see the history. {{< /alert >}} Prerequisites: - You must have at least the Maintainer role for the project. To edit a branch rule target: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Repository**. 1. Expand **Branch rules** to view all branches with protections. 1. Identify the branch you want and select **View details**. 1. In the **Rule target** section, select **Edit**. 1. Edit the information as needed. 1. Select **Update**. ### Edit a branch rule protection {{< alert type="note" >}} Not available for `all branches`. {{< /alert >}} To edit branch rule protections: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Repository**. 1. Expand **Branch rules** to view all branches with protections. 1. Identify the branch you want and select **View details**. 1. From the **Protect branch** section, choose one of the following options: - From **Allowed to merge**, select **Edit**. 1. Select the roles that can merge into this branch. 1. Select **Save changes**. - From **Allowed to push and merge**, select **Edit**. 1. Select the roles that can merge into this branch. 1. If desired, search to add **Deploy keys**. 1. Select **Save changes**. {{< alert type="note" >}} In GitLab Premium and Ultimate, you can also add groups or individual users to **Allowed to merge** and **Allowed to push and merge**. {{< /alert >}} For additional information about branch protection controls, see [Protected branches](protected.md). ## Delete a branch rule {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/88279) in GitLab 16.8 with a flag named `add_branch_rules`. Disabled by default. - Feature flag `add_branch_rules` [renamed](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/88279) to `edit_branch_rules` in GitLab 16.11. Disabled by default. - [Enabled on GitLab.com](https://gitlab.com/gitlab-org/gitlab/-/issues/454501) in GitLab 17.4. - [Enabled on GitLab Self-Managed and GitLab Dedicated](https://gitlab.com/gitlab-org/gitlab/-/issues/454501) in GitLab 17.5. {{< /history >}} {{< alert type="flag" >}} The availability of this feature is controlled by a feature flag. For more information, see the history. {{< /alert >}} {{< alert type="note" >}} Deleting a branch rule is not available for rules targeting `all branches`. {{< /alert >}} Prerequisites: - You must have at least the Maintainer role for the project. To delete a branch rule: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Repository**. 1. Expand **Branch rules**. 1. Next to a rule you want to delete, select **View details**. 1. In the upper-right corner, select **Delete rule**. 1. On the confirmation dialog, select **Delete branch rule**. ## Related topics - [Default branch](default.md) - [Protected branches](protected.md) - [Branching strategies](strategies/_index.md) - [Merge request approvals](../../merge_requests/approvals/_index.md)
--- stage: Create group: Source Code info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments description: Understand how to name, manage, and protect Git branches. title: Branch rules breadcrumbs: - doc - user - project - repository - branches --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} GitLab provides multiple methods to protect individual branches. These methods ensure your branches receive oversight and quality checks from their creation to their deletion: - Apply enhanced security and protection to your project's [default branch](default.md). - Configure [protected branches](protected.md) to: - Limit who can push and merge to a branch. - Manage if users can force push to the branch. - Manage if changes to files listed in the `CODEOWNERS` file can be pushed directly to the branch. - Configure [approval rules](../../merge_requests/approvals/rules.md#approvals-for-protected-branches) to manage review requirements and implement [security-related approvals](../../merge_requests/approvals/rules.md#security-approvals). - Integrate with third-party [status checks](../../merge_requests/status_checks.md) to ensure the contents of your branch meets your defined quality standards. You can manage your branches: - With the GitLab user interface. - With Git on the command line. - With the [Branches API](../../../../api/branches.md). ## View branch rules {{< history >}} - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/123368) in GitLab 16.1. Feature flag `branch_rules` removed. {{< /history >}} The branch rules overview page shows all branches with any configured protections, and their protection methods: ![Example of a branch with configured protections](img/view_branch_protections_v15_10.png) Prerequisites: - You must have at least the Maintainer role for the project. To view the branch rules overview list: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Repository**. 1. Expand **Branch rules** to view all branches with protections. ### View branch rule details To view branch rules and protections for a single branch: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Repository**. 1. Expand **Branch rules** to view all branches with protections. 1. Identify the branch you want and select **View details**. ## Create a branch rule {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/88279) in GitLab 16.8 with a flag named `add_branch_rules`. Disabled by default. - Feature flag `add_branch_rules` [renamed](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/88279) to `edit_branch_rules` in GitLab 16.11. Disabled by default. - **All branches** and **All protected branches** options [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/388129) in GitLab 17.0. - [Enabled on GitLab.com](https://gitlab.com/gitlab-org/gitlab/-/issues/454501) in GitLab 17.4. - [Enabled on GitLab Self-Managed and GitLab Dedicated](https://gitlab.com/gitlab-org/gitlab/-/issues/454501) in GitLab 17.5. {{< /history >}} {{< alert type="flag" >}} The availability of this feature is controlled by a feature flag. For more information, see the history. {{< /alert >}} Prerequisites: - You must have at least the Maintainer role for the project. To create a branch rule: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Repository**. 1. Expand **Branch rules**. 1. Select **Add branch rule**. 1. Choose one of the following options: - To enter a specific branch name or pattern: 1. Select **Branch name or pattern**. 1. From the **Create branch rule** dropdown list, select a branch name or create a [wildcard](protected.md#use-wildcard-rules) with `*`. - To protect all branches in the project: 1. Select **All branches**. 1. On the rule's details page, under **Merge request approvals**, enter the required number of approvals for the rule. - To protect all branches in the project that are already specified as protected: 1. Select **All protected branches**. 1. On the rule's details page, under **Merge request approvals**, enter the required number of approvals for the rule. ### Add a branch rule protection {{< alert type="note" >}} Not available for `all branches`. {{< /alert >}} To add protections to a new branch: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Repository**. 1. Expand **Branch rules**. 1. Select **Add branch rule**. 1. Select one of **All protected branches** or **Branch name or pattern**. 1. Select **Create protected branch**. ### Add an approval rule {{< details >}} - Tier: Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} {{< alert type="note" >}} Not available for `all branches`. {{< /alert >}} Prerequisites: - You must have at least the Maintainer role for the project. To add a merge request approval rule: 1. From the [branch rule details](#view-branch-rule-details) page, go to the **Merge request approvals** section. 1. In the **Approval rules** section, select **Add approval rule**. 1. On the right sidebar, complete the fields: - Enter a **Rule name**. - In **Required number of approvals**, enter a value (`0`-`100`). A value of `0` makes [the rule optional](../../merge_requests/approvals/rules.md#configure-optional-approval-rules), and any number greater than `0` creates a required rule. The maximum number of required approvals is `100`. - Select users or groups that are [eligible to approve](../../merge_requests/approvals/rules.md#eligible-approvers). GitLab suggests approvers based on previous authors of the files changed by the merge request. 1. Select **Save changes**. For additional information, see [Approval rules](../../merge_requests/approvals/rules.md#approvals-for-protected-branches). ### Edit squash commits option {{< details >}} - Tier: Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/181370) in GitLab 17.9 with a flag named `branch_rule_squash_settings`. Disabled by default. - [Enabled on GitLab.com, GitLab Self-Managed, and GitLab Dedicated](https://gitlab.com/gitlab-org/gitlab/-/issues/506542) in GitLab 17.10. - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/issues/524860) in GitLab 17.11. Feature flag `branch_rule_squash_settings` removed. {{< /history >}} Prerequisites: - You must have at least the Maintainer role for the project. - In GitLab Free, this feature is available only if the branch rule targets **All branches**. - In GitLab Premium and GitLab Ultimate, this feature is available for all branch rules. To edit a squash option: 1. From the [branch rule details](#view-branch-rule-details) page, go to the **Squash commits when merging** section. 1. Select **Edit**. 1. Select one of the following options: - **Do not allow**: Squashing is never allowed and the checkbox is hidden. - **Allow**: Checkbox is visible and unselected by default. - **Encourage**: Checkbox is visible and selected by default. - **Require**: Squashing is always performed. Checkbox is visible and selected, and users cannot change it. 1. Select **Save changes**. ### Add a status check service {{< details >}} - Tier: Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} {{< history >}} - [Introduced](https://gitlab.com/groups/gitlab-org/-/epics/12522) in GitLab 17.4 [with a flag](../../../../administration/feature_flags/_index.md) named `edit_branch_rules`. Disabled by default. - [Enabled on GitLab.com](https://gitlab.com/gitlab-org/gitlab/-/issues/454501) in GitLab 17.4. - [Enabled on GitLab Self-Managed and GitLab Dedicated](https://gitlab.com/gitlab-org/gitlab/-/issues/454501) in GitLab 17.5. {{< /history >}} {{< alert type="note" >}} Not available for `all protected branches`. {{< /alert >}} To add a status check service: 1. From the [branch rule details](#view-branch-rule-details) page, go to the **Status checks** section. 1. Select **Add status check**. 1. Enter the **Service name**. 1. In the **API to check** field, enter the URL. You should use an HTTPS URL to protect your merge request data in transit. ![Branch rules status checks](img/branch_rule_status_check_v17_4.png) For more information, see [External status checks](../../merge_requests/status_checks.md). ## Edit a branch rule target {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/88279) in GitLab 16.8 with a flag named `add_branch_rules`. Disabled by default. - Feature flag `add_branch_rules` [renamed](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/88279) to `edit_branch_rules` in GitLab 16.11. Disabled by default. - [Enabled on GitLab.com](https://gitlab.com/gitlab-org/gitlab/-/issues/454501) in GitLab 17.4. - [Enabled on GitLab Self-Managed and GitLab Dedicated](https://gitlab.com/gitlab-org/gitlab/-/issues/454501) in GitLab 17.5. {{< /history >}} {{< alert type="flag" >}} The availability of this feature is controlled by a feature flag. For more information, see the history. {{< /alert >}} Prerequisites: - You must have at least the Maintainer role for the project. To edit a branch rule target: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Repository**. 1. Expand **Branch rules** to view all branches with protections. 1. Identify the branch you want and select **View details**. 1. In the **Rule target** section, select **Edit**. 1. Edit the information as needed. 1. Select **Update**. ### Edit a branch rule protection {{< alert type="note" >}} Not available for `all branches`. {{< /alert >}} To edit branch rule protections: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Repository**. 1. Expand **Branch rules** to view all branches with protections. 1. Identify the branch you want and select **View details**. 1. From the **Protect branch** section, choose one of the following options: - From **Allowed to merge**, select **Edit**. 1. Select the roles that can merge into this branch. 1. Select **Save changes**. - From **Allowed to push and merge**, select **Edit**. 1. Select the roles that can merge into this branch. 1. If desired, search to add **Deploy keys**. 1. Select **Save changes**. {{< alert type="note" >}} In GitLab Premium and Ultimate, you can also add groups or individual users to **Allowed to merge** and **Allowed to push and merge**. {{< /alert >}} For additional information about branch protection controls, see [Protected branches](protected.md). ## Delete a branch rule {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/88279) in GitLab 16.8 with a flag named `add_branch_rules`. Disabled by default. - Feature flag `add_branch_rules` [renamed](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/88279) to `edit_branch_rules` in GitLab 16.11. Disabled by default. - [Enabled on GitLab.com](https://gitlab.com/gitlab-org/gitlab/-/issues/454501) in GitLab 17.4. - [Enabled on GitLab Self-Managed and GitLab Dedicated](https://gitlab.com/gitlab-org/gitlab/-/issues/454501) in GitLab 17.5. {{< /history >}} {{< alert type="flag" >}} The availability of this feature is controlled by a feature flag. For more information, see the history. {{< /alert >}} {{< alert type="note" >}} Deleting a branch rule is not available for rules targeting `all branches`. {{< /alert >}} Prerequisites: - You must have at least the Maintainer role for the project. To delete a branch rule: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Repository**. 1. Expand **Branch rules**. 1. Next to a rule you want to delete, select **View details**. 1. In the upper-right corner, select **Delete rule**. 1. On the confirmation dialog, select **Delete branch rule**. ## Related topics - [Default branch](default.md) - [Protected branches](protected.md) - [Branching strategies](strategies/_index.md) - [Merge request approvals](../../merge_requests/approvals/_index.md)
https://docs.gitlab.com/user/project/repository/branches/strategies
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/repository/branches/_index.md
2025-08-13
doc/user/project/repository/branches/strategies
[ "doc", "user", "project", "repository", "branches", "strategies" ]
_index.md
Create
Source Code
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Branching strategies
Expand your Git branching strategy when you outgrow the basic approach.
The way you organize and merge Git branches is called a branching strategy. For many teams, the simplest approach is sensible and effective: 1. Make changes in a feature branch. 1. Merge the feature branch directly to `main`. However, if your team has complex needs (like testing and compliance requirements), you might want to consider a different branching strategy. We want to demystify some of the more common strategies available. Not everyone has a Git (or version control) specialist on staff. If you know your team is working at the far edges of its Git skill set, this information is for you. When you use GitLab to replace multiple, disparate tools, the decisions you make about your Git branching strategy matter. With careful planning, you can establish clear connections between: - The initial bug reports you receive. - The commits your teams make to fix those bugs. - The processes of backporting those fixes to other versions or customers. - The deployments that make your fixes available to your users. Careful choices help you take the best advantage of the single data store in GitLab. ## Do I need a more complex Git branching strategy? You might have outgrown your current Git branching strategy if: - You use continuous delivery. - You have significant automated testing. - You must fix critical bugs for one customer without affecting other customers. - You maintain multiple historical versions of your product. - Your product has no single production branch, because it supports multiple operating systems or platforms. - Your product has different deployment or certification requirements for each version. Don't implement a strategy that is more complex than your product needs. ### When to split a project into multiple repositories Should you maintain one Git repository with a complex branching structure, or split the project across multiple repositories? There's no single right answer. It depends on what you have the personnel and expertise to support. GitLab provides automation that assumes your repository is for a single product, though that product might contain multiple versions. To determine if you should have multiple repositories, or a single complex one, ask these questions: - Is it the same product? - Do all elements use the same build process? - Is the underlying code similar, or the same? No matter what you choose (either a complex single repository, or a set of smaller repositories) you should expect to spend engineering time on maintenance. Identify which type of engineering work you are prepared to do: - If you maintain code for multiple products in a single repository, plan for customization work later to use all features of GitLab. - Merging work across multiple repositories is more involved than merging across branches in the same repository. Plan for engineering time to build custom release processes and manage the flow of code across repositories. {{< alert type="note" >}} If your organization uses a large monorepo or a megarepo, the [Professional Services](https://about.gitlab.com/services/) team at GitLab can help you construct a custom branching solution that meets your needs. {{< /alert >}} ## Major types of branching strategies Branching and code management strategies depend on your product's needs. No pre-existing strategy can cover them all, but we've identified some major categories: - [Web services](#web-services) - [Long-lived release branches](#long-lived-release-branches) - [A branch per environment](#branch-per-environment) ### Web services This strategy follows standard Git practices. The `main` branch is your production branch, which is great for a single web service: there's one canonical production version, and no support for previous revisions. For this configuration, [`git-flow`](https://nvie.com/posts/a-successful-git-branching-model/) probably works for you. It's standardized, and you don't have to maintain anything. In this example, `feature-1` branches off directly from `main`. When complete, `feature-1` merges back directly into `main`. This merge commit is highlighted with a square. Longer-lived branches, like `feature-2`, might periodically merge in the latest updates from `main` as part of development. When complete, `feature-2` merges into `main`, and release `1.1` is cut: ```mermaid %%{init: { 'gitGraph': {'mainBranchOrder':1}} }%% gitGraph commit tag: "1.0" id: "release v1.0" branch "feature-1" commit id: "start feature-1" checkout main commit id: "start feature-2" branch "feature-2" order: 3 checkout feature-1 commit id: "refine feature-1" checkout main merge feature-1 type: HIGHLIGHT id: "merge feature-1 into main" checkout feature-2 commit id: "build feature 2" merge main type: HIGHLIGHT id: "merge main into feature-2" commit checkout main merge feature-2 tag: "1.1" type: HIGHLIGHT id: "release v1.1" ``` ### Long-lived release branches This branching strategy is appropriate if your product has branches that must remain separate from `main` for a long time. Some examples include: - Multiple production versions of the same software package. For example: a current version, and legacy versions. The current version receives feature updates and hotfixes, while previous versions receive hotfixes and security releases only. - A current production version, and a long-lived beta version. You might need this approach when a major software dependency (like a software development kit, or SDK) is introducing breaking changes. The current production version receives feature updates and hotfixes. The beta version receives those feature updates and hotfixes while your team also builds in support for the upcoming SDK changes. If you intend to lock a long-lived branch, it is critical to define your hotfix process and enforce it. If undefined and unenforced, every change becomes a hotfix. In this example, the `2.0` branch is created from the commit on `main` for the `1.0` release. Features branch off from the `2.0` branch, and merge back into `2.0`. At the same time, any hotfix branches are based off of the most recent release (`1.0`) of `main`, and merge back into `main` as release `1.1`. The `2.0` branch then pulls in the changes from release `1.1`, and incorporates them as part of the development of `2.0`. After the addition of another feature (`feature-2`), the `2.0` branch is ready for production. It merges into `main`, and release `2.0` is cut: ```mermaid %%{init: { 'gitGraph': {'mainBranchOrder':2}} }%% gitGraph commit tag: "1.0" branch hotfix order: 1 checkout main branch "2.0" order: 3 commit checkout hotfix commit id: "security bug" commit id: "performance bug" checkout "2.0" branch feature-1 order: 4 commit id: "create feature 1" checkout main commit id: " " checkout 2.0 merge feature-1 id:"merge feature-1" tag: "2.0 RC 1" checkout main merge hotfix tag: "1.1" type: HIGHLIGHT checkout 2.0 merge main tag: "2.0 RC 2" type: HIGHLIGHT branch feature-2 order: 5 commit id: "create feature 2" commit id: "refine feature 2" checkout 2.0 merge feature-2 id: "merge feature-2" tag: "2.0 RC 3" checkout main merge 2.0 tag: "2.0" type: HIGHLIGHT ``` #### Migrate from SVN branching strategies Legacy projects migrating from SVN to Git should review their branching approach. Some SVN-centric branching approaches in Git can prevent you from getting the most out of GitLab. Some workflows to revisit: - You create a long-lived branch (like `1.0`) from `main`, then lock the `1.0` branch to block any change that is not a pre-approved hotfix. - Git handles merge conflicts better than SVN. - Avoid creating long-lived branches, unless you have contractual obligations to use them. While Git handles conflicts well, long-lived branches require you to spend time merging fixes to multiple branches. - You use branches because your product does not support feature flags. ### Branch per environment This branching strategy is common for organizations with multiple interdependent services that are built by different teams. It's often used with waterfall or V-model development processes. In this example, the commit marked `v1.1 RC1` is identified as a release candidate for version `1.1`. Features continue to branch from and back into `main`, while the release candidate commit is tested on the `test` and `UAT` environments. This process is repeated for each commit that is considered for release: ```mermaid gitGraph commit id: "start feature" branch feature-1 checkout main commit tag: "v1.1 RC1" id: "start testing" branch test checkout feature-1 commit id: "develop feature" commit id: "refine feature" checkout test commit id: " " tag: "v1.1 RC1" branch UAT checkout UAT commit tag: "v1.1" checkout main merge feature-1 id: "merge feature-1" commit ``` ## Related topics - [Protected branches](../protected.md) - [Merge request approvals](../../../merge_requests/approvals/_index.md) - [Testing merged results](../../../../../ci/pipelines/merged_results_pipelines.md)
--- stage: Create group: Source Code info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments description: Expand your Git branching strategy when you outgrow the basic approach. title: Branching strategies breadcrumbs: - doc - user - project - repository - branches - strategies --- The way you organize and merge Git branches is called a branching strategy. For many teams, the simplest approach is sensible and effective: 1. Make changes in a feature branch. 1. Merge the feature branch directly to `main`. However, if your team has complex needs (like testing and compliance requirements), you might want to consider a different branching strategy. We want to demystify some of the more common strategies available. Not everyone has a Git (or version control) specialist on staff. If you know your team is working at the far edges of its Git skill set, this information is for you. When you use GitLab to replace multiple, disparate tools, the decisions you make about your Git branching strategy matter. With careful planning, you can establish clear connections between: - The initial bug reports you receive. - The commits your teams make to fix those bugs. - The processes of backporting those fixes to other versions or customers. - The deployments that make your fixes available to your users. Careful choices help you take the best advantage of the single data store in GitLab. ## Do I need a more complex Git branching strategy? You might have outgrown your current Git branching strategy if: - You use continuous delivery. - You have significant automated testing. - You must fix critical bugs for one customer without affecting other customers. - You maintain multiple historical versions of your product. - Your product has no single production branch, because it supports multiple operating systems or platforms. - Your product has different deployment or certification requirements for each version. Don't implement a strategy that is more complex than your product needs. ### When to split a project into multiple repositories Should you maintain one Git repository with a complex branching structure, or split the project across multiple repositories? There's no single right answer. It depends on what you have the personnel and expertise to support. GitLab provides automation that assumes your repository is for a single product, though that product might contain multiple versions. To determine if you should have multiple repositories, or a single complex one, ask these questions: - Is it the same product? - Do all elements use the same build process? - Is the underlying code similar, or the same? No matter what you choose (either a complex single repository, or a set of smaller repositories) you should expect to spend engineering time on maintenance. Identify which type of engineering work you are prepared to do: - If you maintain code for multiple products in a single repository, plan for customization work later to use all features of GitLab. - Merging work across multiple repositories is more involved than merging across branches in the same repository. Plan for engineering time to build custom release processes and manage the flow of code across repositories. {{< alert type="note" >}} If your organization uses a large monorepo or a megarepo, the [Professional Services](https://about.gitlab.com/services/) team at GitLab can help you construct a custom branching solution that meets your needs. {{< /alert >}} ## Major types of branching strategies Branching and code management strategies depend on your product's needs. No pre-existing strategy can cover them all, but we've identified some major categories: - [Web services](#web-services) - [Long-lived release branches](#long-lived-release-branches) - [A branch per environment](#branch-per-environment) ### Web services This strategy follows standard Git practices. The `main` branch is your production branch, which is great for a single web service: there's one canonical production version, and no support for previous revisions. For this configuration, [`git-flow`](https://nvie.com/posts/a-successful-git-branching-model/) probably works for you. It's standardized, and you don't have to maintain anything. In this example, `feature-1` branches off directly from `main`. When complete, `feature-1` merges back directly into `main`. This merge commit is highlighted with a square. Longer-lived branches, like `feature-2`, might periodically merge in the latest updates from `main` as part of development. When complete, `feature-2` merges into `main`, and release `1.1` is cut: ```mermaid %%{init: { 'gitGraph': {'mainBranchOrder':1}} }%% gitGraph commit tag: "1.0" id: "release v1.0" branch "feature-1" commit id: "start feature-1" checkout main commit id: "start feature-2" branch "feature-2" order: 3 checkout feature-1 commit id: "refine feature-1" checkout main merge feature-1 type: HIGHLIGHT id: "merge feature-1 into main" checkout feature-2 commit id: "build feature 2" merge main type: HIGHLIGHT id: "merge main into feature-2" commit checkout main merge feature-2 tag: "1.1" type: HIGHLIGHT id: "release v1.1" ``` ### Long-lived release branches This branching strategy is appropriate if your product has branches that must remain separate from `main` for a long time. Some examples include: - Multiple production versions of the same software package. For example: a current version, and legacy versions. The current version receives feature updates and hotfixes, while previous versions receive hotfixes and security releases only. - A current production version, and a long-lived beta version. You might need this approach when a major software dependency (like a software development kit, or SDK) is introducing breaking changes. The current production version receives feature updates and hotfixes. The beta version receives those feature updates and hotfixes while your team also builds in support for the upcoming SDK changes. If you intend to lock a long-lived branch, it is critical to define your hotfix process and enforce it. If undefined and unenforced, every change becomes a hotfix. In this example, the `2.0` branch is created from the commit on `main` for the `1.0` release. Features branch off from the `2.0` branch, and merge back into `2.0`. At the same time, any hotfix branches are based off of the most recent release (`1.0`) of `main`, and merge back into `main` as release `1.1`. The `2.0` branch then pulls in the changes from release `1.1`, and incorporates them as part of the development of `2.0`. After the addition of another feature (`feature-2`), the `2.0` branch is ready for production. It merges into `main`, and release `2.0` is cut: ```mermaid %%{init: { 'gitGraph': {'mainBranchOrder':2}} }%% gitGraph commit tag: "1.0" branch hotfix order: 1 checkout main branch "2.0" order: 3 commit checkout hotfix commit id: "security bug" commit id: "performance bug" checkout "2.0" branch feature-1 order: 4 commit id: "create feature 1" checkout main commit id: " " checkout 2.0 merge feature-1 id:"merge feature-1" tag: "2.0 RC 1" checkout main merge hotfix tag: "1.1" type: HIGHLIGHT checkout 2.0 merge main tag: "2.0 RC 2" type: HIGHLIGHT branch feature-2 order: 5 commit id: "create feature 2" commit id: "refine feature 2" checkout 2.0 merge feature-2 id: "merge feature-2" tag: "2.0 RC 3" checkout main merge 2.0 tag: "2.0" type: HIGHLIGHT ``` #### Migrate from SVN branching strategies Legacy projects migrating from SVN to Git should review their branching approach. Some SVN-centric branching approaches in Git can prevent you from getting the most out of GitLab. Some workflows to revisit: - You create a long-lived branch (like `1.0`) from `main`, then lock the `1.0` branch to block any change that is not a pre-approved hotfix. - Git handles merge conflicts better than SVN. - Avoid creating long-lived branches, unless you have contractual obligations to use them. While Git handles conflicts well, long-lived branches require you to spend time merging fixes to multiple branches. - You use branches because your product does not support feature flags. ### Branch per environment This branching strategy is common for organizations with multiple interdependent services that are built by different teams. It's often used with waterfall or V-model development processes. In this example, the commit marked `v1.1 RC1` is identified as a release candidate for version `1.1`. Features continue to branch from and back into `main`, while the release candidate commit is tested on the `test` and `UAT` environments. This process is repeated for each commit that is considered for release: ```mermaid gitGraph commit id: "start feature" branch feature-1 checkout main commit tag: "v1.1 RC1" id: "start testing" branch test checkout feature-1 commit id: "develop feature" commit id: "refine feature" checkout test commit id: " " tag: "v1.1 RC1" branch UAT checkout UAT commit tag: "v1.1" checkout main merge feature-1 id: "merge feature-1" commit ``` ## Related topics - [Protected branches](../protected.md) - [Merge request approvals](../../../merge_requests/approvals/_index.md) - [Testing merged results](../../../../../ci/pipelines/merged_results_pipelines.md)
https://docs.gitlab.com/user/project/repository/mirror
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/repository/_index.md
2025-08-13
doc/user/project/repository/mirror
[ "doc", "user", "project", "repository", "mirror" ]
_index.md
Create
Source Code
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Repository mirroring
Use repository mirroring to push or pull the contents of a Git repository into another repository.
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} You can mirror a repository to and from external sources. You can select which repository serves as the source. Branches, tags, and commits are synced automatically. Several mirroring methods exist: - [Push](push.md): Mirror a repository from GitLab to another location. - [Pull](pull.md): Mirror a repository from another location. Available in the Premium and Ultimate tier. - [Bidirectional](bidirectional.md) mirroring is also available, but can cause conflicts. Mirror a repository when: - The canonical version of your project has migrated to GitLab. To keep providing a copy of your project at its previous home, configure your GitLab repository as a [push mirror](push.md). Changes you make to your GitLab repository are copied to the old location. - Your GitLab instance is private, but you want to open-source some projects. - You migrated to GitLab, but the canonical version of your project is somewhere else. Configure your GitLab repository as a [pull mirror](pull.md) of the other project. Your GitLab repository pulls copies of the commits, tags, and branches of project. They become available to use on GitLab. The following is not supported: - SCP-style URLs. The work to implement SCP-style URLs is ongoing. For more information and to track its progress, see [issue 18993](https://gitlab.com/gitlab-org/gitlab/-/issues/18993). - Mirroring repositories over [dumb HTTP protocol](https://git-scm.com/book/en/v2/Git-on-the-Server-The-Protocols#_dumb_http). ## Create a repository mirror Prerequisites: - You must have at least the Maintainer role for the project. - If your mirror connects with `ssh://`, the host key must be detectable on the server, or you must have a local copy of the key. 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Repository**. 1. Expand **Mirroring repositories**. 1. Select **Add new**. 1. Enter a **Git repository URL**. The repository must be accessible over `http://`, `https://`, `ssh://`, or `git://`. 1. Select a **Mirror direction**. For more information, see [Pull mirroring](pull.md) and [Push mirroring](push.md). 1. If you entered an `ssh://` URL, select either: - **Detect host keys**: GitLab fetches the host keys from the server and displays the fingerprints. - **Input host keys manually**, and enter the host key into **SSH host key**. When mirroring the repository, GitLab confirms that at least one of the stored host keys matches before connecting. This check protects your mirror from malicious code injections, or your password from being stolen. - To create a repository mirror with SSH authentication, see the [following example](#example-create-mirror-with-ssh-authentication). 1. Select an **Authentication method**. For more information, see [Authentication methods for mirrors](#authentication-methods-for-mirrors). 1. If you authenticate with SSH host keys, [verify the host key](#verify-a-host-key) to ensure it is correct. 1. To prevent force-pushing over diverged refs, select **Keep divergent refs**. For more information, see [Keep divergent refs](push.md#keep-divergent-refs). 1. Optional. To limit the number of branches mirrored, select **Mirror only protected branches** or enter a regex in **Mirror specific branches**. 1. Select **Mirror repository**. ### Example: Create mirror with SSH authentication If you select `SSH public key` as your authentication method, GitLab generates a public key for your GitLab repository. You must provide this key to the non-GitLab server. For more information, see [Get your SSH public key](#get-your-ssh-public-key). To mirror a repository with SSH authentication: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Repository**. 1. Expand **Mirroring repositories**. 1. Select **Add new**. 1. Enter a **Git repository URL**. Provide a URL in the following format: `ssh://gitlab.com/gitlab-org/gitlab.git` 1. Select a **Mirror direction**. For more information, see [Pull mirroring](pull.md) and [Push mirroring](push.md). 1. Select either **Detect host keys** or **Input host keys manually**. 1. In the **Authentication method** field, select **SSH public key** 1. In the **Username** field, add `git`. 1. Optional. Configure the **Mirror user** and **Mirror branches** settings. 1. Select **Mirror repository**. 1. Copy the SSH public key and provide it to your non-GitLab server. ### Mirror only protected branches You can choose to mirror only the [protected branches](../branches/protected.md) in the mirroring project, either from or to your remote repository. For [pull mirroring](pull.md), non-protected branches in the mirroring project are not mirrored and can diverge. To use this option, select **Only mirror protected branches** when you create a repository mirror. ### Mirror specific branches {{< details >}} - Tier: Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} {{< history >}} - [Enabled by default](https://gitlab.com/gitlab-org/gitlab/-/issues/381667) in GitLab 16.0. - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/issues/410354) in GitLab 16.2. Feature flag `mirror_only_branches_match_regex` removed. {{< /history >}} To mirror only branches with names matching an [re2 regular expression](https://github.com/google/re2/wiki/Syntax), enter a regular expression into the **Mirror specific branches** field. Branches with names that do not match the regular expression are not mirrored. ## Update a mirror When the mirror repository is updated, all new branches, tags, and commits are visible in the project's activity feed. A repository mirror at GitLab updates automatically. You can also manually trigger an update: - At most once every five minutes on GitLab.com. - According to [the pull mirroring interval limit](../../../../administration/instance_limits.md#pull-mirroring-interval) set by the administrator on GitLab Self-Managed instances. {{< alert type="note" >}} [GitLab Silent Mode](../../../../administration/silent_mode/_index.md) disables both push and pull updates. {{< /alert >}} ### Force an update While mirrors are scheduled to update automatically, you can force an immediate update unless: - The mirror is already being updated. - The [interval, in seconds](../../../../administration/instance_limits.md#pull-mirroring-interval) for pull mirroring limits has not elapsed after its last update. Prerequisites: - You must have at least the Maintainer role for the project. 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Repository**. 1. Expand **Mirroring repositories**. 1. Scroll to **Mirrored repositories** and identify the mirror to update. 1. Select **Update now** ({{< icon name="retry" >}}). ## Authentication methods for mirrors When you create a mirror, you must configure the authentication method for it. GitLab supports these authentication methods: - [SSH authentication](#ssh-authentication). - Username and password. For a [project access token](../../settings/project_access_tokens.md) or [group access token](../../../group/settings/group_access_tokens.md), use the username (not token name) and the token as the password. ### SSH authentication SSH authentication is mutual: - You must prove to the server that you're allowed to access the repository. - The server must also prove to you that it's who it claims to be. For SSH authentication, you provide your credentials as a password or public key. The server that the other repository resides on provides its credentials as a host key. You must [verify the fingerprint](#verify-a-host-key) of this host key manually. If you're mirroring over SSH (using an `ssh://` URL), you can authenticate using: - Password-based authentication, just as over HTTPS. - Public key authentication. This method is often more secure than password authentication, especially when the other repository supports [deploy keys](../../deploy_keys/_index.md). ### Get your SSH public key When you mirror a repository and select the **SSH public key** as your authentication method, GitLab generates a public key for you. The non-GitLab server needs this key to establish trust with your GitLab repository. To copy your SSH public key: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Repository**. 1. Expand **Mirroring repositories**. 1. Scroll to **Mirrored repositories**. 1. Identify the correct repository, and select **Copy SSH public key** ({{< icon name="copy-to-clipboard" >}}). 1. Add the public SSH key to the other repository's configuration: - If the other repository is hosted on GitLab, add the public SSH key as a [deploy key](../../deploy_keys/_index.md). - If the other repository is hosted elsewhere, add the key to your user's `authorized_keys` file. Paste the entire public SSH key into the file on its own line and save it. If you must change the key at any time, you can remove and re-add the mirror to generate a new key. Update the other repository with the new key to keep the mirror running. {{< alert type="note" >}} The generated keys are stored in the GitLab database, not in the file system. Therefore, SSH public key authentication for mirrors cannot be used in a pre-receive hook. {{< /alert >}} ### Verify a host key When using a host key, always verify the fingerprints match what you expect. GitLab.com and other code hosting sites publish their fingerprints for you to check: - [AWS CodeCommit](https://docs.aws.amazon.com/codecommit/latest/userguide/regions.html#regions-fingerprints) - [Bitbucket](https://support.atlassian.com/bitbucket-cloud/docs/configure-ssh-and-two-step-verification/) - [Codeberg](https://docs.codeberg.org/security/ssh-fingerprint/) - [GitHub](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/githubs-ssh-key-fingerprints) - [GitLab.com](../../../gitlab_com/_index.md#ssh-host-keys-fingerprints) - [Launchpad](https://help.launchpad.net/SSHFingerprints) - [Savannah](https://savannah.gnu.org/maintenance/SshAccess/) - [SourceForge](https://sourceforge.net/p/forge/documentation/SSH%20Key%20Fingerprints/) Other providers vary. You can securely gather key fingerprints with the following command if you: - Run GitLab Self-Managed. - Have access to the server for the other repository. ```shell $ cat /etc/ssh/ssh_host*pub | ssh-keygen -E md5 -l -f - 256 MD5:f4:28:9f:23:99:15:21:1b:bf:ed:1f:8e:a0:76:b2:9d root@example.com (ECDSA) 256 MD5:e6:eb:45:8a:3c:59:35:5f:e9:5b:80:12:be:7e:22:73 root@example.com (ED25519) 2048 MD5:3f:72:be:3d:62:03:5c:62:83:e8:6e:14:34:3a:85:1d root@example.com (RSA) ``` Older versions of SSH may require you to remove `-E md5` from the command. ## Related topics - [Troubleshooting](troubleshooting.md) for repository mirroring. - Configure a [Pull Mirroring Interval](../../../../administration/instance_limits.md#pull-mirroring-interval) - [Disable mirrors for a project](../../../../administration/settings/visibility_and_access_controls.md#enable-project-mirroring) - [Secrets file and mirroring](../../../../administration/backup_restore/troubleshooting_backup_gitlab.md#when-the-secrets-file-is-lost)
--- stage: Create group: Source Code info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments description: Use repository mirroring to push or pull the contents of a Git repository into another repository. title: Repository mirroring breadcrumbs: - doc - user - project - repository - mirror --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} You can mirror a repository to and from external sources. You can select which repository serves as the source. Branches, tags, and commits are synced automatically. Several mirroring methods exist: - [Push](push.md): Mirror a repository from GitLab to another location. - [Pull](pull.md): Mirror a repository from another location. Available in the Premium and Ultimate tier. - [Bidirectional](bidirectional.md) mirroring is also available, but can cause conflicts. Mirror a repository when: - The canonical version of your project has migrated to GitLab. To keep providing a copy of your project at its previous home, configure your GitLab repository as a [push mirror](push.md). Changes you make to your GitLab repository are copied to the old location. - Your GitLab instance is private, but you want to open-source some projects. - You migrated to GitLab, but the canonical version of your project is somewhere else. Configure your GitLab repository as a [pull mirror](pull.md) of the other project. Your GitLab repository pulls copies of the commits, tags, and branches of project. They become available to use on GitLab. The following is not supported: - SCP-style URLs. The work to implement SCP-style URLs is ongoing. For more information and to track its progress, see [issue 18993](https://gitlab.com/gitlab-org/gitlab/-/issues/18993). - Mirroring repositories over [dumb HTTP protocol](https://git-scm.com/book/en/v2/Git-on-the-Server-The-Protocols#_dumb_http). ## Create a repository mirror Prerequisites: - You must have at least the Maintainer role for the project. - If your mirror connects with `ssh://`, the host key must be detectable on the server, or you must have a local copy of the key. 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Repository**. 1. Expand **Mirroring repositories**. 1. Select **Add new**. 1. Enter a **Git repository URL**. The repository must be accessible over `http://`, `https://`, `ssh://`, or `git://`. 1. Select a **Mirror direction**. For more information, see [Pull mirroring](pull.md) and [Push mirroring](push.md). 1. If you entered an `ssh://` URL, select either: - **Detect host keys**: GitLab fetches the host keys from the server and displays the fingerprints. - **Input host keys manually**, and enter the host key into **SSH host key**. When mirroring the repository, GitLab confirms that at least one of the stored host keys matches before connecting. This check protects your mirror from malicious code injections, or your password from being stolen. - To create a repository mirror with SSH authentication, see the [following example](#example-create-mirror-with-ssh-authentication). 1. Select an **Authentication method**. For more information, see [Authentication methods for mirrors](#authentication-methods-for-mirrors). 1. If you authenticate with SSH host keys, [verify the host key](#verify-a-host-key) to ensure it is correct. 1. To prevent force-pushing over diverged refs, select **Keep divergent refs**. For more information, see [Keep divergent refs](push.md#keep-divergent-refs). 1. Optional. To limit the number of branches mirrored, select **Mirror only protected branches** or enter a regex in **Mirror specific branches**. 1. Select **Mirror repository**. ### Example: Create mirror with SSH authentication If you select `SSH public key` as your authentication method, GitLab generates a public key for your GitLab repository. You must provide this key to the non-GitLab server. For more information, see [Get your SSH public key](#get-your-ssh-public-key). To mirror a repository with SSH authentication: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Repository**. 1. Expand **Mirroring repositories**. 1. Select **Add new**. 1. Enter a **Git repository URL**. Provide a URL in the following format: `ssh://gitlab.com/gitlab-org/gitlab.git` 1. Select a **Mirror direction**. For more information, see [Pull mirroring](pull.md) and [Push mirroring](push.md). 1. Select either **Detect host keys** or **Input host keys manually**. 1. In the **Authentication method** field, select **SSH public key** 1. In the **Username** field, add `git`. 1. Optional. Configure the **Mirror user** and **Mirror branches** settings. 1. Select **Mirror repository**. 1. Copy the SSH public key and provide it to your non-GitLab server. ### Mirror only protected branches You can choose to mirror only the [protected branches](../branches/protected.md) in the mirroring project, either from or to your remote repository. For [pull mirroring](pull.md), non-protected branches in the mirroring project are not mirrored and can diverge. To use this option, select **Only mirror protected branches** when you create a repository mirror. ### Mirror specific branches {{< details >}} - Tier: Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} {{< history >}} - [Enabled by default](https://gitlab.com/gitlab-org/gitlab/-/issues/381667) in GitLab 16.0. - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/issues/410354) in GitLab 16.2. Feature flag `mirror_only_branches_match_regex` removed. {{< /history >}} To mirror only branches with names matching an [re2 regular expression](https://github.com/google/re2/wiki/Syntax), enter a regular expression into the **Mirror specific branches** field. Branches with names that do not match the regular expression are not mirrored. ## Update a mirror When the mirror repository is updated, all new branches, tags, and commits are visible in the project's activity feed. A repository mirror at GitLab updates automatically. You can also manually trigger an update: - At most once every five minutes on GitLab.com. - According to [the pull mirroring interval limit](../../../../administration/instance_limits.md#pull-mirroring-interval) set by the administrator on GitLab Self-Managed instances. {{< alert type="note" >}} [GitLab Silent Mode](../../../../administration/silent_mode/_index.md) disables both push and pull updates. {{< /alert >}} ### Force an update While mirrors are scheduled to update automatically, you can force an immediate update unless: - The mirror is already being updated. - The [interval, in seconds](../../../../administration/instance_limits.md#pull-mirroring-interval) for pull mirroring limits has not elapsed after its last update. Prerequisites: - You must have at least the Maintainer role for the project. 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Repository**. 1. Expand **Mirroring repositories**. 1. Scroll to **Mirrored repositories** and identify the mirror to update. 1. Select **Update now** ({{< icon name="retry" >}}). ## Authentication methods for mirrors When you create a mirror, you must configure the authentication method for it. GitLab supports these authentication methods: - [SSH authentication](#ssh-authentication). - Username and password. For a [project access token](../../settings/project_access_tokens.md) or [group access token](../../../group/settings/group_access_tokens.md), use the username (not token name) and the token as the password. ### SSH authentication SSH authentication is mutual: - You must prove to the server that you're allowed to access the repository. - The server must also prove to you that it's who it claims to be. For SSH authentication, you provide your credentials as a password or public key. The server that the other repository resides on provides its credentials as a host key. You must [verify the fingerprint](#verify-a-host-key) of this host key manually. If you're mirroring over SSH (using an `ssh://` URL), you can authenticate using: - Password-based authentication, just as over HTTPS. - Public key authentication. This method is often more secure than password authentication, especially when the other repository supports [deploy keys](../../deploy_keys/_index.md). ### Get your SSH public key When you mirror a repository and select the **SSH public key** as your authentication method, GitLab generates a public key for you. The non-GitLab server needs this key to establish trust with your GitLab repository. To copy your SSH public key: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Repository**. 1. Expand **Mirroring repositories**. 1. Scroll to **Mirrored repositories**. 1. Identify the correct repository, and select **Copy SSH public key** ({{< icon name="copy-to-clipboard" >}}). 1. Add the public SSH key to the other repository's configuration: - If the other repository is hosted on GitLab, add the public SSH key as a [deploy key](../../deploy_keys/_index.md). - If the other repository is hosted elsewhere, add the key to your user's `authorized_keys` file. Paste the entire public SSH key into the file on its own line and save it. If you must change the key at any time, you can remove and re-add the mirror to generate a new key. Update the other repository with the new key to keep the mirror running. {{< alert type="note" >}} The generated keys are stored in the GitLab database, not in the file system. Therefore, SSH public key authentication for mirrors cannot be used in a pre-receive hook. {{< /alert >}} ### Verify a host key When using a host key, always verify the fingerprints match what you expect. GitLab.com and other code hosting sites publish their fingerprints for you to check: - [AWS CodeCommit](https://docs.aws.amazon.com/codecommit/latest/userguide/regions.html#regions-fingerprints) - [Bitbucket](https://support.atlassian.com/bitbucket-cloud/docs/configure-ssh-and-two-step-verification/) - [Codeberg](https://docs.codeberg.org/security/ssh-fingerprint/) - [GitHub](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/githubs-ssh-key-fingerprints) - [GitLab.com](../../../gitlab_com/_index.md#ssh-host-keys-fingerprints) - [Launchpad](https://help.launchpad.net/SSHFingerprints) - [Savannah](https://savannah.gnu.org/maintenance/SshAccess/) - [SourceForge](https://sourceforge.net/p/forge/documentation/SSH%20Key%20Fingerprints/) Other providers vary. You can securely gather key fingerprints with the following command if you: - Run GitLab Self-Managed. - Have access to the server for the other repository. ```shell $ cat /etc/ssh/ssh_host*pub | ssh-keygen -E md5 -l -f - 256 MD5:f4:28:9f:23:99:15:21:1b:bf:ed:1f:8e:a0:76:b2:9d root@example.com (ECDSA) 256 MD5:e6:eb:45:8a:3c:59:35:5f:e9:5b:80:12:be:7e:22:73 root@example.com (ED25519) 2048 MD5:3f:72:be:3d:62:03:5c:62:83:e8:6e:14:34:3a:85:1d root@example.com (RSA) ``` Older versions of SSH may require you to remove `-E md5` from the command. ## Related topics - [Troubleshooting](troubleshooting.md) for repository mirroring. - Configure a [Pull Mirroring Interval](../../../../administration/instance_limits.md#pull-mirroring-interval) - [Disable mirrors for a project](../../../../administration/settings/visibility_and_access_controls.md#enable-project-mirroring) - [Secrets file and mirroring](../../../../administration/backup_restore/troubleshooting_backup_gitlab.md#when-the-secrets-file-is-lost)
https://docs.gitlab.com/user/project/repository/push
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/repository/push.md
2025-08-13
doc/user/project/repository/mirror
[ "doc", "user", "project", "repository", "mirror" ]
push.md
Create
Source Code
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Push mirroring
Create a push mirror to passively receive changes from an upstream repository.
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} A _push mirror_ is a downstream repository that [mirrors](_index.md) the commits made to the upstream repository. Push mirrors passively receive copies of the commits made to the upstream repository. To prevent the mirror from diverging from the upstream repository, don't push commits directly to the downstream mirror. Push commits to the upstream repository instead. While [pull mirroring](pull.md) periodically retrieves updates from the upstream repository, push mirrors only receive changes when: - Commits are pushed to the upstream GitLab repository. - An administrator [force-updates the mirror](_index.md#force-an-update). When you push a change to the upstream repository, the push mirror receives it in five minutes, or one minute if the setting **Only mirror protected branches** is on. When a branch is merged into the default branch and deleted in the source project, it is deleted from the remote mirror on the next push. Branches with unmerged changes are kept. If a branch diverges, the **Mirroring repositories** section displays an error. [GitLab Silent Mode](../../../../administration/silent_mode/_index.md) disables pushing to, and pulling from, remote mirrors. ## Configure push mirroring To set up push mirroring for an existing project: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Repository**. 1. Expand **Mirroring repositories**. 1. Enter a repository URL. 1. In the **Mirror direction** dropdown list, select **Push**. 1. Select an **Authentication method**. For more information, see [Authentication methods for mirrors](_index.md#authentication-methods-for-mirrors). 1. Select **Only mirror protected branches**, if necessary. 1. Select **Keep divergent refs**, if desired. 1. To save the configuration, select **Mirror repository**. ### Configure push mirrors through the API You can also create and modify project push mirrors through the [remote mirrors API](../../../../api/remote_mirrors.md). ## Keep divergent refs By default, if any ref (branch or tag) on the remote (downstream) mirror diverges from the local repository, the upstream repository overwrites any changes on the remote: 1. A repository mirrors `main` and `develop` branches to a remote. 1. A new commit is added to `develop` on the remote mirror. 1. The next push updates the remote mirror to match the upstream repository. 1. The new commit added to `develop` on the remote mirror is lost. If **Keep divergent refs** is selected, the changes are handled differently: 1. Updates to the `develop` branch on the remote mirror are skipped. 1. The `develop` branch on the remote mirror preserves the commit that does not exist on the upstream repository. Any refs that exist in the remote mirror, but not the upstream, are left untouched. 1. The update is marked failed. After you create a mirror, you can only modify the value of **Keep divergent refs** through the [remote mirrors API](../../../../api/remote_mirrors.md). ## Set up a push mirror from GitLab to GitHub To configure a mirror from GitLab to GitHub: 1. Create a [GitHub fine-grained personal access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#fine-grained-personal-access-tokens) with at least read and write permissions on the [repository contents](https://docs.github.com/en/rest/authentication/permissions-required-for-fine-grained-personal-access-tokens?apiVersion=2022-11-28#repository-permissions-for-contents). If your repository contains a `.github/workflows` directory, you must also grant read and write access for the [Workflows](https://docs.github.com/en/rest/authentication/permissions-required-for-fine-grained-personal-access-tokens?apiVersion=2022-11-28#repository-permissions-for-workflows). For a more fine-grained access, you can configure your token to only apply to the specific repository. 1. Enter a **Git repository URL** with this format, changing the variables as needed: ```plaintext https://github.com/GROUP/PROJECT.git ``` - `GROUP`: The group on GitHub. - `PROJECT`: The project on GitHub. 1. For **Username**, enter the username of the owner of the personal access token. 1. For **Password**, enter your GitHub personal access token. 1. Select **Mirror repository**. The mirrored repository is listed. For example: ```plaintext https://*****:*****@github.com/<your_github_group>/<your_github_project>.git ``` The repository pushes shortly thereafter. To force a push, select **Update now** ({{< icon name="retry" >}}). ## Set up a push mirror from GitLab to AWS CodeCommit AWS CodeCommit push mirroring is the best way to connect GitLab repositories to AWS CodePipeline. GitLab is not yet supported as one of their Source Code Management (SCM) providers. Each new AWS CodePipeline needs significant AWS infrastructure setup. It also requires an individual pipeline per branch. If AWS CodeDeploy is the final step of a CodePipeline, you can, instead combine these tools to create a deployment: - GitLab CI/CD pipelines. - The AWS CLI in the final job in `.gitlab-ci.yml` to deploy to CodeDeploy. {{< alert type="note" >}} GitLab-to-AWS-CodeCommit push mirroring cannot use SSH authentication until [GitLab issue 34014](https://gitlab.com/gitlab-org/gitlab/-/issues/34014) is resolved. {{< /alert >}} To set up a mirror from GitLab to AWS CodeCommit: 1. In the AWS IAM console, create an IAM user. 1. Add the following least privileges permissions for repository mirroring as an **inline policy**. The Amazon Resource Names (ARNs) must explicitly include the region and account. This IAM policy grants privilege for mirroring access to two sample repositories. These permissions have been tested to be the minimum (least privileged) required for mirroring: ```json { "Version": "2012-10-17", "Statement": [ { "Sid": "MinimumGitLabPushMirroringPermissions", "Effect": "Allow", "Action": [ "codecommit:GitPull", "codecommit:GitPush" ], "Resource": [ "arn:aws:codecommit:us-east-1:111111111111:MyDestinationRepo", "arn:aws:codecommit:us-east-1:111111111111:MyDemo*" ] } ] } ``` 1. After the user is created, select the AWS IAM user name. 1. Select the **Security credentials** tab. 1. Under **HTTPS Git credentials for AWS CodeCommit**, select **Generate credentials**. {{< alert type="note" >}} This Git user ID and password is specific to communicating with CodeCommit. Do not confuse it with the IAM user ID or AWS keys of this user. {{< /alert >}} 1. Copy or download the special Git HTTPS user ID and password. 1. In the AWS CodeCommit console, create a new repository to mirror from your GitLab repository. 1. Open your new repository, in the upper-right corner, select **Code > Clone HTTPS** (not **Clone HTTPS (GRC)**). 1. In GitLab, open the repository to be push-mirrored. 1. Select **Settings > Repository**, and then expand **Mirroring repositories**. 1. Fill in the **Git repository URL** field using this format, replacing `<aws-region>` with your AWS region, and `<your_codecommit_repo>` with the name of your repository in CodeCommit: ```plaintext https://git-codecommit.<aws-region>.amazonaws.com/v1/repos/<your_codecommit_repo> ``` 1. For **Authentication method**, select **Username and Password**. 1. For **Username**, enter the AWS **special HTTPS Git user ID**. 1. For **Password**, enter the special IAM Git clone user ID password created earlier in AWS. 1. Leave the option **Only mirror protected branches** for CodeCommit. It pushes more frequently (from every five minutes to every minute). CodePipeline requires individual pipeline setups for named branches you want to have a AWS CI setup for. Because feature branches with dynamic names are unsupported, configuring **Only mirror protected branches** doesn't cause flexibility problems with CodePipeline integration. You must also protect all the named branches you want to build CodePipelines for. 1. Select **Mirror repository**. You should see the mirrored repository appear: ```plaintext https://*****:*****@git-codecommit.<aws-region>.amazonaws.com/v1/repos/<your_codecommit_repo> ``` To test mirroring by forcing a push, select **Update now** (the half-circle arrows). If **Last successful update** shows a date, you have configured mirroring correctly. If it isn't working correctly, a red `error` tag appears, and shows the error message as hover text. ## Set up a push mirror to another GitLab instance with 2FA activated 1. On the destination GitLab instance, create a [personal access token](../../../profile/personal_access_tokens.md) with `write_repository` scope. 1. On the source GitLab instance: 1. Enter the **Git repository URL** using this format: `https://<destination host>/<your_gitlab_group_or_name>/<your_gitlab_project>.git`. 1. Enter the **Username** `oauth2`. 1. Enter the **Password**. Use the GitLab personal access token created on the destination GitLab instance. 1. Select **Mirror repository**. ## Related topics - [Troubleshooting](troubleshooting.md) for repository mirroring. - [Remote mirrors API](../../../../api/remote_mirrors.md)
--- stage: Create group: Source Code info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments description: Create a push mirror to passively receive changes from an upstream repository. title: Push mirroring breadcrumbs: - doc - user - project - repository - mirror --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} A _push mirror_ is a downstream repository that [mirrors](_index.md) the commits made to the upstream repository. Push mirrors passively receive copies of the commits made to the upstream repository. To prevent the mirror from diverging from the upstream repository, don't push commits directly to the downstream mirror. Push commits to the upstream repository instead. While [pull mirroring](pull.md) periodically retrieves updates from the upstream repository, push mirrors only receive changes when: - Commits are pushed to the upstream GitLab repository. - An administrator [force-updates the mirror](_index.md#force-an-update). When you push a change to the upstream repository, the push mirror receives it in five minutes, or one minute if the setting **Only mirror protected branches** is on. When a branch is merged into the default branch and deleted in the source project, it is deleted from the remote mirror on the next push. Branches with unmerged changes are kept. If a branch diverges, the **Mirroring repositories** section displays an error. [GitLab Silent Mode](../../../../administration/silent_mode/_index.md) disables pushing to, and pulling from, remote mirrors. ## Configure push mirroring To set up push mirroring for an existing project: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Repository**. 1. Expand **Mirroring repositories**. 1. Enter a repository URL. 1. In the **Mirror direction** dropdown list, select **Push**. 1. Select an **Authentication method**. For more information, see [Authentication methods for mirrors](_index.md#authentication-methods-for-mirrors). 1. Select **Only mirror protected branches**, if necessary. 1. Select **Keep divergent refs**, if desired. 1. To save the configuration, select **Mirror repository**. ### Configure push mirrors through the API You can also create and modify project push mirrors through the [remote mirrors API](../../../../api/remote_mirrors.md). ## Keep divergent refs By default, if any ref (branch or tag) on the remote (downstream) mirror diverges from the local repository, the upstream repository overwrites any changes on the remote: 1. A repository mirrors `main` and `develop` branches to a remote. 1. A new commit is added to `develop` on the remote mirror. 1. The next push updates the remote mirror to match the upstream repository. 1. The new commit added to `develop` on the remote mirror is lost. If **Keep divergent refs** is selected, the changes are handled differently: 1. Updates to the `develop` branch on the remote mirror are skipped. 1. The `develop` branch on the remote mirror preserves the commit that does not exist on the upstream repository. Any refs that exist in the remote mirror, but not the upstream, are left untouched. 1. The update is marked failed. After you create a mirror, you can only modify the value of **Keep divergent refs** through the [remote mirrors API](../../../../api/remote_mirrors.md). ## Set up a push mirror from GitLab to GitHub To configure a mirror from GitLab to GitHub: 1. Create a [GitHub fine-grained personal access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#fine-grained-personal-access-tokens) with at least read and write permissions on the [repository contents](https://docs.github.com/en/rest/authentication/permissions-required-for-fine-grained-personal-access-tokens?apiVersion=2022-11-28#repository-permissions-for-contents). If your repository contains a `.github/workflows` directory, you must also grant read and write access for the [Workflows](https://docs.github.com/en/rest/authentication/permissions-required-for-fine-grained-personal-access-tokens?apiVersion=2022-11-28#repository-permissions-for-workflows). For a more fine-grained access, you can configure your token to only apply to the specific repository. 1. Enter a **Git repository URL** with this format, changing the variables as needed: ```plaintext https://github.com/GROUP/PROJECT.git ``` - `GROUP`: The group on GitHub. - `PROJECT`: The project on GitHub. 1. For **Username**, enter the username of the owner of the personal access token. 1. For **Password**, enter your GitHub personal access token. 1. Select **Mirror repository**. The mirrored repository is listed. For example: ```plaintext https://*****:*****@github.com/<your_github_group>/<your_github_project>.git ``` The repository pushes shortly thereafter. To force a push, select **Update now** ({{< icon name="retry" >}}). ## Set up a push mirror from GitLab to AWS CodeCommit AWS CodeCommit push mirroring is the best way to connect GitLab repositories to AWS CodePipeline. GitLab is not yet supported as one of their Source Code Management (SCM) providers. Each new AWS CodePipeline needs significant AWS infrastructure setup. It also requires an individual pipeline per branch. If AWS CodeDeploy is the final step of a CodePipeline, you can, instead combine these tools to create a deployment: - GitLab CI/CD pipelines. - The AWS CLI in the final job in `.gitlab-ci.yml` to deploy to CodeDeploy. {{< alert type="note" >}} GitLab-to-AWS-CodeCommit push mirroring cannot use SSH authentication until [GitLab issue 34014](https://gitlab.com/gitlab-org/gitlab/-/issues/34014) is resolved. {{< /alert >}} To set up a mirror from GitLab to AWS CodeCommit: 1. In the AWS IAM console, create an IAM user. 1. Add the following least privileges permissions for repository mirroring as an **inline policy**. The Amazon Resource Names (ARNs) must explicitly include the region and account. This IAM policy grants privilege for mirroring access to two sample repositories. These permissions have been tested to be the minimum (least privileged) required for mirroring: ```json { "Version": "2012-10-17", "Statement": [ { "Sid": "MinimumGitLabPushMirroringPermissions", "Effect": "Allow", "Action": [ "codecommit:GitPull", "codecommit:GitPush" ], "Resource": [ "arn:aws:codecommit:us-east-1:111111111111:MyDestinationRepo", "arn:aws:codecommit:us-east-1:111111111111:MyDemo*" ] } ] } ``` 1. After the user is created, select the AWS IAM user name. 1. Select the **Security credentials** tab. 1. Under **HTTPS Git credentials for AWS CodeCommit**, select **Generate credentials**. {{< alert type="note" >}} This Git user ID and password is specific to communicating with CodeCommit. Do not confuse it with the IAM user ID or AWS keys of this user. {{< /alert >}} 1. Copy or download the special Git HTTPS user ID and password. 1. In the AWS CodeCommit console, create a new repository to mirror from your GitLab repository. 1. Open your new repository, in the upper-right corner, select **Code > Clone HTTPS** (not **Clone HTTPS (GRC)**). 1. In GitLab, open the repository to be push-mirrored. 1. Select **Settings > Repository**, and then expand **Mirroring repositories**. 1. Fill in the **Git repository URL** field using this format, replacing `<aws-region>` with your AWS region, and `<your_codecommit_repo>` with the name of your repository in CodeCommit: ```plaintext https://git-codecommit.<aws-region>.amazonaws.com/v1/repos/<your_codecommit_repo> ``` 1. For **Authentication method**, select **Username and Password**. 1. For **Username**, enter the AWS **special HTTPS Git user ID**. 1. For **Password**, enter the special IAM Git clone user ID password created earlier in AWS. 1. Leave the option **Only mirror protected branches** for CodeCommit. It pushes more frequently (from every five minutes to every minute). CodePipeline requires individual pipeline setups for named branches you want to have a AWS CI setup for. Because feature branches with dynamic names are unsupported, configuring **Only mirror protected branches** doesn't cause flexibility problems with CodePipeline integration. You must also protect all the named branches you want to build CodePipelines for. 1. Select **Mirror repository**. You should see the mirrored repository appear: ```plaintext https://*****:*****@git-codecommit.<aws-region>.amazonaws.com/v1/repos/<your_codecommit_repo> ``` To test mirroring by forcing a push, select **Update now** (the half-circle arrows). If **Last successful update** shows a date, you have configured mirroring correctly. If it isn't working correctly, a red `error` tag appears, and shows the error message as hover text. ## Set up a push mirror to another GitLab instance with 2FA activated 1. On the destination GitLab instance, create a [personal access token](../../../profile/personal_access_tokens.md) with `write_repository` scope. 1. On the source GitLab instance: 1. Enter the **Git repository URL** using this format: `https://<destination host>/<your_gitlab_group_or_name>/<your_gitlab_project>.git`. 1. Enter the **Username** `oauth2`. 1. Enter the **Password**. Use the GitLab personal access token created on the destination GitLab instance. 1. Select **Mirror repository**. ## Related topics - [Troubleshooting](troubleshooting.md) for repository mirroring. - [Remote mirrors API](../../../../api/remote_mirrors.md)
https://docs.gitlab.com/user/project/repository/pull
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/repository/pull.md
2025-08-13
doc/user/project/repository/mirror
[ "doc", "user", "project", "repository", "mirror" ]
pull.md
Create
Source Code
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Pull from a remote repository
Create a pull mirror to pull changes from a remote repository into GitLab, and keep your copy of it up-to-date.
{{< details >}} - Tier: Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} {{< history >}} - Moved to GitLab Premium in 13.9. {{< /history >}} You can use the GitLab interface to browse the content and activity of a repository, even if it isn't hosted on GitLab. Create a pull [mirror](_index.md) to copy the branches, tags, and commits from an upstream repository to yours. Unlike [push mirrors](push.md), pull mirrors retrieve changes from an upstream (remote) repository on a scheduled basis. To prevent the mirror from diverging from the upstream repository, don't push commits directly to the downstream mirror. Push commits to the upstream repository instead. Changes in the remote repository are pulled into the GitLab repository: - Automatically, 30 minutes after a previous pull. This cannot be disabled. - When an administrator [force-updates the mirror](_index.md#force-an-update). - When an [API call triggers an update](#trigger-an-update-by-using-the-api). UI and API updates are subject to default [pull mirroring intervals](../../../../administration/instance_limits.md#pull-mirroring-interval) of 5 minutes. This interval can be configured on GitLab Self-Managed instances. By default, if any branch or tag on the downstream pull mirror diverges from the local repository, GitLab stops updating the branch. This prevents data loss. Deleted branches and tags in the upstream repository are not reflected in the downstream repository. {{< alert type="note" >}} Items deleted from the downstream pull mirror repository, but still in the upstream repository, are restored upon the next pull. For example: a branch deleted only in the mirrored repository reappears after the next pull. {{< /alert >}} ## How pull mirroring works After you configure a GitLab repository as a pull mirror: 1. GitLab adds the repository to a queue. 1. Once per minute, a Sidekiq cron job schedules repository mirrors to update, based on: - Available capacity, determined by Sidekiq settings. For GitLab.com, read [GitLab.com Sidekiq settings](../../../gitlab_com/_index.md#sidekiq). - How many mirrors are already in the queue and due for updates. Being due depends on when the repository mirror was last updated, and how many times updates have been retried. 1. Sidekiq becomes available to process updates, mirrors are updated. If the update process: - Succeeds: An update is enqueued again with at least a 30 minute wait. - Fails: The update is attempted again later. After 14 failures, a mirror is marked as a [hard failure](#fix-hard-failures-when-mirroring) and is no longer enqueued for updates. A branch diverging from its upstream counterpart can cause failures. To prevent branches from diverging, configure [Overwrite diverged branches](#overwrite-diverged-branches) when you create your mirror. ## Configure pull mirroring Prerequisites: - If your remote repository is on GitHub and you have [two-factor authentication (2FA) configured](https://docs.github.com/en/authentication/securing-your-account-with-two-factor-authentication-2fa), create a [personal access token for GitHub](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens) with the `repo` scope. If 2FA is enabled, this personal access token serves as your GitHub password. - [GitLab Silent Mode](../../../../administration/silent_mode/_index.md) is not enabled. 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Repository**. 1. Expand **Mirroring repositories**. 1. Enter the **Git repository URL**. {{< alert type="note" >}} To mirror the `gitlab` repository, use `gitlab.com:gitlab-org/gitlab.git` or `https://gitlab.com/gitlab-org/gitlab.git`. {{< /alert >}} 1. In **Mirror direction**, select **Pull**. 1. In **Authentication method**, select your authentication method. For more information, see [Authentication methods for mirrors](_index.md#authentication-methods-for-mirrors). 1. Select any of the options you need: - [**Overwrite diverged branches**](#overwrite-diverged-branches) - [**Trigger pipelines for mirror updates**](#trigger-pipelines-for-mirror-updates) - **Only mirror protected branches** 1. To save the configuration, select **Mirror repository**. ### Overwrite diverged branches {{< history >}} - Moved to GitLab Premium in 13.9. {{< /history >}} To always update your local branches with remote versions, even if they have diverged from the remote, select **Overwrite diverged branches** when you create a mirror. {{< alert type="warning" >}} For mirrored branches, enabling this option results in the loss of local changes. {{< /alert >}} ### Trigger pipelines for mirror updates {{< history >}} - Moved to GitLab Premium in 13.9. {{< /history >}} You can configure your mirror to automatically trigger pipelines when the remote repository updates branches or tags. Before you enable this feature: - Ensure your CI runners can handle the additional load from the remote repository activity. - Consider the security implications. The pipelines use the credentials from pull mirroring and run unreviewed code. Only enable this feature for your own projects or those with trusted maintainers. ## Trigger an update by using the API {{< history >}} - moved to GitLab Premium in 13.9. {{< /history >}} Pull mirroring uses polling to detect new branches and commits added upstream, often minutes afterwards. You can notify GitLab using an [API call](../../../../api/project_pull_mirroring.md#start-the-pull-mirroring-process-for-a-project), but the [minimum interval for pull mirroring limits](_index.md#force-an-update) is still enforced. For more information, read [Start the pull mirroring process for a project](../../../../api/project_pull_mirroring.md#start-the-pull-mirroring-process-for-a-project). ## Fix hard failures when mirroring {{< history >}} - Moved to GitLab Premium in 13.9. {{< /history >}} After 14 consecutive unsuccessful retries, the mirroring process is marked as a hard failure and mirroring attempts stop. This failure is visible in either the: - Project's main dashboard. - Pull mirror settings page. To resume project mirroring, [force an update](_index.md#force-an-update). If multiple projects are affected by this problem, such as after a long network or server outage, you can use the [Rails console](../../../../administration/operations/rails_console.md) to identify and update all affected projects with this command: ```ruby Project.find_each do |p| if p.import_state && p.import_state.retry_count >= 14 puts "Resetting mirroring operation for #{p.full_path}" p.import_state.reset_retry_count p.import_state.set_next_execution_to_now(prioritized: true) p.import_state.save! end end ``` ## Related topics - [Troubleshooting](troubleshooting.md) for repository mirroring. - [Pull mirroring intervals](../../../../administration/instance_limits.md#pull-mirroring-interval) - [Project pull mirroring API](../../../../api/project_pull_mirroring.md#configure-pull-mirroring-for-a-project)
--- stage: Create group: Source Code info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments description: Create a pull mirror to pull changes from a remote repository into GitLab, and keep your copy of it up-to-date. title: Pull from a remote repository breadcrumbs: - doc - user - project - repository - mirror --- {{< details >}} - Tier: Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} {{< history >}} - Moved to GitLab Premium in 13.9. {{< /history >}} You can use the GitLab interface to browse the content and activity of a repository, even if it isn't hosted on GitLab. Create a pull [mirror](_index.md) to copy the branches, tags, and commits from an upstream repository to yours. Unlike [push mirrors](push.md), pull mirrors retrieve changes from an upstream (remote) repository on a scheduled basis. To prevent the mirror from diverging from the upstream repository, don't push commits directly to the downstream mirror. Push commits to the upstream repository instead. Changes in the remote repository are pulled into the GitLab repository: - Automatically, 30 minutes after a previous pull. This cannot be disabled. - When an administrator [force-updates the mirror](_index.md#force-an-update). - When an [API call triggers an update](#trigger-an-update-by-using-the-api). UI and API updates are subject to default [pull mirroring intervals](../../../../administration/instance_limits.md#pull-mirroring-interval) of 5 minutes. This interval can be configured on GitLab Self-Managed instances. By default, if any branch or tag on the downstream pull mirror diverges from the local repository, GitLab stops updating the branch. This prevents data loss. Deleted branches and tags in the upstream repository are not reflected in the downstream repository. {{< alert type="note" >}} Items deleted from the downstream pull mirror repository, but still in the upstream repository, are restored upon the next pull. For example: a branch deleted only in the mirrored repository reappears after the next pull. {{< /alert >}} ## How pull mirroring works After you configure a GitLab repository as a pull mirror: 1. GitLab adds the repository to a queue. 1. Once per minute, a Sidekiq cron job schedules repository mirrors to update, based on: - Available capacity, determined by Sidekiq settings. For GitLab.com, read [GitLab.com Sidekiq settings](../../../gitlab_com/_index.md#sidekiq). - How many mirrors are already in the queue and due for updates. Being due depends on when the repository mirror was last updated, and how many times updates have been retried. 1. Sidekiq becomes available to process updates, mirrors are updated. If the update process: - Succeeds: An update is enqueued again with at least a 30 minute wait. - Fails: The update is attempted again later. After 14 failures, a mirror is marked as a [hard failure](#fix-hard-failures-when-mirroring) and is no longer enqueued for updates. A branch diverging from its upstream counterpart can cause failures. To prevent branches from diverging, configure [Overwrite diverged branches](#overwrite-diverged-branches) when you create your mirror. ## Configure pull mirroring Prerequisites: - If your remote repository is on GitHub and you have [two-factor authentication (2FA) configured](https://docs.github.com/en/authentication/securing-your-account-with-two-factor-authentication-2fa), create a [personal access token for GitHub](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens) with the `repo` scope. If 2FA is enabled, this personal access token serves as your GitHub password. - [GitLab Silent Mode](../../../../administration/silent_mode/_index.md) is not enabled. 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Repository**. 1. Expand **Mirroring repositories**. 1. Enter the **Git repository URL**. {{< alert type="note" >}} To mirror the `gitlab` repository, use `gitlab.com:gitlab-org/gitlab.git` or `https://gitlab.com/gitlab-org/gitlab.git`. {{< /alert >}} 1. In **Mirror direction**, select **Pull**. 1. In **Authentication method**, select your authentication method. For more information, see [Authentication methods for mirrors](_index.md#authentication-methods-for-mirrors). 1. Select any of the options you need: - [**Overwrite diverged branches**](#overwrite-diverged-branches) - [**Trigger pipelines for mirror updates**](#trigger-pipelines-for-mirror-updates) - **Only mirror protected branches** 1. To save the configuration, select **Mirror repository**. ### Overwrite diverged branches {{< history >}} - Moved to GitLab Premium in 13.9. {{< /history >}} To always update your local branches with remote versions, even if they have diverged from the remote, select **Overwrite diverged branches** when you create a mirror. {{< alert type="warning" >}} For mirrored branches, enabling this option results in the loss of local changes. {{< /alert >}} ### Trigger pipelines for mirror updates {{< history >}} - Moved to GitLab Premium in 13.9. {{< /history >}} You can configure your mirror to automatically trigger pipelines when the remote repository updates branches or tags. Before you enable this feature: - Ensure your CI runners can handle the additional load from the remote repository activity. - Consider the security implications. The pipelines use the credentials from pull mirroring and run unreviewed code. Only enable this feature for your own projects or those with trusted maintainers. ## Trigger an update by using the API {{< history >}} - moved to GitLab Premium in 13.9. {{< /history >}} Pull mirroring uses polling to detect new branches and commits added upstream, often minutes afterwards. You can notify GitLab using an [API call](../../../../api/project_pull_mirroring.md#start-the-pull-mirroring-process-for-a-project), but the [minimum interval for pull mirroring limits](_index.md#force-an-update) is still enforced. For more information, read [Start the pull mirroring process for a project](../../../../api/project_pull_mirroring.md#start-the-pull-mirroring-process-for-a-project). ## Fix hard failures when mirroring {{< history >}} - Moved to GitLab Premium in 13.9. {{< /history >}} After 14 consecutive unsuccessful retries, the mirroring process is marked as a hard failure and mirroring attempts stop. This failure is visible in either the: - Project's main dashboard. - Pull mirror settings page. To resume project mirroring, [force an update](_index.md#force-an-update). If multiple projects are affected by this problem, such as after a long network or server outage, you can use the [Rails console](../../../../administration/operations/rails_console.md) to identify and update all affected projects with this command: ```ruby Project.find_each do |p| if p.import_state && p.import_state.retry_count >= 14 puts "Resetting mirroring operation for #{p.full_path}" p.import_state.reset_retry_count p.import_state.set_next_execution_to_now(prioritized: true) p.import_state.save! end end ``` ## Related topics - [Troubleshooting](troubleshooting.md) for repository mirroring. - [Pull mirroring intervals](../../../../administration/instance_limits.md#pull-mirroring-interval) - [Project pull mirroring API](../../../../api/project_pull_mirroring.md#configure-pull-mirroring-for-a-project)
https://docs.gitlab.com/user/project/repository/troubleshooting
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/repository/troubleshooting.md
2025-08-13
doc/user/project/repository/mirror
[ "doc", "user", "project", "repository", "mirror" ]
troubleshooting.md
Create
Source Code
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Troubleshooting repository mirroring
Troubleshooting problems with repository mirroring for GitLab projects.
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} When mirroring fails, project maintainers can see a link similar to {{< icon name="warning-solid" >}} **Pull mirroring failed 1 hour ago**. on the project details page. Select this link to go directly to the mirroring settings, where GitLab displays an **Error** badge for the mirrored repository. You can hover your mouse cursor over the badge to display the text of the error: ![Error message shown on hover](img/mirror_error_v16_3.png) ## Received RST_STREAM with error code 2 with GitHub If you receive this message while mirroring to a GitHub repository: ```plaintext 13:Received RST_STREAM with error code 2 ``` One of these issues might be occurring: 1. Your GitHub settings might be set to block pushes that expose your email address used in commits. To fix this problem, either: - Set your GitHub email address to public. - Disable the [Block command line pushes that expose my email](https://github.com/settings/emails) setting. 1. Your repository exceeds the GitHub file size limit of 100 MB. To fix this problem, check the file size limit configured for on GitHub, and consider using [Git Large File Storage](https://git-lfs.com/) to manage large files. ## Deadline Exceeded When you upgrade GitLab, a change in how usernames are represented means that you must update your mirroring username and password to ensure that `%40` characters are replaced with `@`. ## Connection blocked: server only allows public key authentication The connection between GitLab and the remote repository is blocked. Even if a [TCP Check](../../../../administration/raketasks/maintenance.md#check-tcp-connectivity-to-a-remote-site) is successful, you must check any networking components in the route from GitLab to the remote server for blockage. This error can occur when a firewall performs a `Deep SSH Inspection` on outgoing packets. ## Could not read username: terminal prompts disabled If you receive this error after creating a new project using [GitLab CI/CD for external repositories](../../../../ci/ci_cd_for_external_repos/_index.md): - In Bitbucket Cloud: ```plaintext "2:fetch remote: "fatal: could not read Username for 'https://bitbucket.org': terminal prompts disabled\n": exit status 128." ``` - In Bitbucket Server (self-hosted): ```plaintext "2:fetch remote: "fatal: could not read Username for 'https://lab.example.com': terminal prompts disabled\n": exit status 128. ``` Check if the repository owner is specified in the URL of your mirrored repository: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Repository**. 1. Expand **Mirroring repositories**. 1. If no repository owner is specified, delete and add the URL again in this format, replacing `OWNER`, `ACCOUNTNAME`, `PATH_TO_REPO`, and `REPONAME` with your values: - In Bitbucket Cloud: ```plaintext https://OWNER@bitbucket.org/ACCOUNTNAME/REPONAME.git ``` - In Bitbucket Server (self-hosted): ```plaintext https://OWNER@lab.example.com/PATH_TO_REPO/REPONAME.git ``` When connecting to the Cloud or self-hosted Bitbucket repository for mirroring, the repository owner is required in the string. ## Push mirror: `LFS objects are missing` You might get an error that states: ```plaintext GitLab: GitLab: LFS objects are missing. Ensure LFS is properly set up or try a manual "git lfs push --all". ``` This issue occurs when you use an SSH repository URL for push mirroring. Push mirroring to transfer LFS files over SSH is not supported. The workaround is to use an HTTPS repository URL instead of SSH for your push mirror. An [issue exists](https://gitlab.com/gitlab-org/gitlab/-/issues/249587) to fix this problem. ## Pull mirror is missing LFS files In some cases, pull mirroring does not transfer LFS files. This issue occurs when you use an SSH repository URL. The workaround is to use an HTTPS repository URL instead. ## Pull mirroring is not triggering pipelines Pipelines might not run for multiple reasons: - [Trigger pipelines for mirror updates](pull.md#trigger-pipelines-for-mirror-updates) might not be enabled. This setting can only be enabled when initially [configuring pull mirroring](pull.md#configure-pull-mirroring). The status [is not displayed](https://gitlab.com/gitlab-org/gitlab/-/issues/346630) when checking the project afterwards. When mirroring is set up using [CI/CD for external repositories](../../../../ci/ci_cd_for_external_repos/_index.md) this setting is enabled by default. If repository mirroring is manually reconfigured, triggering pipelines is off by default and this could be why pipelines stop running. - [`rules`](../../../../ci/yaml/_index.md#rules) configuration prevents any jobs from being added to the pipeline. - Pipelines are triggered using [the account that set up the pull mirror](https://gitlab.com/gitlab-org/gitlab/-/issues/13697). If the account is no longer valid, pipelines do not run. - [Branch protection](../branches/protected.md#cicd-on-protected-branches) might prevent the account that set up mirroring from running pipelines. ## `The repository is being updated`, but neither fails nor succeeds visibly In rare cases, mirroring slots on Redis can become exhausted, possibly because Sidekiq workers are reaped due to out-of-memory (OoM) events. When this occurs, mirroring jobs start and complete quickly, but they neither fail nor succeed. They also do not leave a clear log. To check for this problem: 1. Enter the [Rails console](../../../../administration/operations/rails_console.md) and check Redis' mirroring capacity: ```ruby current = Gitlab::Redis::SharedState.with { |redis| redis.scard('MIRROR_PULL_CAPACITY') }.to_i maximum = Gitlab::CurrentSettings.mirror_max_capacity available = maximum - current ``` 1. If the mirroring capacity is `0` or very low, you can drain all stuck jobs with: ```ruby Gitlab::Redis::SharedState.with { |redis| redis.smembers('MIRROR_PULL_CAPACITY') }.each do |pid| Gitlab::Redis::SharedState.with { |redis| redis.srem('MIRROR_PULL_CAPACITY', pid) } end ``` 1. After you run the command, the [background jobs page](../../../../administration/admin_area.md#background-jobs) should show new mirroring jobs being scheduled, especially when [triggered manually](_index.md#update-a-mirror). ## Invalid URL If you receive this error while setting up mirroring over [SSH](_index.md#ssh-authentication), make sure the URL is in a valid format. Mirroring does not support SCP-like clone URLs in the form of `git@gitlab.com:gitlab-org/gitlab.git`, with host and project path separated using `:`. It requires a [standard URL](https://git-scm.com/docs/git-clone#_git_urls) that includes the `ssh://` protocol, like `ssh://git@gitlab.com/gitlab-org/gitlab.git`. ## Host key verification failed This error is returned when the target host public SSH key changes. Public SSH keys rarely change. If host key verification fails, but you suspect the key is still valid, you must delete the repository mirror and create it again. For more information, see [Create a repository mirror](_index.md#create-a-repository-mirror). ## Transfer mirror users and tokens to a single service account This requires access to the [GitLab Rails console](../../../../administration/operations/rails_console.md#starting-a-rails-console-session). Use case: If you have multiple users using their own GitHub credentials to set up repository mirroring, mirroring breaks when people leave the company. Use this script to migrate disparate mirroring users and tokens into a single service account: {{< alert type="warning" >}} Commands that change data can cause damage if not run correctly or under the right conditions. Always run commands in a test environment first and have a backup instance ready to restore. {{< /alert >}} ```ruby svc_user = User.find_by(username: 'ourServiceUser') token = 'githubAccessToken' Project.where(mirror: true).each do |project| import_url = project.import_url # The url we want is https://token@project/path.git repo_url = if import_url.include?('@') # Case 1: The url is something like https://23423432@project/path.git import_url.split('@').last elsif import_url.include?('//') # Case 2: The url is something like https://project/path.git import_url.split('//').last end next unless repo_url final_url = "https://#{token}@#{repo_url}" project.mirror_user = svc_user project.import_url = final_url project.username_only_import_url = final_url project.save end ``` ## `The requested URL returned error: 301` When mirroring using the `http://` or `https://` protocols, be sure to specify the exact URL to the repository: `https://gitlab.example.com/group/project.git` HTTP redirects are not followed and omitting `.git` can result in a 301 error: ```plaintext 13:fetch remote: "fatal: unable to access 'https://gitlab.com/group/project': The requested URL returned error: 301\n": exit status 128. ``` ## Push mirror from GitLab instance to Geo secondary fails Push mirroring of a GitLab repository using the HTTP or HTTPS protocols fails when the destination is a Geo secondary node due to the proxying of the push request to the Geo primary node, and the following error is displayed: ```plaintext 13:get remote references: create git ls-remote: exit status 128, stderr: "fatal: unable to access 'https://gitlab.example.com/group/destination.git/': The requested URL returned error: 302". ``` This occurs when a Geo unified URL is configured and the target host name resolves to the secondary node's IP address. The error can be avoided by: - Configuring the push mirror to use the SSH protocol. However, the repository must not contain any LFS objects, which are always transferred over HTTP or HTTPS and are still redirected. - Using a reverse proxy to direct all requests from the source instance to the primary Geo node. - Adding a local `hosts` file entry on the source to force the target host name to resolve to the Geo primary node's IP address. - Configuring a pull mirror on the target instead. ## Pull or push mirror fails to update: `The project is not mirrored` Pull and push mirrors fail to update when [GitLab Silent Mode](../../../../administration/silent_mode/_index.md) is enabled. When this happens, the option to allow mirroring on the UI is disabled. An administrator can check to confirm that GitLab Silent Mode is disabled. When mirroring fails due to Silent Mode the following are the debug steps: - [Triggering the mirror using the API](pull.md#trigger-pipelines-for-mirror-updates) shows: `The project is not mirrored`. - If pull or push mirror was already set up but there are no further updates on the mirrored repository, confirm the [project's pull and push mirror details ans status](../../../../api/project_pull_mirroring.md#get-a-projects-pull-mirror-details) are not recent as shown below. This indicates mirroring was paused and disabling GitLab Silent Mode restarts it automatically. For example, if Silent Mode is what is impeding your imports, the output is similar to the following: ```json "id": 1, "update_status": "finished", "url": "https://test.git" "last_error": null, "last_update_at": null, "last_update_started_at": "2023-12-12T00:01:02.222Z", "last_successful_update_at": null ``` ## Initial mirroring fails: `Unable to pull mirror repo: Unable to get pack index` You might get an error that states something similar to the following: ```plaintext 13:fetch remote: "error: Unable to open local file /var/opt/gitlab/git-data/repositories/+gitaly/tmp/quarantine-[OMITTED].idx.temp.temp\nerror: Unable to get pack index https://git.example.org/ebtables/objects/pack/pack-[OMITTED].idx\nerror: Unable to find fcde2b2edba56bf408601fb721fe9b5c338d10ee under https://git.example.org/ebtables Cannot obtain needed object fcde2b2edba56bf408601fb721fe9b5c338d10ee while processing commit 2c26b46b68ffc68ff99b453c1d30413413422d70. error: fetch failed.\n": exit status 128. ``` This issue occurs because Gitaly does not support mirroring or importing repositories over the "dumb" HTTP protocol. To determine if a server is "smart" or "dumb", use cURL to start a reference discovery for the `git-upload-pack` service and emulate a Git "smart" client: ```shell $GIT_URL="https://git.example.org/project" curl --silent --dump-header - "$GIT_URL/info/refs?service=git-upload-pack"\ -o /dev/null | grep -Ei "$content-type:" ``` - A ["smart" server](https://www.git-scm.com/docs/http-protocol#_smart_server_response) reports `application/x-git-upload-pack-advertisement` in the `Content-Type` response header. - A "dumb" server reports `text/plain` in the `Content-Type` response header. For more information, see the [Git documentation on discovering references](https://www.git-scm.com/docs/http-protocol#_discovering_references). To resolve this, you can do either of the following: - Migrate the source repository to a "smart" server. - Mirror the repository using the [SSH protocol](_index.md#ssh-authentication) (requires authentication). ## Error: `File directory conflict` You might get an error that states something similar to the following: ```plaintext 13:preparing reference update: file directory conflict ``` This error occurs when a tag or branch name conflict exists between the source and mirror repositories. For example: - A tag or branch named `x/y` exists in the mirror repository. - A tag or branch named `x` exists in the source repository. To resolve this issue, delete the conflicting tag or branch. If you cannot identify the conflicting tag or branch, delete all tags from your mirror repository. An alternative option is to [overwrite diverged branches](pull.md#overwrite-diverged-branches). {{< alert type="note" >}} Deleting tags could be destructive for any work done in the mirror repository. {{< /alert >}} To delete and remove all tags from the mirror repository: 1. On a local copy of your mirrored repository, run: ```shell git tag -l | xargs -n 1 git push --delete origin ``` 1. On the left sidebar, select **Settings > Repository**. 1. Expand **Mirroring repositories**. 1. Select **Update now** ({{< icon name="retry" >}}). ## Push mirroring stuck with large LFS files You might encounter timeout issues when push mirroring a project that contains large LFS objects. This issue occurs when Git LFS operations exceed the default activity timeout. This error appears in the mirroring logs: ```plaintext push to mirror: git push: exit status 1, stderr: "remote: GitLab: LFS objects are missing. Ensure LFS is properly set up or try a manual \"git lfs push --all\"" ``` To resolve this issue, increase the LFS activity timeout value before configuring the mirror: ```shell git config lfs.activitytimeout 240 ``` This command sets the timeout to `240` seconds. You can adjust this value based on your file sizes and network conditions.
--- stage: Create group: Source Code info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments description: Troubleshooting problems with repository mirroring for GitLab projects. title: Troubleshooting repository mirroring breadcrumbs: - doc - user - project - repository - mirror --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} When mirroring fails, project maintainers can see a link similar to {{< icon name="warning-solid" >}} **Pull mirroring failed 1 hour ago**. on the project details page. Select this link to go directly to the mirroring settings, where GitLab displays an **Error** badge for the mirrored repository. You can hover your mouse cursor over the badge to display the text of the error: ![Error message shown on hover](img/mirror_error_v16_3.png) ## Received RST_STREAM with error code 2 with GitHub If you receive this message while mirroring to a GitHub repository: ```plaintext 13:Received RST_STREAM with error code 2 ``` One of these issues might be occurring: 1. Your GitHub settings might be set to block pushes that expose your email address used in commits. To fix this problem, either: - Set your GitHub email address to public. - Disable the [Block command line pushes that expose my email](https://github.com/settings/emails) setting. 1. Your repository exceeds the GitHub file size limit of 100 MB. To fix this problem, check the file size limit configured for on GitHub, and consider using [Git Large File Storage](https://git-lfs.com/) to manage large files. ## Deadline Exceeded When you upgrade GitLab, a change in how usernames are represented means that you must update your mirroring username and password to ensure that `%40` characters are replaced with `@`. ## Connection blocked: server only allows public key authentication The connection between GitLab and the remote repository is blocked. Even if a [TCP Check](../../../../administration/raketasks/maintenance.md#check-tcp-connectivity-to-a-remote-site) is successful, you must check any networking components in the route from GitLab to the remote server for blockage. This error can occur when a firewall performs a `Deep SSH Inspection` on outgoing packets. ## Could not read username: terminal prompts disabled If you receive this error after creating a new project using [GitLab CI/CD for external repositories](../../../../ci/ci_cd_for_external_repos/_index.md): - In Bitbucket Cloud: ```plaintext "2:fetch remote: "fatal: could not read Username for 'https://bitbucket.org': terminal prompts disabled\n": exit status 128." ``` - In Bitbucket Server (self-hosted): ```plaintext "2:fetch remote: "fatal: could not read Username for 'https://lab.example.com': terminal prompts disabled\n": exit status 128. ``` Check if the repository owner is specified in the URL of your mirrored repository: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Repository**. 1. Expand **Mirroring repositories**. 1. If no repository owner is specified, delete and add the URL again in this format, replacing `OWNER`, `ACCOUNTNAME`, `PATH_TO_REPO`, and `REPONAME` with your values: - In Bitbucket Cloud: ```plaintext https://OWNER@bitbucket.org/ACCOUNTNAME/REPONAME.git ``` - In Bitbucket Server (self-hosted): ```plaintext https://OWNER@lab.example.com/PATH_TO_REPO/REPONAME.git ``` When connecting to the Cloud or self-hosted Bitbucket repository for mirroring, the repository owner is required in the string. ## Push mirror: `LFS objects are missing` You might get an error that states: ```plaintext GitLab: GitLab: LFS objects are missing. Ensure LFS is properly set up or try a manual "git lfs push --all". ``` This issue occurs when you use an SSH repository URL for push mirroring. Push mirroring to transfer LFS files over SSH is not supported. The workaround is to use an HTTPS repository URL instead of SSH for your push mirror. An [issue exists](https://gitlab.com/gitlab-org/gitlab/-/issues/249587) to fix this problem. ## Pull mirror is missing LFS files In some cases, pull mirroring does not transfer LFS files. This issue occurs when you use an SSH repository URL. The workaround is to use an HTTPS repository URL instead. ## Pull mirroring is not triggering pipelines Pipelines might not run for multiple reasons: - [Trigger pipelines for mirror updates](pull.md#trigger-pipelines-for-mirror-updates) might not be enabled. This setting can only be enabled when initially [configuring pull mirroring](pull.md#configure-pull-mirroring). The status [is not displayed](https://gitlab.com/gitlab-org/gitlab/-/issues/346630) when checking the project afterwards. When mirroring is set up using [CI/CD for external repositories](../../../../ci/ci_cd_for_external_repos/_index.md) this setting is enabled by default. If repository mirroring is manually reconfigured, triggering pipelines is off by default and this could be why pipelines stop running. - [`rules`](../../../../ci/yaml/_index.md#rules) configuration prevents any jobs from being added to the pipeline. - Pipelines are triggered using [the account that set up the pull mirror](https://gitlab.com/gitlab-org/gitlab/-/issues/13697). If the account is no longer valid, pipelines do not run. - [Branch protection](../branches/protected.md#cicd-on-protected-branches) might prevent the account that set up mirroring from running pipelines. ## `The repository is being updated`, but neither fails nor succeeds visibly In rare cases, mirroring slots on Redis can become exhausted, possibly because Sidekiq workers are reaped due to out-of-memory (OoM) events. When this occurs, mirroring jobs start and complete quickly, but they neither fail nor succeed. They also do not leave a clear log. To check for this problem: 1. Enter the [Rails console](../../../../administration/operations/rails_console.md) and check Redis' mirroring capacity: ```ruby current = Gitlab::Redis::SharedState.with { |redis| redis.scard('MIRROR_PULL_CAPACITY') }.to_i maximum = Gitlab::CurrentSettings.mirror_max_capacity available = maximum - current ``` 1. If the mirroring capacity is `0` or very low, you can drain all stuck jobs with: ```ruby Gitlab::Redis::SharedState.with { |redis| redis.smembers('MIRROR_PULL_CAPACITY') }.each do |pid| Gitlab::Redis::SharedState.with { |redis| redis.srem('MIRROR_PULL_CAPACITY', pid) } end ``` 1. After you run the command, the [background jobs page](../../../../administration/admin_area.md#background-jobs) should show new mirroring jobs being scheduled, especially when [triggered manually](_index.md#update-a-mirror). ## Invalid URL If you receive this error while setting up mirroring over [SSH](_index.md#ssh-authentication), make sure the URL is in a valid format. Mirroring does not support SCP-like clone URLs in the form of `git@gitlab.com:gitlab-org/gitlab.git`, with host and project path separated using `:`. It requires a [standard URL](https://git-scm.com/docs/git-clone#_git_urls) that includes the `ssh://` protocol, like `ssh://git@gitlab.com/gitlab-org/gitlab.git`. ## Host key verification failed This error is returned when the target host public SSH key changes. Public SSH keys rarely change. If host key verification fails, but you suspect the key is still valid, you must delete the repository mirror and create it again. For more information, see [Create a repository mirror](_index.md#create-a-repository-mirror). ## Transfer mirror users and tokens to a single service account This requires access to the [GitLab Rails console](../../../../administration/operations/rails_console.md#starting-a-rails-console-session). Use case: If you have multiple users using their own GitHub credentials to set up repository mirroring, mirroring breaks when people leave the company. Use this script to migrate disparate mirroring users and tokens into a single service account: {{< alert type="warning" >}} Commands that change data can cause damage if not run correctly or under the right conditions. Always run commands in a test environment first and have a backup instance ready to restore. {{< /alert >}} ```ruby svc_user = User.find_by(username: 'ourServiceUser') token = 'githubAccessToken' Project.where(mirror: true).each do |project| import_url = project.import_url # The url we want is https://token@project/path.git repo_url = if import_url.include?('@') # Case 1: The url is something like https://23423432@project/path.git import_url.split('@').last elsif import_url.include?('//') # Case 2: The url is something like https://project/path.git import_url.split('//').last end next unless repo_url final_url = "https://#{token}@#{repo_url}" project.mirror_user = svc_user project.import_url = final_url project.username_only_import_url = final_url project.save end ``` ## `The requested URL returned error: 301` When mirroring using the `http://` or `https://` protocols, be sure to specify the exact URL to the repository: `https://gitlab.example.com/group/project.git` HTTP redirects are not followed and omitting `.git` can result in a 301 error: ```plaintext 13:fetch remote: "fatal: unable to access 'https://gitlab.com/group/project': The requested URL returned error: 301\n": exit status 128. ``` ## Push mirror from GitLab instance to Geo secondary fails Push mirroring of a GitLab repository using the HTTP or HTTPS protocols fails when the destination is a Geo secondary node due to the proxying of the push request to the Geo primary node, and the following error is displayed: ```plaintext 13:get remote references: create git ls-remote: exit status 128, stderr: "fatal: unable to access 'https://gitlab.example.com/group/destination.git/': The requested URL returned error: 302". ``` This occurs when a Geo unified URL is configured and the target host name resolves to the secondary node's IP address. The error can be avoided by: - Configuring the push mirror to use the SSH protocol. However, the repository must not contain any LFS objects, which are always transferred over HTTP or HTTPS and are still redirected. - Using a reverse proxy to direct all requests from the source instance to the primary Geo node. - Adding a local `hosts` file entry on the source to force the target host name to resolve to the Geo primary node's IP address. - Configuring a pull mirror on the target instead. ## Pull or push mirror fails to update: `The project is not mirrored` Pull and push mirrors fail to update when [GitLab Silent Mode](../../../../administration/silent_mode/_index.md) is enabled. When this happens, the option to allow mirroring on the UI is disabled. An administrator can check to confirm that GitLab Silent Mode is disabled. When mirroring fails due to Silent Mode the following are the debug steps: - [Triggering the mirror using the API](pull.md#trigger-pipelines-for-mirror-updates) shows: `The project is not mirrored`. - If pull or push mirror was already set up but there are no further updates on the mirrored repository, confirm the [project's pull and push mirror details ans status](../../../../api/project_pull_mirroring.md#get-a-projects-pull-mirror-details) are not recent as shown below. This indicates mirroring was paused and disabling GitLab Silent Mode restarts it automatically. For example, if Silent Mode is what is impeding your imports, the output is similar to the following: ```json "id": 1, "update_status": "finished", "url": "https://test.git" "last_error": null, "last_update_at": null, "last_update_started_at": "2023-12-12T00:01:02.222Z", "last_successful_update_at": null ``` ## Initial mirroring fails: `Unable to pull mirror repo: Unable to get pack index` You might get an error that states something similar to the following: ```plaintext 13:fetch remote: "error: Unable to open local file /var/opt/gitlab/git-data/repositories/+gitaly/tmp/quarantine-[OMITTED].idx.temp.temp\nerror: Unable to get pack index https://git.example.org/ebtables/objects/pack/pack-[OMITTED].idx\nerror: Unable to find fcde2b2edba56bf408601fb721fe9b5c338d10ee under https://git.example.org/ebtables Cannot obtain needed object fcde2b2edba56bf408601fb721fe9b5c338d10ee while processing commit 2c26b46b68ffc68ff99b453c1d30413413422d70. error: fetch failed.\n": exit status 128. ``` This issue occurs because Gitaly does not support mirroring or importing repositories over the "dumb" HTTP protocol. To determine if a server is "smart" or "dumb", use cURL to start a reference discovery for the `git-upload-pack` service and emulate a Git "smart" client: ```shell $GIT_URL="https://git.example.org/project" curl --silent --dump-header - "$GIT_URL/info/refs?service=git-upload-pack"\ -o /dev/null | grep -Ei "$content-type:" ``` - A ["smart" server](https://www.git-scm.com/docs/http-protocol#_smart_server_response) reports `application/x-git-upload-pack-advertisement` in the `Content-Type` response header. - A "dumb" server reports `text/plain` in the `Content-Type` response header. For more information, see the [Git documentation on discovering references](https://www.git-scm.com/docs/http-protocol#_discovering_references). To resolve this, you can do either of the following: - Migrate the source repository to a "smart" server. - Mirror the repository using the [SSH protocol](_index.md#ssh-authentication) (requires authentication). ## Error: `File directory conflict` You might get an error that states something similar to the following: ```plaintext 13:preparing reference update: file directory conflict ``` This error occurs when a tag or branch name conflict exists between the source and mirror repositories. For example: - A tag or branch named `x/y` exists in the mirror repository. - A tag or branch named `x` exists in the source repository. To resolve this issue, delete the conflicting tag or branch. If you cannot identify the conflicting tag or branch, delete all tags from your mirror repository. An alternative option is to [overwrite diverged branches](pull.md#overwrite-diverged-branches). {{< alert type="note" >}} Deleting tags could be destructive for any work done in the mirror repository. {{< /alert >}} To delete and remove all tags from the mirror repository: 1. On a local copy of your mirrored repository, run: ```shell git tag -l | xargs -n 1 git push --delete origin ``` 1. On the left sidebar, select **Settings > Repository**. 1. Expand **Mirroring repositories**. 1. Select **Update now** ({{< icon name="retry" >}}). ## Push mirroring stuck with large LFS files You might encounter timeout issues when push mirroring a project that contains large LFS objects. This issue occurs when Git LFS operations exceed the default activity timeout. This error appears in the mirroring logs: ```plaintext push to mirror: git push: exit status 1, stderr: "remote: GitLab: LFS objects are missing. Ensure LFS is properly set up or try a manual \"git lfs push --all\"" ``` To resolve this issue, increase the LFS activity timeout value before configuring the mirror: ```shell git config lfs.activitytimeout 240 ``` This command sets the timeout to `240` seconds. You can adjust this value based on your file sizes and network conditions.
https://docs.gitlab.com/user/project/repository/bidirectional
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/repository/bidirectional.md
2025-08-13
doc/user/project/repository/mirror
[ "doc", "user", "project", "repository", "mirror" ]
bidirectional.md
Create
Source Code
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Bidirectional mirroring
Create bidirectional mirrors to push and pull changes between two Git repositories.
{{< details >}} - Tier: Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} {{< history >}} - Moved to GitLab Premium in 13.9. {{< /history >}} {{< alert type="warning" >}} Bidirectional mirroring may cause conflicts. {{< /alert >}} Bidirectional [mirroring](_index.md) configures two repositories to both pull from, and push to, each other. There is no guarantee that either repository can update without errors. ## Reduce conflicts in bidirectional mirroring If you configure bidirectional mirroring, prepare your repositories for conflicts. Configure them to reduce conflicts, and how to settle them when they occur: - [Mirror only protected branches](_index.md#mirror-only-protected-branches). Rewriting any mirrored commit on either remote causes conflicts and mirroring to fail. - [Protect the branches](../branches/protected.md) you want to mirror on both remotes to prevent conflicts caused by rewriting history. - Reduce mirroring delay with a [push event webhook](../../integrations/webhook_events.md#push-events). Bidirectional mirroring creates a race condition where commits made close together to the same branch cause conflicts. Push event webhooks can help mitigate the race condition. Push mirroring from GitLab is rate limited to once per minute when only push mirroring protected branches. - Prevent conflicts [using a pre-receive hook](#prevent-conflicts-by-using-a-pre-receive-hook). ## Configure a webhook to trigger an immediate pull to GitLab A [push event webhook](../../integrations/webhook_events.md#push-events) in the downstream instance can help reduce race conditions by syncing changes more frequently. Prerequisites: - You have configured the [push](push.md#set-up-a-push-mirror-to-another-gitlab-instance-with-2fa-activated) and [pull](pull.md) mirrors in the upstream GitLab instance. To create the webhook in the downstream instance: 1. Create a [personal access token](../../../profile/personal_access_tokens.md) with `API` scope. 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Webhooks**. 1. Add the webhook **URL**, which (in this case) uses the [Pull Mirror API](../../../../api/project_pull_mirroring.md#start-the-pull-mirroring-process-for-a-project) request to trigger an immediate pull after a repository update: ```plaintext https://gitlab.example.com/api/v4/projects/:id/mirror/pull?private_token=<your_access_token> ``` 1. Select **Push Events**. 1. Select **Add Webhook**. To test the integration, select **Test** and confirm GitLab doesn't return an error message. ## Prevent conflicts by using a pre-receive hook {{< alert type="warning" >}} This solution negatively affects the performance of Git push operations, because they are proxied to the upstream Git repository. {{< /alert >}} In this configuration, one Git repository acts as the authoritative upstream, and the other as downstream. This server-side `pre-receive` hook accepts a push only after first pushing the commit to the upstream repository. Install this hook on your downstream repository. For example: ```shell #!/usr/bin/env bash # --- Assume only one push mirror target # Push mirroring remotes are named `remote_mirror_<id>`. # This line finds the first remote and uses that. TARGET_REPO=$(git remote | grep -m 1 remote_mirror) proxy_push() { # --- Arguments OLDREV=$(git rev-parse $1) NEWREV=$(git rev-parse $2) REFNAME="$3" # --- Pattern of branches to proxy pushes allowlist=$(expr "$branch" : "\(master\)") case "$refname" in refs/heads/*) branch=$(expr "$refname" : "refs/heads/\(.*\)") if [ "$allowlist" = "$branch" ]; then # handle https://git-scm.com/docs/git-receive-pack#_quarantine_environment unset GIT_QUARANTINE_PATH error="$(git push --quiet $TARGET_REPO $NEWREV:$REFNAME 2>&1)" fail=$? if [ "$fail" != "0" ]; then echo >&2 "" echo >&2 " Error: updates were rejected by upstream server" echo >&2 " This is usually caused by another repository pushing changes" echo >&2 " to the same ref. You may want to first integrate remote changes" echo >&2 "" return fi fi ;; esac } # Allow dual mode: run from the command line just like the update hook, or # if no arguments are given, then run as a hook script: if [ -n "$1" -a -n "$2" -a -n "$3" ]; then # Output to the terminal in command line mode. If someone wanted to # resend an email, they could redirect the output to sendmail themselves PAGER= proxy_push $2 $3 $1 else # Push is proxied upstream one ref at a time. It is possible for some refs # to succeed, and others to fail. This results in a failed push. while read oldrev newrev refname do proxy_push $oldrev $newrev $refname done fi ``` This sample has a few limitations: - It may not work for your use case without modification: - It doesn't regard different types of authentication mechanisms for the mirror. - It doesn't work with forced updates (rewriting history). - Only branches that match the `allowlist` patterns are proxy pushed. - The script circumvents the Git hook quarantine environment because the update of `$TARGET_REPO` is seen as a ref update, and Git displays warnings about it. ## Mirror with Perforce Helix with Git Fusion {{< details >}} - Tier: Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} {{< history >}} - Moved to GitLab Premium in 13.9. {{< /history >}} {{< alert type="warning" >}} Bidirectional mirroring should not be used as a permanent configuration. Refer to [Migrating from Perforce Helix](../../import/perforce.md) for alternative migration approaches. {{< /alert >}} [Git Fusion](https://www.perforce.com/manuals/git-fusion/#Git-Fusion/section_avy_hyc_gl.html) provides a Git interface to [Perforce Helix](https://www.perforce.com/products). GitLab can use the Perforce Helix interface to bidirectionally mirror projects. It can help when migrating from Perforce Helix to GitLab, if overlapping Perforce Helix workspaces cannot be migrated simultaneously. If you mirror with Perforce Helix, mirror only protected branches. Perforce Helix rejects any pushes that rewrite history. Only the fewest number of branches should be mirrored due to the performance limitations of Git Fusion. When you configure mirroring with Perforce Helix by using Git Fusion, you should use these Git Fusion settings: - Disable `change-pusher`. Otherwise, every commit is rewritten as being committed by the mirroring account, rather than mapping to existing Perforce Helix users or the `unknown_git` user. - Use the `unknown_git` user as the commit author, if the GitLab user doesn't exist in Perforce Helix. ## Related topics - [Troubleshooting](troubleshooting.md) for repository mirroring. - [Configure server hooks](../../../../administration/server_hooks.md)
--- stage: Create group: Source Code info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments description: Create bidirectional mirrors to push and pull changes between two Git repositories. title: Bidirectional mirroring breadcrumbs: - doc - user - project - repository - mirror --- {{< details >}} - Tier: Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} {{< history >}} - Moved to GitLab Premium in 13.9. {{< /history >}} {{< alert type="warning" >}} Bidirectional mirroring may cause conflicts. {{< /alert >}} Bidirectional [mirroring](_index.md) configures two repositories to both pull from, and push to, each other. There is no guarantee that either repository can update without errors. ## Reduce conflicts in bidirectional mirroring If you configure bidirectional mirroring, prepare your repositories for conflicts. Configure them to reduce conflicts, and how to settle them when they occur: - [Mirror only protected branches](_index.md#mirror-only-protected-branches). Rewriting any mirrored commit on either remote causes conflicts and mirroring to fail. - [Protect the branches](../branches/protected.md) you want to mirror on both remotes to prevent conflicts caused by rewriting history. - Reduce mirroring delay with a [push event webhook](../../integrations/webhook_events.md#push-events). Bidirectional mirroring creates a race condition where commits made close together to the same branch cause conflicts. Push event webhooks can help mitigate the race condition. Push mirroring from GitLab is rate limited to once per minute when only push mirroring protected branches. - Prevent conflicts [using a pre-receive hook](#prevent-conflicts-by-using-a-pre-receive-hook). ## Configure a webhook to trigger an immediate pull to GitLab A [push event webhook](../../integrations/webhook_events.md#push-events) in the downstream instance can help reduce race conditions by syncing changes more frequently. Prerequisites: - You have configured the [push](push.md#set-up-a-push-mirror-to-another-gitlab-instance-with-2fa-activated) and [pull](pull.md) mirrors in the upstream GitLab instance. To create the webhook in the downstream instance: 1. Create a [personal access token](../../../profile/personal_access_tokens.md) with `API` scope. 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Settings > Webhooks**. 1. Add the webhook **URL**, which (in this case) uses the [Pull Mirror API](../../../../api/project_pull_mirroring.md#start-the-pull-mirroring-process-for-a-project) request to trigger an immediate pull after a repository update: ```plaintext https://gitlab.example.com/api/v4/projects/:id/mirror/pull?private_token=<your_access_token> ``` 1. Select **Push Events**. 1. Select **Add Webhook**. To test the integration, select **Test** and confirm GitLab doesn't return an error message. ## Prevent conflicts by using a pre-receive hook {{< alert type="warning" >}} This solution negatively affects the performance of Git push operations, because they are proxied to the upstream Git repository. {{< /alert >}} In this configuration, one Git repository acts as the authoritative upstream, and the other as downstream. This server-side `pre-receive` hook accepts a push only after first pushing the commit to the upstream repository. Install this hook on your downstream repository. For example: ```shell #!/usr/bin/env bash # --- Assume only one push mirror target # Push mirroring remotes are named `remote_mirror_<id>`. # This line finds the first remote and uses that. TARGET_REPO=$(git remote | grep -m 1 remote_mirror) proxy_push() { # --- Arguments OLDREV=$(git rev-parse $1) NEWREV=$(git rev-parse $2) REFNAME="$3" # --- Pattern of branches to proxy pushes allowlist=$(expr "$branch" : "\(master\)") case "$refname" in refs/heads/*) branch=$(expr "$refname" : "refs/heads/\(.*\)") if [ "$allowlist" = "$branch" ]; then # handle https://git-scm.com/docs/git-receive-pack#_quarantine_environment unset GIT_QUARANTINE_PATH error="$(git push --quiet $TARGET_REPO $NEWREV:$REFNAME 2>&1)" fail=$? if [ "$fail" != "0" ]; then echo >&2 "" echo >&2 " Error: updates were rejected by upstream server" echo >&2 " This is usually caused by another repository pushing changes" echo >&2 " to the same ref. You may want to first integrate remote changes" echo >&2 "" return fi fi ;; esac } # Allow dual mode: run from the command line just like the update hook, or # if no arguments are given, then run as a hook script: if [ -n "$1" -a -n "$2" -a -n "$3" ]; then # Output to the terminal in command line mode. If someone wanted to # resend an email, they could redirect the output to sendmail themselves PAGER= proxy_push $2 $3 $1 else # Push is proxied upstream one ref at a time. It is possible for some refs # to succeed, and others to fail. This results in a failed push. while read oldrev newrev refname do proxy_push $oldrev $newrev $refname done fi ``` This sample has a few limitations: - It may not work for your use case without modification: - It doesn't regard different types of authentication mechanisms for the mirror. - It doesn't work with forced updates (rewriting history). - Only branches that match the `allowlist` patterns are proxy pushed. - The script circumvents the Git hook quarantine environment because the update of `$TARGET_REPO` is seen as a ref update, and Git displays warnings about it. ## Mirror with Perforce Helix with Git Fusion {{< details >}} - Tier: Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} {{< history >}} - Moved to GitLab Premium in 13.9. {{< /history >}} {{< alert type="warning" >}} Bidirectional mirroring should not be used as a permanent configuration. Refer to [Migrating from Perforce Helix](../../import/perforce.md) for alternative migration approaches. {{< /alert >}} [Git Fusion](https://www.perforce.com/manuals/git-fusion/#Git-Fusion/section_avy_hyc_gl.html) provides a Git interface to [Perforce Helix](https://www.perforce.com/products). GitLab can use the Perforce Helix interface to bidirectionally mirror projects. It can help when migrating from Perforce Helix to GitLab, if overlapping Perforce Helix workspaces cannot be migrated simultaneously. If you mirror with Perforce Helix, mirror only protected branches. Perforce Helix rejects any pushes that rewrite history. Only the fewest number of branches should be mirrored due to the performance limitations of Git Fusion. When you configure mirroring with Perforce Helix by using Git Fusion, you should use these Git Fusion settings: - Disable `change-pusher`. Otherwise, every commit is rewritten as being committed by the mirroring account, rather than mapping to existing Perforce Helix users or the `unknown_git` user. - Use the `unknown_git` user as the commit author, if the GitLab user doesn't exist in Perforce Helix. ## Related topics - [Troubleshooting](troubleshooting.md) for repository mirroring. - [Configure server hooks](../../../../administration/server_hooks.md)
https://docs.gitlab.com/user/project/repository/repository_xray
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/repository/repository_xray.md
2025-08-13
doc/user/project/repository/code_suggestions
[ "doc", "user", "project", "repository", "code_suggestions" ]
repository_xray.md
Create
Code Creation
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Repository X-Ray
Repository X-Ray gives Code Suggestions more insight into your project's codebase and dependencies.
{{< details >}} - Tier: Premium, Ultimate - Add-on: GitLab Duo Pro or Enterprise - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} {{< history >}} - [Introduced](https://gitlab.com/groups/gitlab-org/-/epics/12060) in GitLab 16.7. - Changed to require GitLab Duo add-on in GitLab 17.6 and later. {{< /history >}} Repository X-Ray automatically enriches: - Code generation requests for [GitLab Duo Code Suggestions](_index.md) by providing additional context about a project's dependencies to improve the accuracy and relevance of code recommendations. - Requests to [refactor code](../../../gitlab_duo_chat/examples.md#refactor-code-in-the-ide), [fix code](../../../gitlab_duo_chat/examples.md#fix-code-in-the-ide), and [write tests](../../../gitlab_duo_chat/examples.md#write-tests-in-the-ide). To do this, Repository X-Ray gives the code assistant more insight into the project's codebase and dependencies by: - Searching for dependency manager configuration files (for example, `Gemfile.lock`, `package.json`, `go.mod`). - Extracting a list of libraries from their content. - Providing the extracted list as additional context to be used by GitLab Duo Code Suggestions in code generation, refactor code, fix code, and write test requests. By understanding the libraries and other dependencies in use, Repository X-Ray helps the code assistant tailor suggestions to match the coding patterns, styles, and technologies used in the project. This results in code suggestions that integrate more seamlessly and follow best practices for the given stack. {{< alert type="note" >}} Repository X-Ray only enhances code generation requests and not code completion requests. {{< /alert >}} ## How Repository X-Ray works {{< history >}} - Maximum number of libraries [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/500365) in GitLab 17.6. {{< /history >}} When you push a new commit to your project's default branch, Repository X-Ray triggers a background job. This job scans and parses the applicable configuration files in your repository. Typically, only one scanning job runs at a time in each project. If a second scan is triggered while a scan is already in progress, that second scan waits until the first scan is complete before executing. This could result in a small delay before the latest configuration file data is parsed and updated in the database. When a code generation request is made, a maximum of 300 libraries from the parsed data is included in the prompt as additional context. ## Enable Repository X-Ray {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/476180) in GitLab 17.4 [with a flag](../../../feature_flags.md) named `ai_enable_internal_repository_xray_service`. Disabled by default. - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/issues/483928) in GitLab 17.6. Feature flag `ai_enable_internal_repository_xray_service` removed. {{< /history >}} The Repository X-Ray service is automatically enabled if your project has access to [GitLab Duo Code Suggestions](_index.md). ## Supported languages and dependency managers The Repository X-Ray searches a maximum of two directory levels from the repository's root. For example, it supports `Gemfile.lock`, `api/Gemfile.lock`, or `api/client/Gemfile.lock`, but not `api/v1/client/Gemfile.lock`. For each language, only the first matching dependency manager is processed. Where available, lock files take precedence over their non-lock file counterparts. | Language | Dependency manager | Configuration file | GitLab version | | ---------- |--------------------| ----------------------------------- | -------------- | | C/C++ | Conan | `conanfile.py` | 17.5 or later | | C/C++ | Conan | `conanfile.txt` | 17.5 or later | | C/C++ | vcpkg | `vcpkg.json` | 17.5 or later | | C# | NuGet | `*.csproj` | 17.5 or later | | Go | Go Modules | `go.mod` | 17.4 or later | | Java | Gradle | `build.gradle` | 17.4 or later | | Java | Maven | `pom.xml` | 17.4 or later | | JavaScript | NPM | `package-lock.json`, `package.json` | 17.5 or later | | Kotlin | Gradle | `build.gradle.kts` | 17.5 or later | | PHP | Composer | `composer.lock`, `composer.json` | 17.5 or later | | Python | Conda | `environment.yml` | 17.5 or later | | Python | Pip | `*requirements*.txt` <sup>1</sup> | 17.5 or later | | Python | Poetry | `poetry.lock`, `pyproject.toml` | 17.5 or later | | Ruby | RubyGems | `Gemfile.lock` | 17.4 or later | Footnotes: 1. For Python Pip, all configuration files matching the `*requirements*.txt` glob pattern are processed. <!--- start_remove The following content will be removed on remove_date: '2025-08-15' --> ## Enable Repository X-Ray in your CI pipeline (deprecated) {{< alert type="warning" >}} This feature was [deprecated](https://gitlab.com/gitlab-org/gitlab/-/issues/500146) in GitLab 17.6 and is planned for removal in 18.0. Use [Enable Repository X-Ray](#enable-repository-x-ray) instead. {{< /alert >}} Prerequisites: - You must have access to [GitLab Duo Code Suggestions](_index.md) in the project. - GitLab Runner must be set up and enabled for the project, because Repository X-Ray runs analysis pipelines using GitLab runners. To enable Repository X-Ray, add the following definition job to the project's `.gitlab-ci.yml`. ```yaml xray: stage: build image: registry.gitlab.com/gitlab-org/code-creation/repository-x-ray:latest allow_failure: true rules: - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH variables: OUTPUT_DIR: reports script: - x-ray-scan -p "$CI_PROJECT_DIR" -o "$OUTPUT_DIR" artifacts: reports: repository_xray: "$OUTPUT_DIR/*/*.json" ``` - The `$OUTPUT_DIR` environment variable defines the: - Output directory for reports. - Path that artifacts are uploaded from. - The added rules restrict the job to the default branch only. Restricting the job this way ensures development changes do not impact the baseline X-Ray data used for production Code Suggestions. After the initial x-ray job completes and uploads the repository analysis reports, no further action is required. Repository X-Ray automatically enriches all code generation requests from that point forward. The X-Ray data for your project updates each time a CI/CD pipeline containing the `xray` job is run. To learn more about pipeline configuration and triggers, see the [pipelines documentation](../../../../ci/pipelines/merge_request_pipelines.md). ### Supported languages and package managers | Language | Package Manager | Configuration File | | ---------- |-----------------| -------------------- | | Go | Go Modules | `go.mod` | | JavaScript | NPM, Yarn | `package.json` | | Ruby | RubyGems | `Gemfile.lock` | | Python | Poetry | `pyproject.toml` | | Python | Pip | `requirements.txt` | | Python | Conda | `environment.yml` | | PHP | Composer | `composer.json` | | Java | Maven | `pom.xml` | | Java | Gradle | `build.gradle` | | Kotlin | Gradle | `build.gradle.kts` | | C# | NuGet | `*.csproj` | | C/C++ | Conan | `conanfile.txt` | | C/C++ | Conan | `conanfile.py` | | C/C++ | vcpkg | `vcpkg.json` | ### Troubleshooting #### `401: Unauthorized` when running Repository X-Ray When running Repository X-Ray, you might get an error that states `401: Unauthorized`. A GitLab Duo Pro add-on is linked to a group when you buy that add-on. To solve the error, ensure that your current project is part of a group with the GitLab Duo Pro add-on. This link can be either of the following: - Direct, that is, the project is in a group that has the GitLab Duo Pro add-on. - Indirect, for example, the parent group of the current project's group has the GitLab Duo Pro add-on. <!--- end_remove -->
--- stage: Create group: Code Creation info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments description: Repository X-Ray gives Code Suggestions more insight into your project's codebase and dependencies. title: Repository X-Ray breadcrumbs: - doc - user - project - repository - code_suggestions --- {{< details >}} - Tier: Premium, Ultimate - Add-on: GitLab Duo Pro or Enterprise - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} {{< history >}} - [Introduced](https://gitlab.com/groups/gitlab-org/-/epics/12060) in GitLab 16.7. - Changed to require GitLab Duo add-on in GitLab 17.6 and later. {{< /history >}} Repository X-Ray automatically enriches: - Code generation requests for [GitLab Duo Code Suggestions](_index.md) by providing additional context about a project's dependencies to improve the accuracy and relevance of code recommendations. - Requests to [refactor code](../../../gitlab_duo_chat/examples.md#refactor-code-in-the-ide), [fix code](../../../gitlab_duo_chat/examples.md#fix-code-in-the-ide), and [write tests](../../../gitlab_duo_chat/examples.md#write-tests-in-the-ide). To do this, Repository X-Ray gives the code assistant more insight into the project's codebase and dependencies by: - Searching for dependency manager configuration files (for example, `Gemfile.lock`, `package.json`, `go.mod`). - Extracting a list of libraries from their content. - Providing the extracted list as additional context to be used by GitLab Duo Code Suggestions in code generation, refactor code, fix code, and write test requests. By understanding the libraries and other dependencies in use, Repository X-Ray helps the code assistant tailor suggestions to match the coding patterns, styles, and technologies used in the project. This results in code suggestions that integrate more seamlessly and follow best practices for the given stack. {{< alert type="note" >}} Repository X-Ray only enhances code generation requests and not code completion requests. {{< /alert >}} ## How Repository X-Ray works {{< history >}} - Maximum number of libraries [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/500365) in GitLab 17.6. {{< /history >}} When you push a new commit to your project's default branch, Repository X-Ray triggers a background job. This job scans and parses the applicable configuration files in your repository. Typically, only one scanning job runs at a time in each project. If a second scan is triggered while a scan is already in progress, that second scan waits until the first scan is complete before executing. This could result in a small delay before the latest configuration file data is parsed and updated in the database. When a code generation request is made, a maximum of 300 libraries from the parsed data is included in the prompt as additional context. ## Enable Repository X-Ray {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/476180) in GitLab 17.4 [with a flag](../../../feature_flags.md) named `ai_enable_internal_repository_xray_service`. Disabled by default. - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/issues/483928) in GitLab 17.6. Feature flag `ai_enable_internal_repository_xray_service` removed. {{< /history >}} The Repository X-Ray service is automatically enabled if your project has access to [GitLab Duo Code Suggestions](_index.md). ## Supported languages and dependency managers The Repository X-Ray searches a maximum of two directory levels from the repository's root. For example, it supports `Gemfile.lock`, `api/Gemfile.lock`, or `api/client/Gemfile.lock`, but not `api/v1/client/Gemfile.lock`. For each language, only the first matching dependency manager is processed. Where available, lock files take precedence over their non-lock file counterparts. | Language | Dependency manager | Configuration file | GitLab version | | ---------- |--------------------| ----------------------------------- | -------------- | | C/C++ | Conan | `conanfile.py` | 17.5 or later | | C/C++ | Conan | `conanfile.txt` | 17.5 or later | | C/C++ | vcpkg | `vcpkg.json` | 17.5 or later | | C# | NuGet | `*.csproj` | 17.5 or later | | Go | Go Modules | `go.mod` | 17.4 or later | | Java | Gradle | `build.gradle` | 17.4 or later | | Java | Maven | `pom.xml` | 17.4 or later | | JavaScript | NPM | `package-lock.json`, `package.json` | 17.5 or later | | Kotlin | Gradle | `build.gradle.kts` | 17.5 or later | | PHP | Composer | `composer.lock`, `composer.json` | 17.5 or later | | Python | Conda | `environment.yml` | 17.5 or later | | Python | Pip | `*requirements*.txt` <sup>1</sup> | 17.5 or later | | Python | Poetry | `poetry.lock`, `pyproject.toml` | 17.5 or later | | Ruby | RubyGems | `Gemfile.lock` | 17.4 or later | Footnotes: 1. For Python Pip, all configuration files matching the `*requirements*.txt` glob pattern are processed. <!--- start_remove The following content will be removed on remove_date: '2025-08-15' --> ## Enable Repository X-Ray in your CI pipeline (deprecated) {{< alert type="warning" >}} This feature was [deprecated](https://gitlab.com/gitlab-org/gitlab/-/issues/500146) in GitLab 17.6 and is planned for removal in 18.0. Use [Enable Repository X-Ray](#enable-repository-x-ray) instead. {{< /alert >}} Prerequisites: - You must have access to [GitLab Duo Code Suggestions](_index.md) in the project. - GitLab Runner must be set up and enabled for the project, because Repository X-Ray runs analysis pipelines using GitLab runners. To enable Repository X-Ray, add the following definition job to the project's `.gitlab-ci.yml`. ```yaml xray: stage: build image: registry.gitlab.com/gitlab-org/code-creation/repository-x-ray:latest allow_failure: true rules: - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH variables: OUTPUT_DIR: reports script: - x-ray-scan -p "$CI_PROJECT_DIR" -o "$OUTPUT_DIR" artifacts: reports: repository_xray: "$OUTPUT_DIR/*/*.json" ``` - The `$OUTPUT_DIR` environment variable defines the: - Output directory for reports. - Path that artifacts are uploaded from. - The added rules restrict the job to the default branch only. Restricting the job this way ensures development changes do not impact the baseline X-Ray data used for production Code Suggestions. After the initial x-ray job completes and uploads the repository analysis reports, no further action is required. Repository X-Ray automatically enriches all code generation requests from that point forward. The X-Ray data for your project updates each time a CI/CD pipeline containing the `xray` job is run. To learn more about pipeline configuration and triggers, see the [pipelines documentation](../../../../ci/pipelines/merge_request_pipelines.md). ### Supported languages and package managers | Language | Package Manager | Configuration File | | ---------- |-----------------| -------------------- | | Go | Go Modules | `go.mod` | | JavaScript | NPM, Yarn | `package.json` | | Ruby | RubyGems | `Gemfile.lock` | | Python | Poetry | `pyproject.toml` | | Python | Pip | `requirements.txt` | | Python | Conda | `environment.yml` | | PHP | Composer | `composer.json` | | Java | Maven | `pom.xml` | | Java | Gradle | `build.gradle` | | Kotlin | Gradle | `build.gradle.kts` | | C# | NuGet | `*.csproj` | | C/C++ | Conan | `conanfile.txt` | | C/C++ | Conan | `conanfile.py` | | C/C++ | vcpkg | `vcpkg.json` | ### Troubleshooting #### `401: Unauthorized` when running Repository X-Ray When running Repository X-Ray, you might get an error that states `401: Unauthorized`. A GitLab Duo Pro add-on is linked to a group when you buy that add-on. To solve the error, ensure that your current project is part of a group with the GitLab Duo Pro add-on. This link can be either of the following: - Direct, that is, the project is in a group that has the GitLab Duo Pro add-on. - Indirect, for example, the parent group of the current project's group has the GitLab Duo Pro add-on. <!--- end_remove -->
https://docs.gitlab.com/user/project/repository/set_up
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/repository/set_up.md
2025-08-13
doc/user/project/repository/code_suggestions
[ "doc", "user", "project", "repository", "code_suggestions" ]
set_up.md
Create
Code Creation
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Set up Code Suggestions
Set up Code Suggestions.
{{< history >}} - Changed to include GitLab Duo Core in GitLab 18.0. {{< /history >}} You can use Code Suggestions in several different IDEs. To set up Code Suggestions, follow the instructions for your IDE. ## Prerequisites To use Code Suggestions, you need: - A GitLab Duo Core, Pro, or Enterprise add-on. - A Premium or Ultimate subscription. - If you have GitLab Duo Pro or Enterprise, an assigned seat. - If you have GitLab Duo Core, [IDE features turned on](../../../gitlab_duo/turn_on_off.md#turn-gitlab-duo-core-on-or-off). - To confirm that Code Suggestions [supports your preferred language](supported_extensions.md#supported-languages-by-ide). Different IDEs support different languages. ## Configure editor extension Code Suggestions is part of an editor extension. To use Code Suggestions: 1. Install the extension in your IDE. 1. Authenticate with GitLab from the IDE. You can use either OAuth or a personal access token. 1. Configure the extension. Follow these steps for your IDE: - [Visual Studio Code](../../../../editor_extensions/visual_studio_code/setup.md) - [Visual Studio](../../../../editor_extensions/visual_studio/setup.md) - [GitLab Duo plugin for JetBrains IDEs](../../../../editor_extensions/jetbrains_ide/setup.md) - [`gitlab.vim` plugin for Neovim](../../../../editor_extensions/neovim/setup.md) - [GitLab for Eclipse](../../../../editor_extensions/eclipse/setup.md) ## Turn on Code Suggestions Code Suggestions is turned on [if you meet the prerequisites](#prerequisites). To confirm, open your IDE and verify if Code Suggestions works. ### VS Code To verify that Code Suggestions is turned on in VS Code: 1. In VS Code, go to **Settings > Extensions > GitLab Workflow**. 1. Select **Manage** ({{< icon name="settings" >}}). 1. Ensure that **GitLab › Duo Code Suggestions: Enabled** is selected. 1. Optional. For **GitLab › Duo Code Suggestions: Enabled Supported Languages**, select the languages you want to suggest or generate code for. 1. Optional. For **GitLab › Duo Code Suggestions: Additional Languages**, add other languages you'd like to use. ### Visual Studio To verify that Code Suggestions is turned on in Visual Studio: 1. In Visual Studio, on the bottom status bar, point to the GitLab icon. 1. When Code Suggestions is enabled, the icon tooltip shows `GitLab code suggestions are enabled.` 1. If Code Suggestions are not enabled, on the top bar select **Extensions > GitLab > Toggle Code Suggestions** to enable it. ### JetBrains IDEs To verify that Code Suggestions is turned on in JetBrains IDEs: 1. In your IDE, on the top bar, select your IDE's name, then select **Settings**. 1. On the left sidebar, expand **Tools**, then select **GitLab Duo**. 1. In the **Features** section, ensure that **Enable Code Suggestions** and **Enable GitLab Duo Chat** are selected. 1. Select **OK** or **Save**. #### Add a custom certificate for Code Suggestions {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/editor-extensions/gitlab-jetbrains-plugin/-/issues/561) in GitLab Duo 2.10.0. {{< /history >}} GitLab Duo attempts to detect [trusted root certificates](https://www.jetbrains.com/help/idea/ssl-certificates.html) without configuration on your part. If needed, configure your JetBrains IDE to allow the GitLab Duo plugin to use a custom SSL certificate when connecting to your GitLab instance. To use a custom SSL certificate with GitLab Duo: 1. In your IDE, on the top bar, select your IDE name, then select **Settings**. 1. On the left sidebar, expand **Tools**, then select **GitLab Duo**. 1. Under **Connection**, enter the **URL to GitLab instance**. 1. To verify your connection, select **Verify setup**. 1. Select **OK** or **Save**. If your IDE detects a non-trusted SSL certificate: 1. The GitLab Duo plugin displays a confirmation dialog. 1. Review the SSL certificate details shown. - Confirm the certificate details match the certificate shown when you connect to GitLab in your browser. 1. If the certificate matches your expectations, select **Accept**. To review certificates you've already accepted: 1. In your IDE, on the top bar, select your IDE name, then select **Settings**. 1. On the left sidebar, select **Tools > Server Certificates**. 1. Select [**Server Certificates**](https://www.jetbrains.com/help/idea/settings-tools-server-certificates.html). 1. Select a certificate to view it. ### Eclipse {{< alert type="note" >}} To enable GitLab Duo Code Suggestions, open an Eclipse project. If you open a single file, Code Suggestions is disabled for all file types. {{< /alert >}} To verify that Code Suggestions is turned on in Eclipse: 1. In Eclipse, open your GitLab project. 1. In the Eclipse bottom toolbar, select the GitLab icon. **Code Suggestions** displays as "Enabled". ### Neovim Code Suggestions provides a LSP (Language Server Protocol) server, to support the built-in <kbd>Control</kbd>+<kbd>x</kbd>, <kbd>Control</kbd>+<kbd>o</kbd> Omni Completion key mapping: | Mode | Key mappings | Type | Description | |----------|---------------------------------------|-----------|-------------| | `INSERT` | <kbd>Control</kbd>+<kbd>x</kbd>, <kbd>Control</kbd>+<kbd>o</kbd> | Built-in | Requests completions from GitLab Duo Code Suggestions through the language server. | | `NORMAL` | `<Plug>(GitLabToggleCodeSuggestions)` | `<Plug>` | Toggles Code Suggestions on or off for the current buffer. Requires [configuration](../../../../editor_extensions/neovim/setup.md#configure-plug-key-mappings). | ## Verify that Code Suggestions is on All editor extensions from GitLab, except Neovim, add an icon to your IDE's status bar. For example, in Visual Studio: ![The status bar in Visual Studio.](img/visual_studio_status_bar_v17_4.png) | Icon | Status | Meaning | | :--- | :----- | :------ | | {{< icon name="tanuki-ai" >}} | **Ready** | You've configured and enabled GitLab Duo, and you're using a language that supports Code Suggestions. | | {{< icon name="tanuki-ai-off" >}} | **Not configured** | You haven't entered a personal access token, or you're using a language that Code Suggestions doesn't support. | | ![The status icon for fetching Code Suggestions.](img/code_suggestions_loading_v17_4.svg) | **Loading suggestion** | GitLab Duo is fetching Code Suggestions for you. | | ![The status icon for a Code Suggestions error.](img/code_suggestions_error_v17_4.svg) | **Error** | GitLab Duo has encountered an error. | ## Turn off Code Suggestions The process for turning off Code Suggestions is different for each IDE. {{< alert type="note" >}} You cannot turn off code generation and code completion separately. {{< /alert >}} ### VS Code To turn off Code Suggestions in VS Code: 1. Go to **Code > Settings > Extensions**. 1. Select **Manage** ({{< icon name="settings" >}}) **> Settings**. 1. Clear the **GitLab Duo Code Suggestions** checkbox. Instead, you can [set `gitlab.duoCodeSuggestions.enabled` to `false` in the VS Code `settings.json` file](../../../../editor_extensions/visual_studio_code/settings.md#extension-settings). ### Visual Studio To turn Code Suggestions on or off without uninstalling the extension, [assign a keyboard shortcut to the `GitLab.ToggleCodeSuggestions` custom command](../../../../editor_extensions/visual_studio/setup.md#configure-the-extension). To disable or uninstall the extension, see the [Microsoft Visual Studio documentation on uninstalling or disabling the extension](https://learn.microsoft.com/en-us/visualstudio/ide/finding-and-using-visual-studio-extensions?view=vs-2022#uninstall-or-disable-an-extension). ### JetBrains IDEs The process to disable GitLab Duo, including Code Suggestions, is the same regardless of which JetBrains IDE you use. 1. In your JetBrains IDE, go to settings and select the plugins menu. 1. Under the installed plugins, find the GitLab Duo plugin. 1. Disable the plugin. For more information, see the [JetBrains product documentation](https://www.jetbrains.com/help/). ### Eclipse To disable Eclipse Code Suggestions for a project: 1. In the Eclipse bottom toolbar, select the GitLab icon. 1. Select **Disable Code Suggestions** to disable Code Suggestions for the current project. To disable Eclipse Code Suggestions for a specific language: 1. In the Eclipse bottom toolbar, select the GitLab icon. 1. Select **Show Settings**. 1. Scroll down to the **Code Suggestions Enabled Languages** section and clear the checkbox for the language you wish to disable. ### Neovim 1. Go to the [Neovim `defaults.lua` settings file](https://gitlab.com/gitlab-org/editor-extensions/gitlab.vim/-/blob/main/lua/gitlab/config/defaults.lua). 1. Under `code_suggestions`, change the `enabled =` flag to `false`: ```lua code_suggestions = { ... enabled = false, ``` ### Turn off GitLab Duo Alternatively, you can [turn off GitLab Duo](../../../gitlab_duo/turn_on_off.md) (which includes Code Suggestions) completely for a group, project, or instance.
--- stage: Create group: Code Creation info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments description: Set up Code Suggestions. title: Set up Code Suggestions breadcrumbs: - doc - user - project - repository - code_suggestions --- {{< history >}} - Changed to include GitLab Duo Core in GitLab 18.0. {{< /history >}} You can use Code Suggestions in several different IDEs. To set up Code Suggestions, follow the instructions for your IDE. ## Prerequisites To use Code Suggestions, you need: - A GitLab Duo Core, Pro, or Enterprise add-on. - A Premium or Ultimate subscription. - If you have GitLab Duo Pro or Enterprise, an assigned seat. - If you have GitLab Duo Core, [IDE features turned on](../../../gitlab_duo/turn_on_off.md#turn-gitlab-duo-core-on-or-off). - To confirm that Code Suggestions [supports your preferred language](supported_extensions.md#supported-languages-by-ide). Different IDEs support different languages. ## Configure editor extension Code Suggestions is part of an editor extension. To use Code Suggestions: 1. Install the extension in your IDE. 1. Authenticate with GitLab from the IDE. You can use either OAuth or a personal access token. 1. Configure the extension. Follow these steps for your IDE: - [Visual Studio Code](../../../../editor_extensions/visual_studio_code/setup.md) - [Visual Studio](../../../../editor_extensions/visual_studio/setup.md) - [GitLab Duo plugin for JetBrains IDEs](../../../../editor_extensions/jetbrains_ide/setup.md) - [`gitlab.vim` plugin for Neovim](../../../../editor_extensions/neovim/setup.md) - [GitLab for Eclipse](../../../../editor_extensions/eclipse/setup.md) ## Turn on Code Suggestions Code Suggestions is turned on [if you meet the prerequisites](#prerequisites). To confirm, open your IDE and verify if Code Suggestions works. ### VS Code To verify that Code Suggestions is turned on in VS Code: 1. In VS Code, go to **Settings > Extensions > GitLab Workflow**. 1. Select **Manage** ({{< icon name="settings" >}}). 1. Ensure that **GitLab › Duo Code Suggestions: Enabled** is selected. 1. Optional. For **GitLab › Duo Code Suggestions: Enabled Supported Languages**, select the languages you want to suggest or generate code for. 1. Optional. For **GitLab › Duo Code Suggestions: Additional Languages**, add other languages you'd like to use. ### Visual Studio To verify that Code Suggestions is turned on in Visual Studio: 1. In Visual Studio, on the bottom status bar, point to the GitLab icon. 1. When Code Suggestions is enabled, the icon tooltip shows `GitLab code suggestions are enabled.` 1. If Code Suggestions are not enabled, on the top bar select **Extensions > GitLab > Toggle Code Suggestions** to enable it. ### JetBrains IDEs To verify that Code Suggestions is turned on in JetBrains IDEs: 1. In your IDE, on the top bar, select your IDE's name, then select **Settings**. 1. On the left sidebar, expand **Tools**, then select **GitLab Duo**. 1. In the **Features** section, ensure that **Enable Code Suggestions** and **Enable GitLab Duo Chat** are selected. 1. Select **OK** or **Save**. #### Add a custom certificate for Code Suggestions {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/editor-extensions/gitlab-jetbrains-plugin/-/issues/561) in GitLab Duo 2.10.0. {{< /history >}} GitLab Duo attempts to detect [trusted root certificates](https://www.jetbrains.com/help/idea/ssl-certificates.html) without configuration on your part. If needed, configure your JetBrains IDE to allow the GitLab Duo plugin to use a custom SSL certificate when connecting to your GitLab instance. To use a custom SSL certificate with GitLab Duo: 1. In your IDE, on the top bar, select your IDE name, then select **Settings**. 1. On the left sidebar, expand **Tools**, then select **GitLab Duo**. 1. Under **Connection**, enter the **URL to GitLab instance**. 1. To verify your connection, select **Verify setup**. 1. Select **OK** or **Save**. If your IDE detects a non-trusted SSL certificate: 1. The GitLab Duo plugin displays a confirmation dialog. 1. Review the SSL certificate details shown. - Confirm the certificate details match the certificate shown when you connect to GitLab in your browser. 1. If the certificate matches your expectations, select **Accept**. To review certificates you've already accepted: 1. In your IDE, on the top bar, select your IDE name, then select **Settings**. 1. On the left sidebar, select **Tools > Server Certificates**. 1. Select [**Server Certificates**](https://www.jetbrains.com/help/idea/settings-tools-server-certificates.html). 1. Select a certificate to view it. ### Eclipse {{< alert type="note" >}} To enable GitLab Duo Code Suggestions, open an Eclipse project. If you open a single file, Code Suggestions is disabled for all file types. {{< /alert >}} To verify that Code Suggestions is turned on in Eclipse: 1. In Eclipse, open your GitLab project. 1. In the Eclipse bottom toolbar, select the GitLab icon. **Code Suggestions** displays as "Enabled". ### Neovim Code Suggestions provides a LSP (Language Server Protocol) server, to support the built-in <kbd>Control</kbd>+<kbd>x</kbd>, <kbd>Control</kbd>+<kbd>o</kbd> Omni Completion key mapping: | Mode | Key mappings | Type | Description | |----------|---------------------------------------|-----------|-------------| | `INSERT` | <kbd>Control</kbd>+<kbd>x</kbd>, <kbd>Control</kbd>+<kbd>o</kbd> | Built-in | Requests completions from GitLab Duo Code Suggestions through the language server. | | `NORMAL` | `<Plug>(GitLabToggleCodeSuggestions)` | `<Plug>` | Toggles Code Suggestions on or off for the current buffer. Requires [configuration](../../../../editor_extensions/neovim/setup.md#configure-plug-key-mappings). | ## Verify that Code Suggestions is on All editor extensions from GitLab, except Neovim, add an icon to your IDE's status bar. For example, in Visual Studio: ![The status bar in Visual Studio.](img/visual_studio_status_bar_v17_4.png) | Icon | Status | Meaning | | :--- | :----- | :------ | | {{< icon name="tanuki-ai" >}} | **Ready** | You've configured and enabled GitLab Duo, and you're using a language that supports Code Suggestions. | | {{< icon name="tanuki-ai-off" >}} | **Not configured** | You haven't entered a personal access token, or you're using a language that Code Suggestions doesn't support. | | ![The status icon for fetching Code Suggestions.](img/code_suggestions_loading_v17_4.svg) | **Loading suggestion** | GitLab Duo is fetching Code Suggestions for you. | | ![The status icon for a Code Suggestions error.](img/code_suggestions_error_v17_4.svg) | **Error** | GitLab Duo has encountered an error. | ## Turn off Code Suggestions The process for turning off Code Suggestions is different for each IDE. {{< alert type="note" >}} You cannot turn off code generation and code completion separately. {{< /alert >}} ### VS Code To turn off Code Suggestions in VS Code: 1. Go to **Code > Settings > Extensions**. 1. Select **Manage** ({{< icon name="settings" >}}) **> Settings**. 1. Clear the **GitLab Duo Code Suggestions** checkbox. Instead, you can [set `gitlab.duoCodeSuggestions.enabled` to `false` in the VS Code `settings.json` file](../../../../editor_extensions/visual_studio_code/settings.md#extension-settings). ### Visual Studio To turn Code Suggestions on or off without uninstalling the extension, [assign a keyboard shortcut to the `GitLab.ToggleCodeSuggestions` custom command](../../../../editor_extensions/visual_studio/setup.md#configure-the-extension). To disable or uninstall the extension, see the [Microsoft Visual Studio documentation on uninstalling or disabling the extension](https://learn.microsoft.com/en-us/visualstudio/ide/finding-and-using-visual-studio-extensions?view=vs-2022#uninstall-or-disable-an-extension). ### JetBrains IDEs The process to disable GitLab Duo, including Code Suggestions, is the same regardless of which JetBrains IDE you use. 1. In your JetBrains IDE, go to settings and select the plugins menu. 1. Under the installed plugins, find the GitLab Duo plugin. 1. Disable the plugin. For more information, see the [JetBrains product documentation](https://www.jetbrains.com/help/). ### Eclipse To disable Eclipse Code Suggestions for a project: 1. In the Eclipse bottom toolbar, select the GitLab icon. 1. Select **Disable Code Suggestions** to disable Code Suggestions for the current project. To disable Eclipse Code Suggestions for a specific language: 1. In the Eclipse bottom toolbar, select the GitLab icon. 1. Select **Show Settings**. 1. Scroll down to the **Code Suggestions Enabled Languages** section and clear the checkbox for the language you wish to disable. ### Neovim 1. Go to the [Neovim `defaults.lua` settings file](https://gitlab.com/gitlab-org/editor-extensions/gitlab.vim/-/blob/main/lua/gitlab/config/defaults.lua). 1. Under `code_suggestions`, change the `enabled =` flag to `false`: ```lua code_suggestions = { ... enabled = false, ``` ### Turn off GitLab Duo Alternatively, you can [turn off GitLab Duo](../../../gitlab_duo/turn_on_off.md) (which includes Code Suggestions) completely for a group, project, or instance.
https://docs.gitlab.com/user/project/repository/code_suggestions
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/repository/_index.md
2025-08-13
doc/user/project/repository/code_suggestions
[ "doc", "user", "project", "repository", "code_suggestions" ]
_index.md
Create
Code Creation
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Code Suggestions
Code Suggestions helps you write code in GitLab more efficiently by using AI to suggest code as you type.
{{< details >}} - Tier: Premium, Ultimate - Add-on: GitLab Duo Core, Pro, or Enterprise, GitLab Duo with Amazon Q - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated - LLMs for code completion: Fireworks AI-hosted [`Codestral`](https://mistral.ai/news/codestral-2501) (default) and Vertex AI-hosted [`Codestral`](https://console.cloud.google.com/vertex-ai/publishers/mistralai/model-garden/codestral-2501). - LLM for code generation: Anthropic [Claude Sonnet 4](https://console.cloud.google.com/vertex-ai/publishers/anthropic/model-garden/claude-sonnet-4). - LLM For Amazon Q: Amazon Q Developer - Available on [GitLab Duo with self-hosted models](../../../../administration/gitlab_duo_self_hosted/_index.md): Yes {{< /details >}} {{< history >}} - [Introduced support for Google Vertex AI Codey APIs](https://gitlab.com/groups/gitlab-org/-/epics/10562) in GitLab 16.1. - [Removed support for GitLab native model](https://gitlab.com/groups/gitlab-org/-/epics/10752) in GitLab 16.2. - [Introduced support for Code Generation](https://gitlab.com/gitlab-org/gitlab/-/issues/415583) in GitLab 16.3. - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/issues/435271) in GitLab 16.7. - [Changed](https://gitlab.com/gitlab-org/fulfillment/meta/-/issues/2031) to require the GitLab Duo Pro add-on on February 15, 2024. Previously, this feature was included with Premium and Ultimate subscriptions. - [Changed](https://gitlab.com/gitlab-org/fulfillment/meta/-/issues/2031) to require the GitLab Duo Pro or GitLab Duo Enterprise add-on for all supported GitLab versions starting October 17, 2024. - [Introduced support for Fireworks AI-hosted Qwen2.5 code completion model](https://gitlab.com/groups/gitlab-org/-/epics/15850) in GitLab 17.6, with a flag named `fireworks_qwen_code_completion`. - [Removed](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/187397) support for Qwen2.5 code completion model in GitLab 17.11. - Enabled Fireworks hosted `Codestral` by default via the feature flag `use_fireworks_codestral_code_completion` in GitLab 17.11. - Changed to include GitLab Duo Core in GitLab 18.0. - Enabled Fireworks hosted `Codestral` as the default model in GitLab 18.1. - To opt out of Fireworks for a group, the feature flag `code_completion_opt_out_fireworks` is available. - [Changed](https://gitlab.com/gitlab-org/gitlab/-/issues/545489) the default model for Code Generation to Claude Sonnet 4 in GitLab 18.2. {{< /history >}} Use GitLab Duo Code Suggestions to write code more efficiently by using generative AI to suggest code while you're developing. - <i class="fa fa-youtube-play youtube" aria-hidden="true"></i> [View a click-through demo](https://gitlab.navattic.com/code-suggestions). <!-- Video published on 2023-12-09 --> <!-- Demo published on 2024-02-01 --> - <i class="fa fa-youtube-play youtube" aria-hidden="true"></i> [Watch an overview](https://youtu.be/ds7SG1wgcVM) ## Prerequisites To use Code Suggestions, you need: - A GitLab Duo Core, Pro, or Enterprise add-on. - A Premium or Ultimate subscription. - If you have GitLab Duo Pro or Enterprise, an assigned seat. - If you have GitLab Duo Core, [IDE features turned on](../../../gitlab_duo/turn_on_off.md#turn-gitlab-duo-core-on-or-off). {{< alert type="note" >}} GitLab Duo requires GitLab 17.2 or later. For GitLab Duo Core access, and for the best user experience and results, [upgrade to GitLab 18.0 or later](../../../../update/_index.md). Earlier versions might continue to work, however the experience might be degraded. {{< /alert >}} ## Use Code Suggestions Prerequisites: - You must have [set up Code Suggestions](set_up.md). To use Code Suggestions: 1. Open your Git project in a [supported IDE](supported_extensions.md#supported-editor-extensions). 1. Add the project as a remote of your local repository using [`git remote add`](../../../../topics/git/commands.md#git-remote-add). 1. Add your project directory, including the hidden `.git/` folder, to your IDE workspace or project. 1. Author your code. As you type, suggestions are displayed. Code Suggestions provides code snippets or completes the current line, depending on the cursor position. 1. Describe the requirements in natural language. Code Suggestions generates functions and code snippets based on the context provided. 1. When you receive a suggestion, you can do any of the following: - To accept a suggestion, press <kbd>Tab</kbd>. - To accept a partial suggestion, press either <kbd>Control</kbd>+<kbd>Right arrow</kbd> or <kbd>Command</kbd>+<kbd>Right arrow</kbd>. - To reject a suggestion, press <kbd>Esc</kbd>. In Neovim, press <kbd>Control</kbd>+<kbd>E</kbd> to exit the menu. - To ignore a suggestion, keep typing as you usually would. ## View multiple code suggestions {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab-vscode-extension/-/issues/1325) in GitLab 17.1. {{< /history >}} For a code completion suggestion in VS Code, multiple suggestion options might be available. To view all available suggestions: 1. Hover over the code completion suggestion. 1. Scroll through the alternatives. Either: - Use keyboard shortcuts: - On a Mac, press <kbd>Option</kbd> + <kbd>\[</kbd> to view the previous suggestion, and press <kbd>Option</kbd> + <kbd>]</kbd> to view the next suggestion. - On Linux and Windows, press <kbd>Alt</kbd> + <kbd>\[</kbd> to view the previous suggestion, and press <kbd>Alt</kbd> + <kbd>]</kbd> to view the next suggestion. - On the dialog that's displayed, select the right or left arrow to see next or previous options. 1. Press <kbd>Tab</kbd> to apply the suggestion you prefer. ## Code completion and generation Code Suggestions uses code completion and code generation: | | Code completion | Code generation | | :---- | :---- | :---- | | Purpose | Provides suggestions for completing the current line of code. | Generates new code based on a natural language comment. | | Trigger | Triggers when typing, usually with a short delay. | Triggers when pressing <kbd>Enter</kbd> after writing a comment that includes specific keywords. | | Scope | Limited to the current line or small block of code. | Can generate entire methods, functions, or even classes based on the context. | | Accuracy | More accurate for small tasks and short blocks of code. | Is more accurate for complex tasks and large blocks of code because a bigger large language model (LLM) is used, additional context is sent in the request (for example, the libraries used by the project), and your instructions are passed to the LLM. | | How to use | Code completion automatically suggests completions to the line you are typing. | You write a comment and press <kbd>Enter</kbd>, or you enter an empty function or method. | | When to use | Use code completion to quickly complete one or a few lines of code. | Use code generation for more complex tasks, larger codebases, when you want to write new code from scratch based on a natural language description, or when the file you're editing has fewer than five lines of code. | Code Suggestions always uses both of these features. You cannot use only code generation or only code completion. <i class="fa fa-youtube-play youtube" aria-hidden="true"></i> [View a code completion vs. code generation comparison demo](https://www.youtube.com/watch?v=9dsyqMt9yg4). <!-- Video published on 2024-09-26 --> ### Best practices for code generation To get the best results from code generation: - Be as specific as possible while remaining concise. - State the outcome you want to generate (for example, a function) and provide details on what you want to achieve. - Add additional information, like the framework or library you want to use. - Add a space or new line after each comment. This space tells the code generator that you have completed your instructions. - In GitLab 17.2 and later, when the `advanced_context_resolver` and `code_suggestions_context` feature flags are enabled, open related files in other tabs to expand the [context that Code Suggestions is aware of](../../../gitlab_duo/context.md#code-suggestions). For example, to create a Python web service with some specific requirements, you might write something like: ```plaintext # Create a web service using Tornado that allows a user to sign in, run a security scan, and review the scan results. # Each action (sign in, run a scan, and review results) should be its own resource in the web service ... ``` AI is non-deterministic, so you may not get the same suggestion every time with the same input. To generate quality code, write clear, descriptive, specific tasks. For use cases and best practices, follow the [GitLab Duo examples documentation](../../../gitlab_duo/use_cases.md). ## Truncation of file content Because of LLM limits and performance reasons, the content of the currently opened file is truncated: - For code completion: to 32,000 tokens (roughly 128,000 characters). - For code generation: to 200,000 tokens (roughly 800,000 characters). Content above the cursor is prioritized over content below the cursor. The content above the cursor is truncated from the left side, and content below the cursor is truncated from the right side. These numbers represent the maximum input context size for Code Suggestions. ## Output length Because of LLM limits and for performance reasons, the output of Code Suggestions is limited: - For code completion: to 64 tokens (roughly 256 characters). - For code generation: to 2048 tokens (roughly 7168 characters). ## Accuracy of results We are continuing to work on the accuracy of overall generated content. However, Code Suggestions might generate suggestions that are: - Irrelevant. - Incomplete. - Results in failed pipelines. - Potentially insecure. - Offensive or insensitive. When using Code Suggestions, code review best practices still apply. ## Available language models Different language models can be the source for Code Suggestions. - On GitLab.com: GitLab hosts the models and connects to them through the cloud-based AI gateway. - On GitLab Self-Managed, two options exist: - GitLab can [host the models and connects to them through the cloud-based AI gateway](set_up.md). - Your organization can [use GitLab Duo Self-Hosted](../../../../administration/gitlab_duo_self_hosted/_index.md), which means you host the AI gateway and language models. You can use GitLab AI vendor models or the other supported language models. ## How the prompt is built To learn about the code that builds the prompt, see these files: - Code generation: [`ee/lib/api/code_suggestions.rb`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/lib/api/code_suggestions.rb#L76) in the `gitlab` repository. - Code completion: [`ai_gateway/code_suggestions/processing/completions.py`](https://gitlab.com/gitlab-org/modelops/applied-ml/code-suggestions/ai-assist/-/blob/fcb3f485a8f047a86a8166aad81f93b6d82106a7/ai_gateway/code_suggestions/processing/completions.py#L273) in the `modelops` repository. ## Prompt caching {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/535651) in GitLab 18.0. {{< /history >}} Prompt caching is enabled by default to improve Code Suggestions latency. When prompt caching is enabled, code completion prompt data is temporarily stored in memory by the model vendor. Prompt caching significantly improves latency by avoiding the re-processing of cached prompt and input data. The cached data is never logged to any persistent storage. ### Disable prompt caching You can disable prompt caching for top-level groups in the GitLab Duo settings. On GitLab.com: 1. On the left sidebar, select **Search or go to** and find your group. 1. Select **Settings > GitLab Duo**. 1. Select **Change configuration**. 1. Disable the **Prompt caching** toggle. 1. Select **Save changes**. On GitLab Self-Managed: 1. On the left sidebar, select **Search or go to** and find your group. 1. Select **Settings > General**. 1. Expand **GitLab Duo features**. 1. Disable the **Prompt caching** toggle. 1. Select **Save changes**. ## Response time Code Suggestions is powered by a generative AI model. - For code completion, suggestions are usually low latency and take less than one second. - For code generation, algorithms or large code blocks might take more than five seconds to generate. Your personal access token enables a secure API connection to GitLab.com or to your GitLab instance. This API connection securely transmits a context window from your IDE/editor to the [GitLab AI gateway](https://gitlab.com/gitlab-org/modelops/applied-ml/code-suggestions/ai-assist), a GitLab hosted service. The gateway calls the large language model APIs, and then the generated suggestion is transmitted back to your IDE/editor. ### Streaming Streaming of Code Generation responses is supported in JetBrains and Visual Studio, leading to perceived faster response times. Other supported IDEs will return the generated code in a single block. Streaming is not enabled for code completion. ### Direct and indirect connections {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/462791) in GitLab 17.2 [with a flag](../../../../administration/feature_flags/_index.md) named `code_suggestions_direct_access`. Disabled by default. {{< /history >}} By default, code completion requests are sent from the IDE directly to the AI gateway to minimize the latency. For this direct connection to work, the IDE must be able to connect to `https://cloud.gitlab.com:443`. If this is not possible (for example, because of network restrictions), you can disable direct connections for all users. If you do this, code completion requests are sent indirectly through the GitLab Self-Managed instance, which in turn sends the requests to the AI gateway. This might result in your requests having higher latency. #### Configure direct or indirect connections Prerequisites: - You must be an administrator for the GitLab Self-Managed instance. {{< tabs >}} {{< tab title="In 17.4 and later" >}} 1. On the left sidebar, at the bottom, select **Admin**. 1. Select **Settings > General**. 1. Expand **GitLab Duo features**. 1. Under **Connection method**, choose an option: - To minimize latency for code completion requests, select **Direct connections**. - To disable direct connections for all users, select **Indirect connections through the GitLab Self-Managed instance**. 1. Select **Save changes**. {{< /tab >}} {{< tab title="In 17.3 and earlier" >}} 1. On the left sidebar, at the bottom, select **Admin**. 1. Select **Settings > General**. 1. Expand **AI-native features**. 1. Choose an option: - To enable direct connections and minimize latency for code completion requests, clear the **Disable direct connections for code suggestions** checkbox. - To disable direct connections, select the **Disable direct connections for code suggestions** checkbox. {{< /tab >}} {{< /tabs >}} ## Feedback Provide feedback about your Code Suggestions experience in [issue 435783](https://gitlab.com/gitlab-org/gitlab/-/issues/435783).
--- stage: Create group: Code Creation info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments description: Code Suggestions helps you write code in GitLab more efficiently by using AI to suggest code as you type. title: Code Suggestions breadcrumbs: - doc - user - project - repository - code_suggestions --- {{< details >}} - Tier: Premium, Ultimate - Add-on: GitLab Duo Core, Pro, or Enterprise, GitLab Duo with Amazon Q - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated - LLMs for code completion: Fireworks AI-hosted [`Codestral`](https://mistral.ai/news/codestral-2501) (default) and Vertex AI-hosted [`Codestral`](https://console.cloud.google.com/vertex-ai/publishers/mistralai/model-garden/codestral-2501). - LLM for code generation: Anthropic [Claude Sonnet 4](https://console.cloud.google.com/vertex-ai/publishers/anthropic/model-garden/claude-sonnet-4). - LLM For Amazon Q: Amazon Q Developer - Available on [GitLab Duo with self-hosted models](../../../../administration/gitlab_duo_self_hosted/_index.md): Yes {{< /details >}} {{< history >}} - [Introduced support for Google Vertex AI Codey APIs](https://gitlab.com/groups/gitlab-org/-/epics/10562) in GitLab 16.1. - [Removed support for GitLab native model](https://gitlab.com/groups/gitlab-org/-/epics/10752) in GitLab 16.2. - [Introduced support for Code Generation](https://gitlab.com/gitlab-org/gitlab/-/issues/415583) in GitLab 16.3. - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/issues/435271) in GitLab 16.7. - [Changed](https://gitlab.com/gitlab-org/fulfillment/meta/-/issues/2031) to require the GitLab Duo Pro add-on on February 15, 2024. Previously, this feature was included with Premium and Ultimate subscriptions. - [Changed](https://gitlab.com/gitlab-org/fulfillment/meta/-/issues/2031) to require the GitLab Duo Pro or GitLab Duo Enterprise add-on for all supported GitLab versions starting October 17, 2024. - [Introduced support for Fireworks AI-hosted Qwen2.5 code completion model](https://gitlab.com/groups/gitlab-org/-/epics/15850) in GitLab 17.6, with a flag named `fireworks_qwen_code_completion`. - [Removed](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/187397) support for Qwen2.5 code completion model in GitLab 17.11. - Enabled Fireworks hosted `Codestral` by default via the feature flag `use_fireworks_codestral_code_completion` in GitLab 17.11. - Changed to include GitLab Duo Core in GitLab 18.0. - Enabled Fireworks hosted `Codestral` as the default model in GitLab 18.1. - To opt out of Fireworks for a group, the feature flag `code_completion_opt_out_fireworks` is available. - [Changed](https://gitlab.com/gitlab-org/gitlab/-/issues/545489) the default model for Code Generation to Claude Sonnet 4 in GitLab 18.2. {{< /history >}} Use GitLab Duo Code Suggestions to write code more efficiently by using generative AI to suggest code while you're developing. - <i class="fa fa-youtube-play youtube" aria-hidden="true"></i> [View a click-through demo](https://gitlab.navattic.com/code-suggestions). <!-- Video published on 2023-12-09 --> <!-- Demo published on 2024-02-01 --> - <i class="fa fa-youtube-play youtube" aria-hidden="true"></i> [Watch an overview](https://youtu.be/ds7SG1wgcVM) ## Prerequisites To use Code Suggestions, you need: - A GitLab Duo Core, Pro, or Enterprise add-on. - A Premium or Ultimate subscription. - If you have GitLab Duo Pro or Enterprise, an assigned seat. - If you have GitLab Duo Core, [IDE features turned on](../../../gitlab_duo/turn_on_off.md#turn-gitlab-duo-core-on-or-off). {{< alert type="note" >}} GitLab Duo requires GitLab 17.2 or later. For GitLab Duo Core access, and for the best user experience and results, [upgrade to GitLab 18.0 or later](../../../../update/_index.md). Earlier versions might continue to work, however the experience might be degraded. {{< /alert >}} ## Use Code Suggestions Prerequisites: - You must have [set up Code Suggestions](set_up.md). To use Code Suggestions: 1. Open your Git project in a [supported IDE](supported_extensions.md#supported-editor-extensions). 1. Add the project as a remote of your local repository using [`git remote add`](../../../../topics/git/commands.md#git-remote-add). 1. Add your project directory, including the hidden `.git/` folder, to your IDE workspace or project. 1. Author your code. As you type, suggestions are displayed. Code Suggestions provides code snippets or completes the current line, depending on the cursor position. 1. Describe the requirements in natural language. Code Suggestions generates functions and code snippets based on the context provided. 1. When you receive a suggestion, you can do any of the following: - To accept a suggestion, press <kbd>Tab</kbd>. - To accept a partial suggestion, press either <kbd>Control</kbd>+<kbd>Right arrow</kbd> or <kbd>Command</kbd>+<kbd>Right arrow</kbd>. - To reject a suggestion, press <kbd>Esc</kbd>. In Neovim, press <kbd>Control</kbd>+<kbd>E</kbd> to exit the menu. - To ignore a suggestion, keep typing as you usually would. ## View multiple code suggestions {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab-vscode-extension/-/issues/1325) in GitLab 17.1. {{< /history >}} For a code completion suggestion in VS Code, multiple suggestion options might be available. To view all available suggestions: 1. Hover over the code completion suggestion. 1. Scroll through the alternatives. Either: - Use keyboard shortcuts: - On a Mac, press <kbd>Option</kbd> + <kbd>\[</kbd> to view the previous suggestion, and press <kbd>Option</kbd> + <kbd>]</kbd> to view the next suggestion. - On Linux and Windows, press <kbd>Alt</kbd> + <kbd>\[</kbd> to view the previous suggestion, and press <kbd>Alt</kbd> + <kbd>]</kbd> to view the next suggestion. - On the dialog that's displayed, select the right or left arrow to see next or previous options. 1. Press <kbd>Tab</kbd> to apply the suggestion you prefer. ## Code completion and generation Code Suggestions uses code completion and code generation: | | Code completion | Code generation | | :---- | :---- | :---- | | Purpose | Provides suggestions for completing the current line of code. | Generates new code based on a natural language comment. | | Trigger | Triggers when typing, usually with a short delay. | Triggers when pressing <kbd>Enter</kbd> after writing a comment that includes specific keywords. | | Scope | Limited to the current line or small block of code. | Can generate entire methods, functions, or even classes based on the context. | | Accuracy | More accurate for small tasks and short blocks of code. | Is more accurate for complex tasks and large blocks of code because a bigger large language model (LLM) is used, additional context is sent in the request (for example, the libraries used by the project), and your instructions are passed to the LLM. | | How to use | Code completion automatically suggests completions to the line you are typing. | You write a comment and press <kbd>Enter</kbd>, or you enter an empty function or method. | | When to use | Use code completion to quickly complete one or a few lines of code. | Use code generation for more complex tasks, larger codebases, when you want to write new code from scratch based on a natural language description, or when the file you're editing has fewer than five lines of code. | Code Suggestions always uses both of these features. You cannot use only code generation or only code completion. <i class="fa fa-youtube-play youtube" aria-hidden="true"></i> [View a code completion vs. code generation comparison demo](https://www.youtube.com/watch?v=9dsyqMt9yg4). <!-- Video published on 2024-09-26 --> ### Best practices for code generation To get the best results from code generation: - Be as specific as possible while remaining concise. - State the outcome you want to generate (for example, a function) and provide details on what you want to achieve. - Add additional information, like the framework or library you want to use. - Add a space or new line after each comment. This space tells the code generator that you have completed your instructions. - In GitLab 17.2 and later, when the `advanced_context_resolver` and `code_suggestions_context` feature flags are enabled, open related files in other tabs to expand the [context that Code Suggestions is aware of](../../../gitlab_duo/context.md#code-suggestions). For example, to create a Python web service with some specific requirements, you might write something like: ```plaintext # Create a web service using Tornado that allows a user to sign in, run a security scan, and review the scan results. # Each action (sign in, run a scan, and review results) should be its own resource in the web service ... ``` AI is non-deterministic, so you may not get the same suggestion every time with the same input. To generate quality code, write clear, descriptive, specific tasks. For use cases and best practices, follow the [GitLab Duo examples documentation](../../../gitlab_duo/use_cases.md). ## Truncation of file content Because of LLM limits and performance reasons, the content of the currently opened file is truncated: - For code completion: to 32,000 tokens (roughly 128,000 characters). - For code generation: to 200,000 tokens (roughly 800,000 characters). Content above the cursor is prioritized over content below the cursor. The content above the cursor is truncated from the left side, and content below the cursor is truncated from the right side. These numbers represent the maximum input context size for Code Suggestions. ## Output length Because of LLM limits and for performance reasons, the output of Code Suggestions is limited: - For code completion: to 64 tokens (roughly 256 characters). - For code generation: to 2048 tokens (roughly 7168 characters). ## Accuracy of results We are continuing to work on the accuracy of overall generated content. However, Code Suggestions might generate suggestions that are: - Irrelevant. - Incomplete. - Results in failed pipelines. - Potentially insecure. - Offensive or insensitive. When using Code Suggestions, code review best practices still apply. ## Available language models Different language models can be the source for Code Suggestions. - On GitLab.com: GitLab hosts the models and connects to them through the cloud-based AI gateway. - On GitLab Self-Managed, two options exist: - GitLab can [host the models and connects to them through the cloud-based AI gateway](set_up.md). - Your organization can [use GitLab Duo Self-Hosted](../../../../administration/gitlab_duo_self_hosted/_index.md), which means you host the AI gateway and language models. You can use GitLab AI vendor models or the other supported language models. ## How the prompt is built To learn about the code that builds the prompt, see these files: - Code generation: [`ee/lib/api/code_suggestions.rb`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/lib/api/code_suggestions.rb#L76) in the `gitlab` repository. - Code completion: [`ai_gateway/code_suggestions/processing/completions.py`](https://gitlab.com/gitlab-org/modelops/applied-ml/code-suggestions/ai-assist/-/blob/fcb3f485a8f047a86a8166aad81f93b6d82106a7/ai_gateway/code_suggestions/processing/completions.py#L273) in the `modelops` repository. ## Prompt caching {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/535651) in GitLab 18.0. {{< /history >}} Prompt caching is enabled by default to improve Code Suggestions latency. When prompt caching is enabled, code completion prompt data is temporarily stored in memory by the model vendor. Prompt caching significantly improves latency by avoiding the re-processing of cached prompt and input data. The cached data is never logged to any persistent storage. ### Disable prompt caching You can disable prompt caching for top-level groups in the GitLab Duo settings. On GitLab.com: 1. On the left sidebar, select **Search or go to** and find your group. 1. Select **Settings > GitLab Duo**. 1. Select **Change configuration**. 1. Disable the **Prompt caching** toggle. 1. Select **Save changes**. On GitLab Self-Managed: 1. On the left sidebar, select **Search or go to** and find your group. 1. Select **Settings > General**. 1. Expand **GitLab Duo features**. 1. Disable the **Prompt caching** toggle. 1. Select **Save changes**. ## Response time Code Suggestions is powered by a generative AI model. - For code completion, suggestions are usually low latency and take less than one second. - For code generation, algorithms or large code blocks might take more than five seconds to generate. Your personal access token enables a secure API connection to GitLab.com or to your GitLab instance. This API connection securely transmits a context window from your IDE/editor to the [GitLab AI gateway](https://gitlab.com/gitlab-org/modelops/applied-ml/code-suggestions/ai-assist), a GitLab hosted service. The gateway calls the large language model APIs, and then the generated suggestion is transmitted back to your IDE/editor. ### Streaming Streaming of Code Generation responses is supported in JetBrains and Visual Studio, leading to perceived faster response times. Other supported IDEs will return the generated code in a single block. Streaming is not enabled for code completion. ### Direct and indirect connections {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/462791) in GitLab 17.2 [with a flag](../../../../administration/feature_flags/_index.md) named `code_suggestions_direct_access`. Disabled by default. {{< /history >}} By default, code completion requests are sent from the IDE directly to the AI gateway to minimize the latency. For this direct connection to work, the IDE must be able to connect to `https://cloud.gitlab.com:443`. If this is not possible (for example, because of network restrictions), you can disable direct connections for all users. If you do this, code completion requests are sent indirectly through the GitLab Self-Managed instance, which in turn sends the requests to the AI gateway. This might result in your requests having higher latency. #### Configure direct or indirect connections Prerequisites: - You must be an administrator for the GitLab Self-Managed instance. {{< tabs >}} {{< tab title="In 17.4 and later" >}} 1. On the left sidebar, at the bottom, select **Admin**. 1. Select **Settings > General**. 1. Expand **GitLab Duo features**. 1. Under **Connection method**, choose an option: - To minimize latency for code completion requests, select **Direct connections**. - To disable direct connections for all users, select **Indirect connections through the GitLab Self-Managed instance**. 1. Select **Save changes**. {{< /tab >}} {{< tab title="In 17.3 and earlier" >}} 1. On the left sidebar, at the bottom, select **Admin**. 1. Select **Settings > General**. 1. Expand **AI-native features**. 1. Choose an option: - To enable direct connections and minimize latency for code completion requests, clear the **Disable direct connections for code suggestions** checkbox. - To disable direct connections, select the **Disable direct connections for code suggestions** checkbox. {{< /tab >}} {{< /tabs >}} ## Feedback Provide feedback about your Code Suggestions experience in [issue 435783](https://gitlab.com/gitlab-org/gitlab/-/issues/435783).
https://docs.gitlab.com/user/project/repository/supported_extensions
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/repository/supported_extensions.md
2025-08-13
doc/user/project/repository/code_suggestions
[ "doc", "user", "project", "repository", "code_suggestions" ]
supported_extensions.md
Create
Code Creation
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Supported extensions and languages
Code Suggestions supports multiple editors and languages.
{{< details >}} - Tier: Premium, Ultimate - Add-on: GitLab Duo Core, Pro, or Enterprise, GitLab Duo with Amazon Q - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} {{< history >}} - Changed to require GitLab Duo add-on in GitLab 17.6 and later. - Changed to include GitLab Duo Core in GitLab 18.0. {{< /history >}} Code Suggestions is available in the following editor extensions and for the following languages. ## Supported editor extensions To use Code Suggestions, use one of these editor extensions: | IDE | Extension | |-----------------------------------------------------------------|-----------| | Visual Studio Code (VS Code) | [GitLab Workflow for VS Code](https://marketplace.visualstudio.com/items?itemName=GitLab.gitlab-workflow) | | [GitLab Web IDE (VS Code in the Cloud)](../../web_ide/_index.md) | No configuration required. | | Microsoft Visual Studio (2022 for Windows) | [Visual Studio GitLab extension](https://marketplace.visualstudio.com/items?itemName=GitLab.GitLabExtensionForVisualStudio) | | JetBrains IDEs | [GitLab Duo Plugin for JetBrains](https://plugins.jetbrains.com/plugin/22325-gitlab-duo) | | Neovim | [`gitlab.vim` plugin](https://gitlab.com/gitlab-org/editor-extensions/gitlab.vim) | | Eclipse | [GitLab for Eclipse](../../../../editor_extensions/eclipse/setup.md) | A [GitLab Language Server](https://gitlab.com/gitlab-org/editor-extensions/gitlab-lsp) is used in VS Code, Visual Studio, Eclipse, and Neovim. The Language Server supports faster iteration across more platforms. You can also configure it to support Code Suggestions in IDEs where GitLab doesn't provide official support. You can express interest in other IDE extension support [in this issue](https://gitlab.com/gitlab-org/editor-extensions/meta/-/issues/78). ## Supported languages by IDE The following table provides more information on the languages Code Suggestions supports by default, and the IDEs. Code Suggestions also works with other languages, but you must [manually add support](#add-support-for-more-languages). | Language | Web IDE | VS Code | JetBrains IDEs | Visual Studio 2022 for Windows | Neovim | Eclipse | |-------------------------------|----------------------------|---------------------------------------------------------------------------------------------|-----------------------|--------------------------------|--------------------------------------------------------------------------------------------------------|---------| | C | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="dash-circle" >}} No | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | | C++ | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | | C# | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | | CSS | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="dash-circle" >}} No | {{< icon name="dash-circle" >}} No | {{< icon name="dash-circle" >}} No | {{< icon name="dash-circle" >}} No | {{< icon name="dash-circle" >}} No | | Go | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | | Google SQL | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="dash-circle" >}} No | | HAML | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | | HTML | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="dash-circle" >}} No | {{< icon name="dash-circle" >}} No | {{< icon name="dash-circle" >}} No | {{< icon name="dash-circle" >}} No | {{< icon name="dash-circle" >}} No | | Java | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | | JavaScript | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | | Kotlin | {{< icon name="dash-circle" >}} No | {{< icon name="check-circle-filled" >}} Yes <br><br>(Requires third-party extension providing Kotlin support) | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | | Markdown | {{< icon name="check-circle-filled" >}} Yes |{{< icon name="dash-circle" >}} No | {{< icon name="dash-circle" >}} No | {{< icon name="dash-circle" >}} No | {{< icon name="dash-circle" >}} No | {{< icon name="dash-circle" >}} No | | PHP | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | | Python | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | | Ruby | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | | Rust | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | | Scala | {{< icon name="dash-circle" >}} No | {{< icon name="check-circle-filled" >}} Yes <br><br>(Requires third-party extension providing Scala support) | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | | Shell scripts (`bash` only) | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="dash-circle" >}} No | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | | Svelte | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | | Swift | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | | TypeScript (`.ts` and `.tsx` files) | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | | Terraform | {{< icon name="dash-circle" >}} No | {{< icon name="check-circle-filled" >}} Yes <br><br>(Requires third-party extension providing Terraform support) | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="dash-circle" >}} No | {{< icon name="check-circle-filled" >}} Yes <br><br>(Requires third-party extension providing the `terraform` file type) | {{< icon name="check-circle-filled" >}} Yes | | Vue | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< alert type="note" >}} Some languages are not supported in all JetBrains IDEs, or might require additional plugin support. Refer to the JetBrains documentation for specifics on your IDE. {{< /alert >}} ## Support for Infrastructure-as-Code (IaC) Code Suggestions works with infrastructure-as-code interfaces, including: - Kubernetes Resource Model (KRM) - Google Cloud CLI - Terraform ## Manage languages for Code Suggestions {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab-vscode-extension/-/blob/main/CHANGELOG.md#4210-2024-07-16) in GitLab Workflow for VS Code 4.21.0 {{< /history >}} You can customize your coding experience in VS Code by enabling or disabling Code Suggestions for specific supported languages. You can do this by editing your `settings.json` file directly, or from the VS Code user interface: 1. In VS Code, open the extension settings for **GitLab Workflow**: 1. On the top bar, go to **Code** > **Settings** > **Extensions**. 1. Search for **GitLab Workflow** in the list, and select **Manage** ({{< icon name="settings" >}}). 1. Select **Extension Settings**. 1. In your **User** settings, find the section titled **AI Assisted Code Suggestions: Enabled Supported Languages**. 1. To enable Code Suggestions for a language, select its checkbox. 1. To disable Code Suggestions for a language, clear its checkbox. 1. Your changes are automatically saved, and take effect immediately. When you disable Code Suggestions for a language, the Duo icon changes to show that suggestions are disabled for this language. On hover, it shows **Code Suggestions are disabled for this language**. ## Add support for more languages If your desired language doesn't have Code Suggestions available by default, you can add support for your language locally. However, Code Suggestions might not function as expected. {{< tabs >}} {{< tab title="Visual Studio Code" >}} Prerequisites: - You have installed and enabled the [GitLab Workflow extension for VS Code](../../../../editor_extensions/visual_studio_code/_index.md). - You have completed the [VS Code extension setup](https://gitlab.com/gitlab-org/gitlab-vscode-extension/#setup) instructions, and authorized the extension to access your GitLab account. To do this: 1. Find your desired language in the list of [language identifiers](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocumentItem). You need the **Identifier** for your languages in a later step. 1. In VS Code, open the extension settings for **GitLab Workflow**: 1. On the top bar, go to **Code** > **Settings** > **Extensions**. 1. Search for **GitLab Workflow** in the list, and select **Manage** ({{< icon name="settings" >}}). 1. Select **Extension Settings**. 1. In your **User** settings, find **GitLab › Ai Assisted Code Suggestions: Additional Languages** and select **Add Item**. 1. In **Item**, add the identifier for each language you want to support. Identifiers should be lowercase, like `html` or `powershell`. Don't add leading periods from file suffixes to each identifier. 1. Select **OK**. {{< /tab >}} {{< tab title="JetBrains IDEs" >}} Prerequisites: - You have installed and enabled the [GitLab plugin for JetBrains IDEs](../../../../editor_extensions/jetbrains_ide/_index.md). - You have completed the [Jetbrains extension setup](https://gitlab.com/gitlab-org/editor-extensions/gitlab-jetbrains-plugin#setup) instructions, and authorized the extension to access your GitLab account. To do this: 1. Find your desired language in the list of [language identifiers](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocumentItem). You need the identifier for your languages in a later step. 1. In your IDE, on the top bar, select your IDE name, then select **Settings**. 1. On the left sidebar, select **Tools** > **GitLab Duo**. 1. Under **Code Suggestions Enabled Languages** > **Additional languages**, add the identifier for each language you want to support. Identifiers should be in lowercase, like `html`. Separate multiple identifiers with commas, like `html,powershell,latex`, and don't add leading periods to each identifier. 1. Select **OK**. {{< /tab >}} {{< tab title="Eclipse" >}} Prerequisites: - You have installed and enabled the [GitLab for Eclipse plugin](../../../../editor_extensions/eclipse/_index.md). - You have completed the [Eclipse setup](../../../../editor_extensions/eclipse/setup.md) instructions, and authorized the extension to access your GitLab account. To do this: 1. In your Eclipse bottom menu, select the GitLab icon. 1. Select **Show Settings**. 1. Scroll down to the **Code Suggestions Enabled Languages** section. 1. In **Additional Languages**, add a comma-separated list of language identifiers. Don't add leading periods to the identifiers. For example, use `html`, `md`, and `powershell`. {{< /tab >}} {{< /tabs >}}
--- stage: Create group: Code Creation info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments description: Code Suggestions supports multiple editors and languages. title: Supported extensions and languages breadcrumbs: - doc - user - project - repository - code_suggestions --- {{< details >}} - Tier: Premium, Ultimate - Add-on: GitLab Duo Core, Pro, or Enterprise, GitLab Duo with Amazon Q - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} {{< history >}} - Changed to require GitLab Duo add-on in GitLab 17.6 and later. - Changed to include GitLab Duo Core in GitLab 18.0. {{< /history >}} Code Suggestions is available in the following editor extensions and for the following languages. ## Supported editor extensions To use Code Suggestions, use one of these editor extensions: | IDE | Extension | |-----------------------------------------------------------------|-----------| | Visual Studio Code (VS Code) | [GitLab Workflow for VS Code](https://marketplace.visualstudio.com/items?itemName=GitLab.gitlab-workflow) | | [GitLab Web IDE (VS Code in the Cloud)](../../web_ide/_index.md) | No configuration required. | | Microsoft Visual Studio (2022 for Windows) | [Visual Studio GitLab extension](https://marketplace.visualstudio.com/items?itemName=GitLab.GitLabExtensionForVisualStudio) | | JetBrains IDEs | [GitLab Duo Plugin for JetBrains](https://plugins.jetbrains.com/plugin/22325-gitlab-duo) | | Neovim | [`gitlab.vim` plugin](https://gitlab.com/gitlab-org/editor-extensions/gitlab.vim) | | Eclipse | [GitLab for Eclipse](../../../../editor_extensions/eclipse/setup.md) | A [GitLab Language Server](https://gitlab.com/gitlab-org/editor-extensions/gitlab-lsp) is used in VS Code, Visual Studio, Eclipse, and Neovim. The Language Server supports faster iteration across more platforms. You can also configure it to support Code Suggestions in IDEs where GitLab doesn't provide official support. You can express interest in other IDE extension support [in this issue](https://gitlab.com/gitlab-org/editor-extensions/meta/-/issues/78). ## Supported languages by IDE The following table provides more information on the languages Code Suggestions supports by default, and the IDEs. Code Suggestions also works with other languages, but you must [manually add support](#add-support-for-more-languages). | Language | Web IDE | VS Code | JetBrains IDEs | Visual Studio 2022 for Windows | Neovim | Eclipse | |-------------------------------|----------------------------|---------------------------------------------------------------------------------------------|-----------------------|--------------------------------|--------------------------------------------------------------------------------------------------------|---------| | C | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="dash-circle" >}} No | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | | C++ | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | | C# | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | | CSS | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="dash-circle" >}} No | {{< icon name="dash-circle" >}} No | {{< icon name="dash-circle" >}} No | {{< icon name="dash-circle" >}} No | {{< icon name="dash-circle" >}} No | | Go | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | | Google SQL | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="dash-circle" >}} No | | HAML | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | | HTML | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="dash-circle" >}} No | {{< icon name="dash-circle" >}} No | {{< icon name="dash-circle" >}} No | {{< icon name="dash-circle" >}} No | {{< icon name="dash-circle" >}} No | | Java | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | | JavaScript | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | | Kotlin | {{< icon name="dash-circle" >}} No | {{< icon name="check-circle-filled" >}} Yes <br><br>(Requires third-party extension providing Kotlin support) | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | | Markdown | {{< icon name="check-circle-filled" >}} Yes |{{< icon name="dash-circle" >}} No | {{< icon name="dash-circle" >}} No | {{< icon name="dash-circle" >}} No | {{< icon name="dash-circle" >}} No | {{< icon name="dash-circle" >}} No | | PHP | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | | Python | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | | Ruby | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | | Rust | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | | Scala | {{< icon name="dash-circle" >}} No | {{< icon name="check-circle-filled" >}} Yes <br><br>(Requires third-party extension providing Scala support) | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | | Shell scripts (`bash` only) | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="dash-circle" >}} No | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | | Svelte | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | | Swift | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | | TypeScript (`.ts` and `.tsx` files) | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | | Terraform | {{< icon name="dash-circle" >}} No | {{< icon name="check-circle-filled" >}} Yes <br><br>(Requires third-party extension providing Terraform support) | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="dash-circle" >}} No | {{< icon name="check-circle-filled" >}} Yes <br><br>(Requires third-party extension providing the `terraform` file type) | {{< icon name="check-circle-filled" >}} Yes | | Vue | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< icon name="check-circle-filled" >}} Yes | {{< alert type="note" >}} Some languages are not supported in all JetBrains IDEs, or might require additional plugin support. Refer to the JetBrains documentation for specifics on your IDE. {{< /alert >}} ## Support for Infrastructure-as-Code (IaC) Code Suggestions works with infrastructure-as-code interfaces, including: - Kubernetes Resource Model (KRM) - Google Cloud CLI - Terraform ## Manage languages for Code Suggestions {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab-vscode-extension/-/blob/main/CHANGELOG.md#4210-2024-07-16) in GitLab Workflow for VS Code 4.21.0 {{< /history >}} You can customize your coding experience in VS Code by enabling or disabling Code Suggestions for specific supported languages. You can do this by editing your `settings.json` file directly, or from the VS Code user interface: 1. In VS Code, open the extension settings for **GitLab Workflow**: 1. On the top bar, go to **Code** > **Settings** > **Extensions**. 1. Search for **GitLab Workflow** in the list, and select **Manage** ({{< icon name="settings" >}}). 1. Select **Extension Settings**. 1. In your **User** settings, find the section titled **AI Assisted Code Suggestions: Enabled Supported Languages**. 1. To enable Code Suggestions for a language, select its checkbox. 1. To disable Code Suggestions for a language, clear its checkbox. 1. Your changes are automatically saved, and take effect immediately. When you disable Code Suggestions for a language, the Duo icon changes to show that suggestions are disabled for this language. On hover, it shows **Code Suggestions are disabled for this language**. ## Add support for more languages If your desired language doesn't have Code Suggestions available by default, you can add support for your language locally. However, Code Suggestions might not function as expected. {{< tabs >}} {{< tab title="Visual Studio Code" >}} Prerequisites: - You have installed and enabled the [GitLab Workflow extension for VS Code](../../../../editor_extensions/visual_studio_code/_index.md). - You have completed the [VS Code extension setup](https://gitlab.com/gitlab-org/gitlab-vscode-extension/#setup) instructions, and authorized the extension to access your GitLab account. To do this: 1. Find your desired language in the list of [language identifiers](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocumentItem). You need the **Identifier** for your languages in a later step. 1. In VS Code, open the extension settings for **GitLab Workflow**: 1. On the top bar, go to **Code** > **Settings** > **Extensions**. 1. Search for **GitLab Workflow** in the list, and select **Manage** ({{< icon name="settings" >}}). 1. Select **Extension Settings**. 1. In your **User** settings, find **GitLab › Ai Assisted Code Suggestions: Additional Languages** and select **Add Item**. 1. In **Item**, add the identifier for each language you want to support. Identifiers should be lowercase, like `html` or `powershell`. Don't add leading periods from file suffixes to each identifier. 1. Select **OK**. {{< /tab >}} {{< tab title="JetBrains IDEs" >}} Prerequisites: - You have installed and enabled the [GitLab plugin for JetBrains IDEs](../../../../editor_extensions/jetbrains_ide/_index.md). - You have completed the [Jetbrains extension setup](https://gitlab.com/gitlab-org/editor-extensions/gitlab-jetbrains-plugin#setup) instructions, and authorized the extension to access your GitLab account. To do this: 1. Find your desired language in the list of [language identifiers](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocumentItem). You need the identifier for your languages in a later step. 1. In your IDE, on the top bar, select your IDE name, then select **Settings**. 1. On the left sidebar, select **Tools** > **GitLab Duo**. 1. Under **Code Suggestions Enabled Languages** > **Additional languages**, add the identifier for each language you want to support. Identifiers should be in lowercase, like `html`. Separate multiple identifiers with commas, like `html,powershell,latex`, and don't add leading periods to each identifier. 1. Select **OK**. {{< /tab >}} {{< tab title="Eclipse" >}} Prerequisites: - You have installed and enabled the [GitLab for Eclipse plugin](../../../../editor_extensions/eclipse/_index.md). - You have completed the [Eclipse setup](../../../../editor_extensions/eclipse/setup.md) instructions, and authorized the extension to access your GitLab account. To do this: 1. In your Eclipse bottom menu, select the GitLab icon. 1. Select **Show Settings**. 1. Scroll down to the **Code Suggestions Enabled Languages** section. 1. In **Additional Languages**, add a comma-separated list of language identifiers. Don't add leading periods to the identifiers. For example, use `html`, `md`, and `powershell`. {{< /tab >}} {{< /tabs >}}
https://docs.gitlab.com/user/project/repository/troubleshooting
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/repository/troubleshooting.md
2025-08-13
doc/user/project/repository/code_suggestions
[ "doc", "user", "project", "repository", "code_suggestions" ]
troubleshooting.md
Create
Code Creation
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Troubleshooting Code Suggestions
Troubleshooting tips for common problems in Code Suggestions.
{{< details >}} - Tier: Premium, Ultimate - Add-on: GitLab Duo Core, Pro, or Enterprise, GitLab Duo with Amazon Q - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} {{< history >}} - Changed to require GitLab Duo add-on in GitLab 17.6 and later. - Changed to include GitLab Duo Core in GitLab 18.0. {{< /history >}} When working with GitLab Duo Code Suggestions, you might encounter the following issues. You can run a [health check](../../../gitlab_duo/turn_on_off.md) to test if your instance meets the requirements to run Code Suggestions. For more information on troubleshooting GitLab Duo, see: - [Troubleshooting GitLab Duo](../../../gitlab_duo/troubleshooting.md). - [GitLab Duo Chat troubleshooting](../../../gitlab_duo_chat/troubleshooting.md). - [Troubleshooting GitLab Duo Self-Hosted](../../../../administration/gitlab_duo_self_hosted/troubleshooting.md). ## Suggestions are not displayed If suggestions are not displayed, ensure that you: - Have [configured GitLab Duo correctly](../../../gitlab_duo/turn_on_off.md). - Are using a [supported language](supported_extensions.md#supported-languages-by-ide) and [editor extension](supported_extensions.md#supported-editor-extensions). - Have [configured your editor extension correctly](set_up.md#configure-editor-extension). If suggestions are still not displayed, try the following troubleshooting steps for the different IDEs: - [VS Code or GitLab Web IDE](#suggestions-not-displayed-in-vs-code-or-gitlab-web-ide) - [JetBrains IDEs](#suggestions-not-displayed-in-jetbrains-ides) - [Microsoft Visual Studio](#suggestions-not-displayed-in-microsoft-visual-studio) ## Code Suggestions returns a 401 error Code Suggestions [depends on a license token](../../../gitlab_duo/_index.md) that [synchronizes your subscription](../../../../administration/license.md) with GitLab. If the token expires, GitLab Duo Code Suggestions returns the following error with status `401` when the token has expired: ```plaintext Token validation failed in Language Server: (Failed to check token: Error: Fetching Information about personal access token ``` If GitLab has access to the [cloud server](../../../gitlab_duo/_index.md), try [manually synchronizing your license](../../../../subscriptions/manage_subscription.md#manually-synchronize-subscription-data). ## Authentication troubleshooting The problem might be driven to the recent changes in authentication, specifically the token system. To resolve the issue: 1. Remove the existing personal access token from your GitLab account settings. 1. Reauthorize your GitLab account using OAuth. 1. Test the Code Suggestions feature with different file extensions to verify if the issue is resolved. ## VS Code troubleshooting The following documentation is for Code Suggestions-specific troubleshooting for VS Code. For non-Code Suggestions troubleshooting for VS Code, see [Troubleshooting the GitLab Workflow extension for VS Code](../../../../editor_extensions/visual_studio_code/troubleshooting.md). ### Suggestions not displayed in VS Code or GitLab Web IDE If you are on GitLab Self-Managed, ensure that Code Suggestions for the [GitLab Web IDE](../../web_ide/_index.md) is enabled. The same settings apply to VS Code as local IDE. 1. On the left sidebar, select **Extensions > GitLab Workflow**. 1. Select **Settings** ({{< icon name="settings" >}}), and then select **Extension Settings**. 1. In **GitLab > Duo Code Suggestions**, select the **GitLab Duo Code Suggestions** checkbox. #### View Code Suggestions logs If Code Suggestions are enabled for the IDE, but suggestions are still not displayed: 1. In your IDE, in the GitLab Workflow **Extension Settings**, enable **GitLab: Debug**. - For Web IDE, you must have the [marketplace extensions](../../web_ide/_index.md#manage-extensions) enabled. 1. On the top menu, select **View > Output** to open the bottom panel, then either: - In the command palette, select `GitLab: Show Extension Logs`. - In the bottom panel, on the right, select the dropdown list to filter the logs. Select **GitLab Workflow**. 1. In the GitLab Workflow **Extension Settings**, clear and re-select the **GitLab Duo Code Suggestions** checkbox. ### Disable streaming of code generation results By default, code generation streams AI-generated code. Streaming sends generated code to your editor incrementally, rather than waiting for the full code snippet to generate. This allows for a more interactive and responsive experience. If you prefer to see code generation results only when they are complete, you can turn off streaming. Disabling streaming means that code generation requests might be perceived as taking longer to resolve. To disable streaming: 1. In VS Code, on the top bar, go to **Code > Settings > Settings**. 1. On the top right corner, select **Open Settings (JSON)** to edit your `settings.json` file: ![The icons on the top right corner of VS Code, including 'Open Settings.'](img/open_settings_v17_5.png) 1. In your `settings.json` file, add this line, or set it to `false` it already exists: ```json "gitlab.featureFlags.streamCodeGenerations": false, ``` 1. Save your changes. ### Error: Direct connection fails {{< history >}} - Direct connection [introduced](https://gitlab.com/groups/gitlab-org/-/epics/13252) in GitLab 17.2. {{< /history >}} To reduce latency, the Workflow extension tries to send suggestion completion requests directly to GitLab Cloud Connector, bypassing the GitLab instance. This network connection does not use the proxy and certificate settings of the VS Code extension. If your GitLab instance doesn't support direct connections, or your network prevents the extension from connecting to GitLab Cloud Connector, you might see these warnings in your logs: ```plaintext Failed to fetch direct connection details from GitLab instance. Code suggestion requests will be sent to GitLab instance. ``` This error means your instance either doesn't support direct connections, or is misconfigured. If you see this error, the extension can't connect to GitLab Cloud Connector, and is reverting to use your GitLab instance: ```plaintext Direct connection for code suggestions failed. Code suggestion requests will be sent to your GitLab instance. ``` The indirect connection through your GitLab instance is about 100 ms slower, but otherwise works the same. This issue is often caused by network connection problems, like with your LAN firewall or proxy settings. ## JetBrains IDEs troubleshooting The following documentation is for Code Suggestions-specific troubleshooting for JetBrains IDEs. For non-Code Suggestions troubleshooting for JetBrains IDEs, see [JetBrains troubleshooting](../../../../editor_extensions/jetbrains_ide/jetbrains_troubleshooting.md). ### Suggestions not displayed in JetBrains IDEs 1. From the **Tools > GitLab Duo** menu, select **Verify setup**. Make sure the health check passes. 1. Verify that your JetBrains IDE natively supports the language of the file you are working on. Go to **Settings** > **Languages & Frameworks** to see the full list of languages and frameworks supported by your JetBrains IDE. ### Error: `unable to find valid certification path to requested target` The GitLab Duo plugin verifies TLS certificate information before connecting to your GitLab instance. You can [add a custom SSL certificate](set_up.md#add-a-custom-certificate-for-code-suggestions). ### Error: `Failed to check token` This error occurs when the provided connection instance URL and authentication token passed through to the GitLab Language Server process are invalid. To re-enable Code Suggestions: 1. In your IDE, on the top bar, select your IDE name, then select **Settings**. 1. On the left sidebar, select **Tools > GitLab Duo**. 1. Under **Connection**, select **Verify setup**. 1. Update your **Connection** details as needed. 1. Select **Verify setup**, and confirm that authentication succeeds. 1. Select **OK** or **Save**. ## Microsoft Visual Studio troubleshooting The following documentation is for Code Suggestions-specific troubleshooting for Microsoft Visual Studio. For non-Code Suggestions troubleshooting for Microsoft Visual Studio, see [Visual Studio troubleshooting](../../../../editor_extensions/visual_studio/visual_studio_troubleshooting.md). ### IntelliCode is missing Code Suggestions requires the IntelliCode component of Visual Studio. If the component is missing, you might see an error like this when you start Visual Studio: ```plaintext SetSite failed for package [VisualStudioPackage]Source: 'Microsoft.VisualStudio.Composition' Description: Expected 1 export(s) with contract name "Microsoft.VisualStudio.Language.Suggestions.SuggestionServiceBase" but found 0 after applying applicable constraints. Microsoft.VisualStudio.Composition.CompositionFailedException: Expected 1 export(s) with contract name "Microsoft.VisualStudio.Language.Suggestions.SuggestionServiceBase" but found 0 after applying applicable constraints. at Microsoft.VisualStudio.Composition.ExportProvider.GetExports(ImportDefinition importDefinition) at Microsoft.VisualStudio.Composition.ExportProvider.GetExports[T,TMetadataView](String contractName, ImportCardinality cardinality) at Microsoft.VisualStudio.Composition.ExportProvider.GetExport[T,TMetadataView](String contractName) at Microsoft.VisualStudio.Composition.ExportProvider.GetExportedValue[T]() at Microsoft.VisualStudio.ComponentModelHost.ComponentModel.GetService[T]() [...] ``` To fix this problem, install the IntelliCode component: 1. In the Windows start menu, search for the **Visual Studio Installer** and open it. 1. Select your Visual Studio instance, then select **Modify**. 1. In the **Individual components** tab, search for **IntelliCode**. 1. Select the component's checkbox, then on the bottom right, select **Modify**. 1. Wait for the Visual Studio Installer to finish the installation. ### Suggestions not displayed in Microsoft Visual Studio 1. Ensure you have properly [set up the extension](https://gitlab.com/gitlab-org/editor-extensions/gitlab-visual-studio-extension#setup). 1. From the **Tools > Options** menu, find the **GitLab** option. Ensure **Log Level** is set to **Debug**. 1. In **View > Output**, open the extension log. Change the dropdown list to **GitLab Extension** as the log filter. 1. Verify that the debug log contains similar output: ```shell 14:48:21:344 GitlabProposalSource.GetCodeSuggestionAsync 14:48:21:344 LsClient.SendTextDocumentCompletionAsync("GitLab.Extension.Test\TestData.cs", 34, 0) 14:48:21:346 LS(55096): time="2023-07-17T14:48:21-05:00" level=info msg="update context" ``` If another extension provides similar suggestion or completion features, the extension might not return suggestions. To resolve this: 1. Disable all other Visual Studio extensions. 1. Confirm that you now receive Code Suggestions. 1. Re-enable extensions one at a time, testing for Code Suggestions each time, to find the extension that conflicts. ## Neovim troubleshooting The following documentation is for Code Suggestions-specific troubleshooting for Neovim. For non-Code Suggestions troubleshooting for Neovim, see [Neovim troubleshooting](../../../../editor_extensions/neovim/neovim_troubleshooting.md). ### Code completions fails 1. Confirm `omnifunc` is set in Neovim: ```lua :verbose set omnifunc? ``` 1. Confirm the Language Server is active by running this command in Neovim: ```lua :lua =vim.lsp.get_active_clients() ``` 1. Check the logs for the Language Server in `~/.local/state/nvim/lsp.log`. 1. Inspect the `vim.lsp` log path for errors by running this command in Neovim: ```lua :lua =vim.cmd('view ' .. vim.lsp.get_log_path()) ```
--- stage: Create group: Code Creation info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments description: Troubleshooting tips for common problems in Code Suggestions. title: Troubleshooting Code Suggestions breadcrumbs: - doc - user - project - repository - code_suggestions --- {{< details >}} - Tier: Premium, Ultimate - Add-on: GitLab Duo Core, Pro, or Enterprise, GitLab Duo with Amazon Q - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} {{< history >}} - Changed to require GitLab Duo add-on in GitLab 17.6 and later. - Changed to include GitLab Duo Core in GitLab 18.0. {{< /history >}} When working with GitLab Duo Code Suggestions, you might encounter the following issues. You can run a [health check](../../../gitlab_duo/turn_on_off.md) to test if your instance meets the requirements to run Code Suggestions. For more information on troubleshooting GitLab Duo, see: - [Troubleshooting GitLab Duo](../../../gitlab_duo/troubleshooting.md). - [GitLab Duo Chat troubleshooting](../../../gitlab_duo_chat/troubleshooting.md). - [Troubleshooting GitLab Duo Self-Hosted](../../../../administration/gitlab_duo_self_hosted/troubleshooting.md). ## Suggestions are not displayed If suggestions are not displayed, ensure that you: - Have [configured GitLab Duo correctly](../../../gitlab_duo/turn_on_off.md). - Are using a [supported language](supported_extensions.md#supported-languages-by-ide) and [editor extension](supported_extensions.md#supported-editor-extensions). - Have [configured your editor extension correctly](set_up.md#configure-editor-extension). If suggestions are still not displayed, try the following troubleshooting steps for the different IDEs: - [VS Code or GitLab Web IDE](#suggestions-not-displayed-in-vs-code-or-gitlab-web-ide) - [JetBrains IDEs](#suggestions-not-displayed-in-jetbrains-ides) - [Microsoft Visual Studio](#suggestions-not-displayed-in-microsoft-visual-studio) ## Code Suggestions returns a 401 error Code Suggestions [depends on a license token](../../../gitlab_duo/_index.md) that [synchronizes your subscription](../../../../administration/license.md) with GitLab. If the token expires, GitLab Duo Code Suggestions returns the following error with status `401` when the token has expired: ```plaintext Token validation failed in Language Server: (Failed to check token: Error: Fetching Information about personal access token ``` If GitLab has access to the [cloud server](../../../gitlab_duo/_index.md), try [manually synchronizing your license](../../../../subscriptions/manage_subscription.md#manually-synchronize-subscription-data). ## Authentication troubleshooting The problem might be driven to the recent changes in authentication, specifically the token system. To resolve the issue: 1. Remove the existing personal access token from your GitLab account settings. 1. Reauthorize your GitLab account using OAuth. 1. Test the Code Suggestions feature with different file extensions to verify if the issue is resolved. ## VS Code troubleshooting The following documentation is for Code Suggestions-specific troubleshooting for VS Code. For non-Code Suggestions troubleshooting for VS Code, see [Troubleshooting the GitLab Workflow extension for VS Code](../../../../editor_extensions/visual_studio_code/troubleshooting.md). ### Suggestions not displayed in VS Code or GitLab Web IDE If you are on GitLab Self-Managed, ensure that Code Suggestions for the [GitLab Web IDE](../../web_ide/_index.md) is enabled. The same settings apply to VS Code as local IDE. 1. On the left sidebar, select **Extensions > GitLab Workflow**. 1. Select **Settings** ({{< icon name="settings" >}}), and then select **Extension Settings**. 1. In **GitLab > Duo Code Suggestions**, select the **GitLab Duo Code Suggestions** checkbox. #### View Code Suggestions logs If Code Suggestions are enabled for the IDE, but suggestions are still not displayed: 1. In your IDE, in the GitLab Workflow **Extension Settings**, enable **GitLab: Debug**. - For Web IDE, you must have the [marketplace extensions](../../web_ide/_index.md#manage-extensions) enabled. 1. On the top menu, select **View > Output** to open the bottom panel, then either: - In the command palette, select `GitLab: Show Extension Logs`. - In the bottom panel, on the right, select the dropdown list to filter the logs. Select **GitLab Workflow**. 1. In the GitLab Workflow **Extension Settings**, clear and re-select the **GitLab Duo Code Suggestions** checkbox. ### Disable streaming of code generation results By default, code generation streams AI-generated code. Streaming sends generated code to your editor incrementally, rather than waiting for the full code snippet to generate. This allows for a more interactive and responsive experience. If you prefer to see code generation results only when they are complete, you can turn off streaming. Disabling streaming means that code generation requests might be perceived as taking longer to resolve. To disable streaming: 1. In VS Code, on the top bar, go to **Code > Settings > Settings**. 1. On the top right corner, select **Open Settings (JSON)** to edit your `settings.json` file: ![The icons on the top right corner of VS Code, including 'Open Settings.'](img/open_settings_v17_5.png) 1. In your `settings.json` file, add this line, or set it to `false` it already exists: ```json "gitlab.featureFlags.streamCodeGenerations": false, ``` 1. Save your changes. ### Error: Direct connection fails {{< history >}} - Direct connection [introduced](https://gitlab.com/groups/gitlab-org/-/epics/13252) in GitLab 17.2. {{< /history >}} To reduce latency, the Workflow extension tries to send suggestion completion requests directly to GitLab Cloud Connector, bypassing the GitLab instance. This network connection does not use the proxy and certificate settings of the VS Code extension. If your GitLab instance doesn't support direct connections, or your network prevents the extension from connecting to GitLab Cloud Connector, you might see these warnings in your logs: ```plaintext Failed to fetch direct connection details from GitLab instance. Code suggestion requests will be sent to GitLab instance. ``` This error means your instance either doesn't support direct connections, or is misconfigured. If you see this error, the extension can't connect to GitLab Cloud Connector, and is reverting to use your GitLab instance: ```plaintext Direct connection for code suggestions failed. Code suggestion requests will be sent to your GitLab instance. ``` The indirect connection through your GitLab instance is about 100 ms slower, but otherwise works the same. This issue is often caused by network connection problems, like with your LAN firewall or proxy settings. ## JetBrains IDEs troubleshooting The following documentation is for Code Suggestions-specific troubleshooting for JetBrains IDEs. For non-Code Suggestions troubleshooting for JetBrains IDEs, see [JetBrains troubleshooting](../../../../editor_extensions/jetbrains_ide/jetbrains_troubleshooting.md). ### Suggestions not displayed in JetBrains IDEs 1. From the **Tools > GitLab Duo** menu, select **Verify setup**. Make sure the health check passes. 1. Verify that your JetBrains IDE natively supports the language of the file you are working on. Go to **Settings** > **Languages & Frameworks** to see the full list of languages and frameworks supported by your JetBrains IDE. ### Error: `unable to find valid certification path to requested target` The GitLab Duo plugin verifies TLS certificate information before connecting to your GitLab instance. You can [add a custom SSL certificate](set_up.md#add-a-custom-certificate-for-code-suggestions). ### Error: `Failed to check token` This error occurs when the provided connection instance URL and authentication token passed through to the GitLab Language Server process are invalid. To re-enable Code Suggestions: 1. In your IDE, on the top bar, select your IDE name, then select **Settings**. 1. On the left sidebar, select **Tools > GitLab Duo**. 1. Under **Connection**, select **Verify setup**. 1. Update your **Connection** details as needed. 1. Select **Verify setup**, and confirm that authentication succeeds. 1. Select **OK** or **Save**. ## Microsoft Visual Studio troubleshooting The following documentation is for Code Suggestions-specific troubleshooting for Microsoft Visual Studio. For non-Code Suggestions troubleshooting for Microsoft Visual Studio, see [Visual Studio troubleshooting](../../../../editor_extensions/visual_studio/visual_studio_troubleshooting.md). ### IntelliCode is missing Code Suggestions requires the IntelliCode component of Visual Studio. If the component is missing, you might see an error like this when you start Visual Studio: ```plaintext SetSite failed for package [VisualStudioPackage]Source: 'Microsoft.VisualStudio.Composition' Description: Expected 1 export(s) with contract name "Microsoft.VisualStudio.Language.Suggestions.SuggestionServiceBase" but found 0 after applying applicable constraints. Microsoft.VisualStudio.Composition.CompositionFailedException: Expected 1 export(s) with contract name "Microsoft.VisualStudio.Language.Suggestions.SuggestionServiceBase" but found 0 after applying applicable constraints. at Microsoft.VisualStudio.Composition.ExportProvider.GetExports(ImportDefinition importDefinition) at Microsoft.VisualStudio.Composition.ExportProvider.GetExports[T,TMetadataView](String contractName, ImportCardinality cardinality) at Microsoft.VisualStudio.Composition.ExportProvider.GetExport[T,TMetadataView](String contractName) at Microsoft.VisualStudio.Composition.ExportProvider.GetExportedValue[T]() at Microsoft.VisualStudio.ComponentModelHost.ComponentModel.GetService[T]() [...] ``` To fix this problem, install the IntelliCode component: 1. In the Windows start menu, search for the **Visual Studio Installer** and open it. 1. Select your Visual Studio instance, then select **Modify**. 1. In the **Individual components** tab, search for **IntelliCode**. 1. Select the component's checkbox, then on the bottom right, select **Modify**. 1. Wait for the Visual Studio Installer to finish the installation. ### Suggestions not displayed in Microsoft Visual Studio 1. Ensure you have properly [set up the extension](https://gitlab.com/gitlab-org/editor-extensions/gitlab-visual-studio-extension#setup). 1. From the **Tools > Options** menu, find the **GitLab** option. Ensure **Log Level** is set to **Debug**. 1. In **View > Output**, open the extension log. Change the dropdown list to **GitLab Extension** as the log filter. 1. Verify that the debug log contains similar output: ```shell 14:48:21:344 GitlabProposalSource.GetCodeSuggestionAsync 14:48:21:344 LsClient.SendTextDocumentCompletionAsync("GitLab.Extension.Test\TestData.cs", 34, 0) 14:48:21:346 LS(55096): time="2023-07-17T14:48:21-05:00" level=info msg="update context" ``` If another extension provides similar suggestion or completion features, the extension might not return suggestions. To resolve this: 1. Disable all other Visual Studio extensions. 1. Confirm that you now receive Code Suggestions. 1. Re-enable extensions one at a time, testing for Code Suggestions each time, to find the extension that conflicts. ## Neovim troubleshooting The following documentation is for Code Suggestions-specific troubleshooting for Neovim. For non-Code Suggestions troubleshooting for Neovim, see [Neovim troubleshooting](../../../../editor_extensions/neovim/neovim_troubleshooting.md). ### Code completions fails 1. Confirm `omnifunc` is set in Neovim: ```lua :verbose set omnifunc? ``` 1. Confirm the Language Server is active by running this command in Neovim: ```lua :lua =vim.lsp.get_active_clients() ``` 1. Check the logs for the Language Server in `~/.local/state/nvim/lsp.log`. 1. Inspect the `vim.lsp` log path for errors by running this command in Neovim: ```lua :lua =vim.cmd('view ' .. vim.lsp.get_log_path()) ```
https://docs.gitlab.com/user/project/repository/signed_commits
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/repository/_index.md
2025-08-13
doc/user/project/repository/signed_commits
[ "doc", "user", "project", "repository", "signed_commits" ]
_index.md
Create
Source Code
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Signed commits
Why you should sign your GitLab commits cryptographically, and how to verify signed commits.
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} When you add a digital signature to your commit, you provide extra assurance that a commit originated from you, rather than an impersonator. A digital signature is a cryptographic output used to verify authenticity. It's important to understand the difference between signed and verified commits: - Signed commits have a cryptographic signature attached that proves the commit's integrity and authenticity. The signature is created using a private key. - Verified commits have signatures that GitLab can validate against a known public key stored in a user's GitLab profile. If GitLab can verify the committer's identity with a public key, the commit is marked **Verified** in the GitLab UI. {{< alert type="note" >}} The committer and author fields are distinct in Git. The author writes the commit, and the committer applies it. Commit signing verifies only the committer's identity. {{< /alert >}} GitLab supports the following commit signing methods: - [SSH key](ssh.md) - [GPG key](gpg.md) - [Personal X.509 certificate](x509.md) ## Verify commits To review commits for a merge request, or for an entire project, and verify they are signed: 1. On the left sidebar, select **Search or go to** and find your project. 1. To review commits: - For a project, select **Code > Commits**. - For a merge request: 1. Select **Code > Merge requests**, then select your merge request. 1. Select **Commits**. 1. Identify the commit you want to review. Depending on the verification status of the signature, signed commits display either a **Verified** or **Unverified** badge. ![A list of commits with verified and unverified badges.](img/project_signed_and_unsigned_commits_v17_4.png) Unsigned commits do not display a badge. 1. To display the signature details for a commit, select **Verified** or **Unverified** to see the fingerprint or key ID: ![Verified signature details for a commit.](img/project_signed_commit_verified_signature_v17_4.png) ![Unverified signature details for a commit.](img/project_signed_commit_unverified_signature_v17_4.png) You can also [use the Commits API](../../../../api/commits.md#get-signature-of-a-commit) to check a commit's signature. ### Verify web UI commits GitLab uses SSH to sign commits created through the web UI. To verify these commits locally, obtain the GitLab public key for signing web commits using the [Web Commits API](../../../../api/web_commits.md#get-public-signing-key). ### Use `gitmailmap` with verified commits {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/425042) in GitLab 17.5 [with a flag](../../../../administration/feature_flags/_index.md) named `check_for_mailmapped_commit_emails`. Disabled by default. {{< /history >}} {{< alert type="flag" >}} The availability of this feature is controlled by a feature flag. For more information, see the history. {{< /alert >}} The [`gitmailmap`](https://git-scm.com/docs/gitmailmap) feature allows users to map author names and email addresses. GitLab uses these email addresses to provide links to the commit author. When using a `mailmap` author mapping, it's possible to have a verified commit with an unverified author email. For SSH and UI signatures with `mailmap` author mappings, GitLab displays an orange verified label with a warning sign. To restore the green verified label, verify the mapped email address, or remove the `mailmap` entry. ## Enforce signed commits with push rules You can require signed commits across your projects using push rules. The **Reject unsigned commits** push rule prevents any unsigned commits from being pushed to a repository, helping organizations maintain code integrity and meet compliance requirements. For more information about how this rule works and its limitations, see [Require signed commits](../push_rules.md#require-signed-commits). ## Troubleshooting ### Fix verification problems with signed commits The verification process for commits signed with GPG keys or X.509 certificates can fail for multiple reasons: | Value | Description | Possible Fixes | |-----------------------------|-------------|----------------| | `UNVERIFIED` | The commit signature is not valid. | Sign the commit with a valid signature. | | `SAME_USER_DIFFERENT_EMAIL` | The GPG key used to sign the commit does not contain the committer email, but does contain a different valid email for the committer. | Amend the commit to use an email address that matches the GPG key, or update the GPG key [to include the email address](https://security.stackexchange.com/a/261468). | | `OTHER_USER` | The signature and GPG key are valid, but the key belongs to a different user than the committer. | Amend the commit to use the correct email address, or amend the commit to use a GPG key associated with your user. | | `UNVERIFIED_KEY` | The key associated with the GPG signature has no verified email address associated with the committer. | Add and verify the email to your GitLab profile, [update the GPG key to include the email address](https://security.stackexchange.com/a/261468), or amend the commit to use a different committer email address. | | `UNKNOWN_KEY` | The GPG key associated with the GPG signature for this commit is unknown to GitLab. | [Add the GPG key](gpg.md#add-a-gpg-key-to-your-account) to your GitLab profile. | | `MULTIPLE_SIGNATURES` | Multiple GPG or X.509 signatures have been found for the commit. | Amend the commit to use only one GPG or X.509 signature. |
--- stage: Create group: Source Code info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments description: Why you should sign your GitLab commits cryptographically, and how to verify signed commits. title: Signed commits breadcrumbs: - doc - user - project - repository - signed_commits --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} When you add a digital signature to your commit, you provide extra assurance that a commit originated from you, rather than an impersonator. A digital signature is a cryptographic output used to verify authenticity. It's important to understand the difference between signed and verified commits: - Signed commits have a cryptographic signature attached that proves the commit's integrity and authenticity. The signature is created using a private key. - Verified commits have signatures that GitLab can validate against a known public key stored in a user's GitLab profile. If GitLab can verify the committer's identity with a public key, the commit is marked **Verified** in the GitLab UI. {{< alert type="note" >}} The committer and author fields are distinct in Git. The author writes the commit, and the committer applies it. Commit signing verifies only the committer's identity. {{< /alert >}} GitLab supports the following commit signing methods: - [SSH key](ssh.md) - [GPG key](gpg.md) - [Personal X.509 certificate](x509.md) ## Verify commits To review commits for a merge request, or for an entire project, and verify they are signed: 1. On the left sidebar, select **Search or go to** and find your project. 1. To review commits: - For a project, select **Code > Commits**. - For a merge request: 1. Select **Code > Merge requests**, then select your merge request. 1. Select **Commits**. 1. Identify the commit you want to review. Depending on the verification status of the signature, signed commits display either a **Verified** or **Unverified** badge. ![A list of commits with verified and unverified badges.](img/project_signed_and_unsigned_commits_v17_4.png) Unsigned commits do not display a badge. 1. To display the signature details for a commit, select **Verified** or **Unverified** to see the fingerprint or key ID: ![Verified signature details for a commit.](img/project_signed_commit_verified_signature_v17_4.png) ![Unverified signature details for a commit.](img/project_signed_commit_unverified_signature_v17_4.png) You can also [use the Commits API](../../../../api/commits.md#get-signature-of-a-commit) to check a commit's signature. ### Verify web UI commits GitLab uses SSH to sign commits created through the web UI. To verify these commits locally, obtain the GitLab public key for signing web commits using the [Web Commits API](../../../../api/web_commits.md#get-public-signing-key). ### Use `gitmailmap` with verified commits {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/425042) in GitLab 17.5 [with a flag](../../../../administration/feature_flags/_index.md) named `check_for_mailmapped_commit_emails`. Disabled by default. {{< /history >}} {{< alert type="flag" >}} The availability of this feature is controlled by a feature flag. For more information, see the history. {{< /alert >}} The [`gitmailmap`](https://git-scm.com/docs/gitmailmap) feature allows users to map author names and email addresses. GitLab uses these email addresses to provide links to the commit author. When using a `mailmap` author mapping, it's possible to have a verified commit with an unverified author email. For SSH and UI signatures with `mailmap` author mappings, GitLab displays an orange verified label with a warning sign. To restore the green verified label, verify the mapped email address, or remove the `mailmap` entry. ## Enforce signed commits with push rules You can require signed commits across your projects using push rules. The **Reject unsigned commits** push rule prevents any unsigned commits from being pushed to a repository, helping organizations maintain code integrity and meet compliance requirements. For more information about how this rule works and its limitations, see [Require signed commits](../push_rules.md#require-signed-commits). ## Troubleshooting ### Fix verification problems with signed commits The verification process for commits signed with GPG keys or X.509 certificates can fail for multiple reasons: | Value | Description | Possible Fixes | |-----------------------------|-------------|----------------| | `UNVERIFIED` | The commit signature is not valid. | Sign the commit with a valid signature. | | `SAME_USER_DIFFERENT_EMAIL` | The GPG key used to sign the commit does not contain the committer email, but does contain a different valid email for the committer. | Amend the commit to use an email address that matches the GPG key, or update the GPG key [to include the email address](https://security.stackexchange.com/a/261468). | | `OTHER_USER` | The signature and GPG key are valid, but the key belongs to a different user than the committer. | Amend the commit to use the correct email address, or amend the commit to use a GPG key associated with your user. | | `UNVERIFIED_KEY` | The key associated with the GPG signature has no verified email address associated with the committer. | Add and verify the email to your GitLab profile, [update the GPG key to include the email address](https://security.stackexchange.com/a/261468), or amend the commit to use a different committer email address. | | `UNKNOWN_KEY` | The GPG key associated with the GPG signature for this commit is unknown to GitLab. | [Add the GPG key](gpg.md#add-a-gpg-key-to-your-account) to your GitLab profile. | | `MULTIPLE_SIGNATURES` | Multiple GPG or X.509 signatures have been found for the commit. | Amend the commit to use only one GPG or X.509 signature. |
https://docs.gitlab.com/user/project/repository/ssh
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/repository/ssh.md
2025-08-13
doc/user/project/repository/signed_commits
[ "doc", "user", "project", "repository", "signed_commits" ]
ssh.md
Create
Source Code
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Sign commits with SSH keys
Sign commits in your GitLab repository with SSH keys.
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} When you sign commits with SSH keys, GitLab uses the SSH public keys associated with your GitLab account to cryptographically verify the commit signature. If successful, GitLab displays a **Verified** label on the commit. You may use the same SSH keys for `git+ssh` authentication to GitLab and signing commit signatures as long as their usage type is **Authentication & Signing**. It can be verified on the page for [adding an SSH key to your GitLab account](../../../ssh.md#add-an-ssh-key-to-your-gitlab-account). For more information about managing the SSH keys associated with your GitLab account, see [Use SSH keys to communicate with GitLab](../../../ssh.md). ## Configure Git to sign commits with your SSH key After you [create an SSH key](../../../ssh.md#generate-an-ssh-key-pair) and [add it to your GitLab account](../../../ssh.md#add-an-ssh-key-to-your-gitlab-account) configure Git to begin using the key. Prerequisites: - Git 2.34.0 or later. - OpenSSH 8.1 or later. {{< alert type="note" >}} OpenSSH 8.7 has broken signing functionality. If you are on OpenSSH 8.7, upgrade to OpenSSH 8.8. {{< /alert >}} - An SSH key with the **Usage type** `Authentication & Signing` or `Signing`. The following SSH key types are supported: - ED25519 - RSA - ECDSA To configure Git to use your key: 1. Configure Git to use SSH for commit signing: ```shell git config --global gpg.format ssh ``` 1. Specify which public SSH key to use as the signing key and change the filename (`~/.ssh/examplekey.pub`) to the location of your key. The filename might differ, depending on how you generated your key: ```shell git config --global user.signingkey ~/.ssh/examplekey.pub ``` ## Sign commits with your SSH key Prerequisites: - You've [created an SSH key](../../../ssh.md#generate-an-ssh-key-pair). - You've [added the key](../../../ssh.md#add-an-ssh-key-to-your-gitlab-account) to your GitLab account. - You've [configured Git to sign commits](#configure-git-to-sign-commits-with-your-ssh-key) with your SSH key. To sign a commit: 1. Use the `-S` flag when signing your commits: ```shell git commit -S -m "My commit msg" ``` 1. Optional. If you don't want to type the `-S` flag every time you commit, tell Git to sign your commits automatically: ```shell git config --global commit.gpgsign true ``` 1. If your SSH key is protected, Git prompts you to enter your passphrase. 1. Push to GitLab. 1. Check that your commits [are verified](#verify-commits). Signature verification uses the `allowed_signers` file to associate emails and SSH keys. For help configuring this file, read [Verify commits locally](#verify-commits-locally). ## Verify commits You can verify all types of signed commits [in the GitLab UI](_index.md#verify-commits). Commits signed with an SSH key can also be verified locally. ### Verify commits locally To verify commits locally, create an [allowed signers file](https://man7.org/linux/man-pages/man1/ssh-keygen.1.html#ALLOWED_SIGNERS) for Git to associate SSH public keys with users: 1. Create an allowed signers file: ```shell touch allowed_signers ``` 1. Configure the `allowed_signers` file in Git: ```shell git config gpg.ssh.allowedSignersFile "$(pwd)/allowed_signers" ``` 1. Add your entry to the allowed signers file. Use this command to add your email address and public SSH key to the `allowed_signers` file. Replace `<MY_KEY>` with the name of your key, and `~/.ssh/allowed_signers` with the location of your project's `allowed_signers` file: ```shell # Modify this line to meet your needs. # Declaring the `git` namespace helps prevent cross-protocol attacks. echo "$(git config --get user.email) namespaces=\"git\" $(cat ~/.ssh/<MY_KEY>.pub)" >> ~/.ssh/allowed_signers ``` The resulting entry in the `allowed_signers` file contains your email address, key type, and key contents, like this: ```plaintext example@gitlab.com namespaces="git" ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAmaTS47vRmsKyLyK1jlIFJn/i8wdGQ3J49LYyIYJ2hv ``` 1. Repeat the previous step for each user who you want to verify signatures for. Consider checking this file in to your Git repository if you want to locally verify signatures for many different contributors. 1. Use `git log --show-signature` to view the signature status for the commits: ```shell $ git log --show-signature commit e2406b6cd8ebe146835ceab67ff4a5a116e09154 (HEAD -> main, origin/main, origin/HEAD) Good "git" signature for johndoe@example.com with ED25519 key SHA256:Ar44iySGgxic+U6Dph4Z9Rp+KDaix5SFGFawovZLAcc Author: John Doe <johndoe@example.com> Date: Tue Nov 29 06:54:15 2022 -0600 SSH signed commit ``` ## Signed commits with removed SSH keys You can revoke or delete your SSH keys used to sign commits. For more information see [Remove an SSH key](../../../ssh.md#remove-an-ssh-key). Removing your SSH key can impact any commits signed with the key: - Revoking your SSH key marks your previous commits as **Unverified**. Until you add a new SSH key, any new commits are also marked as **Unverified**. - Deleting your SSH key doesn't impact your previous commits. Until you add a new SSH key, any new commits are marked as **Unverified**. ## Related topics - [Sign commits and tags with X.509 certificates](x509.md) - [Sign commits with GPG](gpg.md) - [Commits API](../../../../api/commits.md)
--- stage: Create group: Source Code info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments description: Sign commits in your GitLab repository with SSH keys. title: Sign commits with SSH keys breadcrumbs: - doc - user - project - repository - signed_commits --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} When you sign commits with SSH keys, GitLab uses the SSH public keys associated with your GitLab account to cryptographically verify the commit signature. If successful, GitLab displays a **Verified** label on the commit. You may use the same SSH keys for `git+ssh` authentication to GitLab and signing commit signatures as long as their usage type is **Authentication & Signing**. It can be verified on the page for [adding an SSH key to your GitLab account](../../../ssh.md#add-an-ssh-key-to-your-gitlab-account). For more information about managing the SSH keys associated with your GitLab account, see [Use SSH keys to communicate with GitLab](../../../ssh.md). ## Configure Git to sign commits with your SSH key After you [create an SSH key](../../../ssh.md#generate-an-ssh-key-pair) and [add it to your GitLab account](../../../ssh.md#add-an-ssh-key-to-your-gitlab-account) configure Git to begin using the key. Prerequisites: - Git 2.34.0 or later. - OpenSSH 8.1 or later. {{< alert type="note" >}} OpenSSH 8.7 has broken signing functionality. If you are on OpenSSH 8.7, upgrade to OpenSSH 8.8. {{< /alert >}} - An SSH key with the **Usage type** `Authentication & Signing` or `Signing`. The following SSH key types are supported: - ED25519 - RSA - ECDSA To configure Git to use your key: 1. Configure Git to use SSH for commit signing: ```shell git config --global gpg.format ssh ``` 1. Specify which public SSH key to use as the signing key and change the filename (`~/.ssh/examplekey.pub`) to the location of your key. The filename might differ, depending on how you generated your key: ```shell git config --global user.signingkey ~/.ssh/examplekey.pub ``` ## Sign commits with your SSH key Prerequisites: - You've [created an SSH key](../../../ssh.md#generate-an-ssh-key-pair). - You've [added the key](../../../ssh.md#add-an-ssh-key-to-your-gitlab-account) to your GitLab account. - You've [configured Git to sign commits](#configure-git-to-sign-commits-with-your-ssh-key) with your SSH key. To sign a commit: 1. Use the `-S` flag when signing your commits: ```shell git commit -S -m "My commit msg" ``` 1. Optional. If you don't want to type the `-S` flag every time you commit, tell Git to sign your commits automatically: ```shell git config --global commit.gpgsign true ``` 1. If your SSH key is protected, Git prompts you to enter your passphrase. 1. Push to GitLab. 1. Check that your commits [are verified](#verify-commits). Signature verification uses the `allowed_signers` file to associate emails and SSH keys. For help configuring this file, read [Verify commits locally](#verify-commits-locally). ## Verify commits You can verify all types of signed commits [in the GitLab UI](_index.md#verify-commits). Commits signed with an SSH key can also be verified locally. ### Verify commits locally To verify commits locally, create an [allowed signers file](https://man7.org/linux/man-pages/man1/ssh-keygen.1.html#ALLOWED_SIGNERS) for Git to associate SSH public keys with users: 1. Create an allowed signers file: ```shell touch allowed_signers ``` 1. Configure the `allowed_signers` file in Git: ```shell git config gpg.ssh.allowedSignersFile "$(pwd)/allowed_signers" ``` 1. Add your entry to the allowed signers file. Use this command to add your email address and public SSH key to the `allowed_signers` file. Replace `<MY_KEY>` with the name of your key, and `~/.ssh/allowed_signers` with the location of your project's `allowed_signers` file: ```shell # Modify this line to meet your needs. # Declaring the `git` namespace helps prevent cross-protocol attacks. echo "$(git config --get user.email) namespaces=\"git\" $(cat ~/.ssh/<MY_KEY>.pub)" >> ~/.ssh/allowed_signers ``` The resulting entry in the `allowed_signers` file contains your email address, key type, and key contents, like this: ```plaintext example@gitlab.com namespaces="git" ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAmaTS47vRmsKyLyK1jlIFJn/i8wdGQ3J49LYyIYJ2hv ``` 1. Repeat the previous step for each user who you want to verify signatures for. Consider checking this file in to your Git repository if you want to locally verify signatures for many different contributors. 1. Use `git log --show-signature` to view the signature status for the commits: ```shell $ git log --show-signature commit e2406b6cd8ebe146835ceab67ff4a5a116e09154 (HEAD -> main, origin/main, origin/HEAD) Good "git" signature for johndoe@example.com with ED25519 key SHA256:Ar44iySGgxic+U6Dph4Z9Rp+KDaix5SFGFawovZLAcc Author: John Doe <johndoe@example.com> Date: Tue Nov 29 06:54:15 2022 -0600 SSH signed commit ``` ## Signed commits with removed SSH keys You can revoke or delete your SSH keys used to sign commits. For more information see [Remove an SSH key](../../../ssh.md#remove-an-ssh-key). Removing your SSH key can impact any commits signed with the key: - Revoking your SSH key marks your previous commits as **Unverified**. Until you add a new SSH key, any new commits are also marked as **Unverified**. - Deleting your SSH key doesn't impact your previous commits. Until you add a new SSH key, any new commits are marked as **Unverified**. ## Related topics - [Sign commits and tags with X.509 certificates](x509.md) - [Sign commits with GPG](gpg.md) - [Commits API](../../../../api/commits.md)
https://docs.gitlab.com/user/project/repository/web_commits
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/repository/web_commits.md
2025-08-13
doc/user/project/repository/signed_commits
[ "doc", "user", "project", "repository", "signed_commits" ]
web_commits.md
Create
Source Code
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Signed commits from the GitLab UI
null
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab Self-Managed, GitLab Dedicated {{< /details >}} {{< history >}} - Displaying **Verified** badge for signed GitLab UI commits [introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/124218) in GitLab 16.3 [with a flag](../../../../administration/feature_flags/_index.md) named `gitaly_gpg_signing`. Disabled by default. - Verifying the signatures using multiple keys specified in `rotated_signing_keys` option [introduced](https://gitlab.com/gitlab-org/gitaly/-/merge_requests/6163) in GitLab 16.3. - `gitaly_gpg_signing` feature flag [enabled by default](https://gitlab.com/gitlab-org/gitaly/-/merge_requests/6876) on GitLab Self-Managed and GitLab Dedicated in GitLab 17.0. {{< /history >}} {{< alert type="flag" >}} The availability of this feature is controlled by a feature flag. For more information, see the history. This feature is available for testing, but not ready for production use. {{< /alert >}} When you create a commit using the GitLab user interface, the commit is not pushed directly by you. Instead, the commit is created on your behalf. To sign these commits, GitLab uses a global key configured for the instance. Because GitLab doesn't have access to your private key, the created commit can't be signed by using the key associated with your account. For example, if User A applies [suggestions](../../merge_requests/reviews/suggestions.md) authored by User B, the commit contains the following: ```plaintext Author: User A <a@example.com> Committer: GitLab <noreply@gitlab.com> Co-authored-by: User B <b@example.com> ``` ## Prerequisites Before you can use commit signing for GitLab UI commits, you must [configure it](../../../../administration/gitaly/configure_gitaly.md#configure-commit-signing-for-gitlab-ui-commits). ## Committer field of the commits In Git, commits have both an author and a committer. For web commits, the `Committer` field is configurable. To update this field, see [Configure commit signing for GitLab UI commits](../../../../administration/gitaly/configure_gitaly.md#configure-commit-signing-for-gitlab-ui-commits). GitLab provides multiple security features that rely on the `Committer` field to be set to the user who creates the commit. For example: - [Push rules](../push_rules.md): (`Reject unverified users` or `Commit author's email`). - [Merge request approval prevention](../../merge_requests/approvals/settings.md#prevent-approvals-by-users-who-add-commits). When a commit is signed by the instance, GitLab relies on the `Author` field for those features. ## Commits created using REST API [Commits created using the REST API](../../../../api/commits.md#create-a-commit-with-multiple-files-and-actions). are also considered as web-based commits. Using the REST API endpoint, you can set `author_name` and `author_email` fields of the commit, which makes it possible to create commits on behalf of other users. When commit signing is enabled, commits created using the REST API that have different `author_name` and `author_email` than the user who sends the API request are rejected. ## Troubleshooting ### Web commits become unsigned after rebase Previously-signed commits in a branch become unsigned when: - Commit signing is configured for commits created from the GitLab UI. - The merge request is rebased from the GitLab UI. This happens because the previous commits are modified, and added on top of the target branch. GitLab can't sign these commits. To work around this problem, rebase the branch locally, and push the changes back up to GitLab.
--- stage: Create group: Source Code info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments title: Signed commits from the GitLab UI breadcrumbs: - doc - user - project - repository - signed_commits --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab Self-Managed, GitLab Dedicated {{< /details >}} {{< history >}} - Displaying **Verified** badge for signed GitLab UI commits [introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/124218) in GitLab 16.3 [with a flag](../../../../administration/feature_flags/_index.md) named `gitaly_gpg_signing`. Disabled by default. - Verifying the signatures using multiple keys specified in `rotated_signing_keys` option [introduced](https://gitlab.com/gitlab-org/gitaly/-/merge_requests/6163) in GitLab 16.3. - `gitaly_gpg_signing` feature flag [enabled by default](https://gitlab.com/gitlab-org/gitaly/-/merge_requests/6876) on GitLab Self-Managed and GitLab Dedicated in GitLab 17.0. {{< /history >}} {{< alert type="flag" >}} The availability of this feature is controlled by a feature flag. For more information, see the history. This feature is available for testing, but not ready for production use. {{< /alert >}} When you create a commit using the GitLab user interface, the commit is not pushed directly by you. Instead, the commit is created on your behalf. To sign these commits, GitLab uses a global key configured for the instance. Because GitLab doesn't have access to your private key, the created commit can't be signed by using the key associated with your account. For example, if User A applies [suggestions](../../merge_requests/reviews/suggestions.md) authored by User B, the commit contains the following: ```plaintext Author: User A <a@example.com> Committer: GitLab <noreply@gitlab.com> Co-authored-by: User B <b@example.com> ``` ## Prerequisites Before you can use commit signing for GitLab UI commits, you must [configure it](../../../../administration/gitaly/configure_gitaly.md#configure-commit-signing-for-gitlab-ui-commits). ## Committer field of the commits In Git, commits have both an author and a committer. For web commits, the `Committer` field is configurable. To update this field, see [Configure commit signing for GitLab UI commits](../../../../administration/gitaly/configure_gitaly.md#configure-commit-signing-for-gitlab-ui-commits). GitLab provides multiple security features that rely on the `Committer` field to be set to the user who creates the commit. For example: - [Push rules](../push_rules.md): (`Reject unverified users` or `Commit author's email`). - [Merge request approval prevention](../../merge_requests/approvals/settings.md#prevent-approvals-by-users-who-add-commits). When a commit is signed by the instance, GitLab relies on the `Author` field for those features. ## Commits created using REST API [Commits created using the REST API](../../../../api/commits.md#create-a-commit-with-multiple-files-and-actions). are also considered as web-based commits. Using the REST API endpoint, you can set `author_name` and `author_email` fields of the commit, which makes it possible to create commits on behalf of other users. When commit signing is enabled, commits created using the REST API that have different `author_name` and `author_email` than the user who sends the API request are rejected. ## Troubleshooting ### Web commits become unsigned after rebase Previously-signed commits in a branch become unsigned when: - Commit signing is configured for commits created from the GitLab UI. - The merge request is rebased from the GitLab UI. This happens because the previous commits are modified, and added on top of the target branch. GitLab can't sign these commits. To work around this problem, rebase the branch locally, and push the changes back up to GitLab.
https://docs.gitlab.com/user/project/repository/x509
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/repository/x509.md
2025-08-13
doc/user/project/repository/signed_commits
[ "doc", "user", "project", "repository", "signed_commits" ]
x509.md
Create
Source Code
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Sign commits and tags with X.509 certificates
Sign commits and tags in your GitLab repository with X.509 certificates.
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab Self-Managed, GitLab Dedicated {{< /details >}} [X.509](https://en.wikipedia.org/wiki/X.509) is a standard format for public key certificates issued by a public or private Public Key Infrastructure (PKI). Personal X.509 certificates are used for authentication or signing purposes such as S/MIME (Secure/Multipurpose Internet Mail Extensions). However, Git also supports signing of commits and tags with X.509 certificates in a similar way as with [GPG (GnuPG, or GNU Privacy Guard)](gpg.md). The main difference is the way GitLab determines whether or not the developer's signature is trusted: - For X.509, a root certificate authority is added to the GitLab trust store. (A trust store is a repository of trusted security certificates.) Combined with any required intermediate certificates in the signature, the developer's certificate can be chained back to a trusted root certificate. - For GPG, developers [add their GPG key](gpg.md#add-a-gpg-key-to-your-account) to their account. GitLab uses its own certificate store and therefore defines the [trust chain](https://www.ssl.com/article/what-is-a-certificate-authority-ca/). For a commit or tag to be verified by GitLab: - The signing certificate email must match a verified email address in GitLab. - The GitLab instance requires a full trust chain from the certificate in the signature to a trusted certificate in the GitLab certificate store. This chain may include intermediate certificates supplied in the signature. You may need to add certificates, such as Certificate Authority root certificates, [to the GitLab certificate store](https://docs.gitlab.com/omnibus/settings/ssl/#install-custom-public-certificates). - The signing time must be in the time range of the [certificate validity](https://www.rfc-editor.org/rfc/rfc5280.html#section-4.1.2.5), which is usually up to three years. - The signing time is equal to, or later than, the commit time. {{< alert type="note" >}} If a Root CA or intermediate certificate in the trust chain expires and is renewed, commits may temporarily show as "unverified" until you [re-verify them](#re-verify-commits). {{< /alert >}} If a commit's status has already been determined and stored in the database, use the Rake task [to re-check the status](../../../../administration/raketasks/x509_signatures.md). Refer to the [Troubleshooting section](#troubleshooting). GitLab checks certificate revocation lists on a daily basis with a background worker. ## Known issues - Certificates without `authorityKeyIdentifier`, `subjectKeyIdentifier`, and `crlDistributionPoints` display as **Unverified**. We recommend using certificates from a PKI that are in line with [RFC 5280](https://www.rfc-editor.org/rfc/rfc5280). - The **Verified** badge is not displayed on the GitLab SaaS offering because [uploading a custom Certification Authority (CA)](https://docs.gitlab.com/omnibus/settings/ssl/#install-custom-public-certificates) is only available to GitLab Self-Managed. - Setting values in the Extended Key Usage (EKU) section of your certificate in addition to the required Key Usage (KU) of `Digital Signature` is likely to cause your commits to display as **Unverified**. To resolve this, add `emailProtection` to your EKU list. RFC 5280 specifies this limitation. To diagnose it, follow [S/MIME verification with OpenSSL](#smime-verification-with-openssl). If this change doesn't resolve the issue, provide feedback in [issue 440189](https://gitlab.com/gitlab-org/gitlab/-/issues/440189). - In GitLab 16.2 and earlier, if you have more than one email in the Subject Alternative Name list in your signing certificate, [only the first one is used to verify commits](https://gitlab.com/gitlab-org/gitlab/-/issues/336677). ## Configure for signed commits To sign your commits, tags, or both, you must: 1. [Obtain an X.509 key pair](#obtain-an-x509-key-pair). 1. [Associate your X.509 certificate with Git](#associate-your-x509-certificate-with-git). 1. [Sign and verify commits](#sign-and-verify-commits). 1. [Sign and verify tags](#sign-and-verify-tags). ### Obtain an X.509 key pair If your organization has Public Key Infrastructure (PKI), that PKI provides an S/MIME key. If you do not have an S/MIME key pair from a PKI, create your own self-signed pair or purchase a pair. ### Associate your X.509 certificate with Git To take advantage of X.509 signing, you need Git 2.19.0 or later. You can check your Git version with the command `git --version`. If you have the correct version, you can proceed to configure Git. {{< tabs >}} {{< tab title="Linux" >}} Configure Git to use your key for signing: ```shell signingkey=$( gpgsm --list-secret-keys | egrep '(key usage|ID)' | grep -B 1 digitalSignature | awk '/ID/ {print $2}' ) git config --global user.signingkey $signingkey git config --global gpg.format x509 ``` {{</ tab >}} {{< tab title="Windows and macOS" >}} To configure Windows or macOS: 1. Install [S/MIME Sign](https://github.com/github/smimesign) by either: - Downloading the installer. - Running `brew install smimesign` on macOS. 1. Get the ID of your certificate by running `smimesign --list-keys`. 1. Set your signing key by running `git config --global user.signingkey <ID>`, replacing `<ID>` with the certificate ID. 1. Configure X.509 with this command: ```shell git config --global gpg.x509.program smimesign git config --global gpg.format x509 ``` {{< /tab >}} {{< /tabs >}} ### Sign and verify commits After you have [associated your X.509 certificate with Git](#associate-your-x509-certificate-with-git) you can sign your commits: 1. When you create a Git commit, add the `-S` flag: ```shell git commit -S -m "feat: x509 signed commits" ``` 1. Push to GitLab, and check that your commits are verified with the `--show-signature` flag: ```shell git log --show-signature ``` 1. *If you don't want to type the `-S` flag every time you commit,* run this command for Git to sign your commits every time: ```shell git config --global commit.gpgsign true ``` ### Sign and verify tags After you have [associated your X.509 certificate with Git](#associate-your-x509-certificate-with-git) you can start signing your tags: 1. When you create a Git tag, add the `-s` flag: ```shell git tag -s v1.1.1 -m "My signed tag" ``` 1. Push to GitLab and verify your tags are signed with this command: ```shell git tag --verify v1.1.1 ``` 1. *If you don't want to type the `-s` flag every time you tag,* run this command for Git to sign your tags each time: ```shell git config --global tag.gpgsign true ``` ## Related topics - [Rake task for X.509 signatures](../../../../administration/raketasks/x509_signatures.md) ## Troubleshooting For committers without administrator access, review the list of [verification problems with signed commits](_index.md#fix-verification-problems-with-signed-commits) for possible fixes. The other troubleshooting suggestions on this page require administrator access. ### Re-verify commits GitLab stores the status of checked commits in the database. You can re-verify commits after: - Renewing a root CA or intermediate certificate. - Making changes to the certificate store. To re-verify commits: 1. Ensure the root CA and any intermediate certificates are in the GitLab certificate store. 1. Run the [`update_signatures` Rake task](../../../../administration/raketasks/x509_signatures.md) to check and update the status of previously verified commits. ### Main verification checks The code performs [these key checks](https://gitlab.com/gitlab-org/gitlab/-/blob/v14.1.0-ee/lib/gitlab/x509/signature.rb#L33), which all must return `verified`: - `x509_certificate.nil?` should be false. - `x509_certificate.revoked?` should be false. - `verified_signature` should be true. - `user.nil?` should be false. - `user.verified_emails.include?(@email)` should be true. - `certificate_email == @email` should be true. To investigate why a commit shows as `Unverified`: 1. [Start a Rails console](../../../../administration/operations/rails_console.md#starting-a-rails-console-session): ```shell sudo gitlab-rails console ``` 1. Identify the project (either by path or ID) and full commit SHA that you're investigating. Use this information to create `signature` to run other checks against: ```ruby project = Project.find_by_full_path('group/subgroup/project') project = Project.find_by_id('121') commit = project.repository.commit_by(oid: '87fdbd0f9382781442053b0b76da729344e37653') signedcommit=Gitlab::X509::Commit.new(commit) signature=Gitlab::X509::Signature.new(signedcommit.signature_text, signedcommit.signed_text, commit.committer_email, commit.created_at) ``` If you make changes to address issues identified running through the checks, restart the Rails console and run though the checks again from the start. 1. Check the certificate on the commit: ```ruby signature.x509_certificate.nil? signature.x509_certificate.revoked? ``` Both checks should return `false`: ```ruby > signature.x509_certificate.nil? => false > signature.x509_certificate.revoked? => false ``` A [known issue](https://gitlab.com/gitlab-org/gitlab/-/issues/332503) causes these checks to fail with `Validation failed: Subject key identifier is invalid`. 1. Run a cryptographic check on the signature. The code must return `true`: ```ruby signature.verified_signature ``` If it returns `false` then [investigate this check further](#cryptographic-verification-checks). 1. Confirm the email addresses match on the commit and the signature: - The Rails console displays the email addresses being compared. - The final command must return `true`: ```ruby sigemail=signature.__send__:certificate_email commitemail=commit.committer_email sigemail == commitemail ``` In GitLab 16.2 and earlier, [only the first email](https://gitlab.com/gitlab-org/gitlab/-/issues/336677) in the `Subject Alternative Name` list is compared. To display the `Subject Alternative Name` list, run: ```ruby signature.__send__ :get_certificate_extension,'subjectAltName' ``` If the developer's email address is not the first one in the list, this check fails, and the commit is marked `unverified`. 1. The email address on the commit must be associated with an account in GitLab. This check should return `false`: ```ruby signature.user.nil? ``` 1. Check the email address is associated with a user in GitLab. This check should return a user, such as `#<User id:1234 @user_handle>`: ```ruby User.find_by_any_email(commit.committer_email) ``` If it returns `nil`, the email address is not associated with a user, and the check fails. 1. Confirm the developer's email address is verified. This check must return true: ```ruby signature.user.verified_emails.include?(commit.committer_email) ``` If the previous check returned `nil`, this command displays an error: ```plaintext NoMethodError (undefined method `verified_emails' for nil:NilClass) ``` 1. The verification status is stored in the database. To display the database record: ```ruby pp CommitSignatures::X509CommitSignature.by_commit_sha(commit.sha);nil ``` If all the previous checks returned the correct values: - `verification_status: "unverified"` indicates the database record needs updating. [Use the Rake task](#re-verify-commits). - `[]` indicates the database doesn't have a record yet. Locate the commit in GitLab to check the signature and store the result. #### Cryptographic verification checks If GitLab determines that `verified_signature` is `false`, investigate the reason in the Rails console. These checks require `signature` to exist. Refer to the `signature` step of the previous [main verification checks](#main-verification-checks). 1. Check the signature, without checking the issuer, returns `true`: ```ruby signature.__send__ :valid_signature? ``` 1. Check the signing time and date. This check must return `true`: ```ruby signature.__send__ :valid_signing_time? ``` - The code allows for code signing certificates to expire. - A commit must be signed during the validity period of the certificate, and at or after the commit's datestamp. Display the commit time and certificate details including `not_before`, `not_after` with: ```ruby commit.created_at pp signature.__send__ :cert; nil ``` 1. Check the signature, including that TLS trust can be established. This check must return `true`: ```ruby signature.__send__(:p7).verify([], signature.__send__(:cert_store), signature.__send__(:signed_text)) ``` 1. If this fails, add the missing certificates required to establish trust [to the GitLab certificate store](https://docs.gitlab.com/omnibus/settings/ssl/#install-custom-public-certificates). 1. After adding more certificates, (if these troubleshooting steps then pass) run the Rake task to [re-verify commits](#re-verify-commits). 1. You can add additional certificates dynamically in the Rails console to check if this resolves the problem. 1. Retest the signature with a trust store `cert_store` that can be modified. It should still fail, with `false`: ```ruby cert_store = signature.__send__ :cert_store signature.__send__(:p7).verify([], cert_store, signature.__send__(:signed_text)) ``` 1. Add an additional certificate, and re-test: ```ruby cert_store.add_file("/etc/ssl/certs/my_new_root_ca.pem") signature.__send__(:p7).verify([], cert_store, signature.__send__(:signed_text)) ``` 1. Display the certificates that are included in the signature: ```ruby pp signature.__send__(:p7).certificates ; nil ``` 1. [Further investigation can be performed with OpenSSL on the command line](#smime-verification-with-openssl). Ensure any additional intermediate certificates and the root certificate are added to the certificate store. For consistency with how certificate chains are built on web servers: - Git clients that are signing commits should include the certificate and all intermediate certificates in the signature. - The GitLab certificate store should only contain the root. If you remove a root certificate from the GitLab trust store, such as when it expires, commit signatures which chain back to that root display as `unverified`. #### S/MIME verification with OpenSSL If there are issues with the signature, or if TLS trust fails, further debugging can be performed with OpenSSL on the command line. Export the signature and the signed text, from the [Rails console](../../../../administration/operations/rails_console.md#starting-a-rails-console-session): 1. The initial two steps from [the main verification checks](#main-verification-checks) are required so `signature` has been set. 1. OpenSSL requires that PKCS7 PEM formatted data is bounded with `BEGIN PKCS7` and `END PKCS7` so this usually needs to be fixed: ```ruby pkcs7_text = signature.signature_text.sub('-----BEGIN SIGNED MESSAGE-----', '-----BEGIN PKCS7-----') pkcs7_text = pkcs7_text.sub('-----END SIGNED MESSAGE-----', '-----END PKCS7-----') ``` 1. Write out the signature and signed text: ```ruby f1=File.new('/tmp/signature_text.pk7.pem','w') f1 << pkcs7_text f1.close f2=File.new('/tmp/signed_text.txt','w') f2 << signature.signed_text f2.close ``` This data can now be investigated on the Linux command line using OpenSSL: 1. The PKCS #7 file containing the signature can be queried: ```shell /opt/gitlab/embedded/bin/openssl pkcs7 -inform pem -print_certs \ -in /tmp/signature_text.pk7.pem -print -noout ``` It should include at least one `cert` section in the output; the signer's certificate. There's a lot of low level of detail in the output. Here's an example of some of the structure and headings that should be present: ```plaintext PKCS7: d.sign: cert: cert_info: issuer: validity: notBefore: notAfter: subject: ``` If developers' code signing certificates are issued by an intermediate certificate authority, there should be additional certificate details: ```plaintext PKCS7: d.sign: cert: cert_info: cert: cert_info: ``` 1. Extract the certificate from the signature: ```shell /opt/gitlab/embedded/bin/openssl pkcs7 -inform pem -print_certs \ -in /tmp/signature_text.pk7.pem -out /tmp/signature_cert.pem ``` If this step fails, the signature might be missing the signer's certificate. - Fix this issue on the Git client. - The following step will fail, but if you copy the signer's certificate to the GitLab server, you can use that to do some testing using `-nointern -certfile signerscertificate.pem`. 1. Partially verify the commit, using the extracted certificate: ```shell /opt/gitlab/embedded/bin/openssl smime -verify -binary -inform pem \ -in /tmp/signature_text.pk7.pem -content /tmp/signed_text.txt \ -noverify -certfile /tmp/signature_cert.pem -nointern ``` The output usually includes: - The parent commit - The name, email, and timestamp from the commit - The commit text - `Verification successful` (or similar) This check is not the same as the check GitLab performs, because: - It does not verify the signer's certificate (`-noverify`) - The verification is done using the supplied `-certfile` rather than the one in the message (`-nointern`) 1. Partially verify the commit using the certificate in the message: ```shell /opt/gitlab/embedded/bin/openssl smime -verify -binary -inform pem \ -in /tmp/signature_text.pk7.pem -content /tmp/signed_text.txt \ -noverify ``` This should get the same result as the previous step, using the extracted certificate. If the message is missing the certificate, the error includes `signer certificate not found`. 1. Fully verify the commit: ```shell /opt/gitlab/embedded/bin/openssl smime -verify -binary -inform pem \ -in /tmp/signature_text.pk7.pem -content /tmp/signed_text.txt ``` If this step fails, verification also fails in GitLab. Resolve any errors, for example: - `certificate verify error .. unable to get local issuer certificate`: - The trust chain couldn't be established. - This OpenSSL binary uses the GitLab trust store. Either the root certificate is missing from the trust store or the signature is missing the intermediate certificates and a chain to a trusted root can't be built. - Intermediate certificates can be put in the trust store if it's not possible to include them in the signature. - [The procedure for adding certificates](https://docs.gitlab.com/omnibus/settings/ssl/#install-custom-public-certificates) to the trust store for packaged GitLab - using `/etc/gitlab/trusted-certs`. - Test additional trusted certificates using OpenSSL with: `-CAfile /path/to/rootcertificate.pem` - `unsupported certificate purpose`: - The certificate must specify `Digital Signature` in the `X509v3 Key Usage` section of the signer's certificate. - If the `X509v3 Extended Key Usage` (EKU) section is specified, it must include `emailProtection`. See [RFC 5280](https://datatracker.ietf.org/doc/html/rfc5280#page-44) for more details: > If there is no purpose consistent with both (Key Usage) extensions, then the certificate must not be used for any purpose. If this addition to the EKU list doesn't resolve the issue, provide feedback in [issue 440189](https://gitlab.com/gitlab-org/gitlab/-/issues/440189). - `signer certificate not found`, either: - You have added the `-nointern` argument, but not supplied `-certfile`. - The signature is missing the signer's certificate.
--- stage: Create group: Source Code info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments description: Sign commits and tags in your GitLab repository with X.509 certificates. title: Sign commits and tags with X.509 certificates breadcrumbs: - doc - user - project - repository - signed_commits --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab Self-Managed, GitLab Dedicated {{< /details >}} [X.509](https://en.wikipedia.org/wiki/X.509) is a standard format for public key certificates issued by a public or private Public Key Infrastructure (PKI). Personal X.509 certificates are used for authentication or signing purposes such as S/MIME (Secure/Multipurpose Internet Mail Extensions). However, Git also supports signing of commits and tags with X.509 certificates in a similar way as with [GPG (GnuPG, or GNU Privacy Guard)](gpg.md). The main difference is the way GitLab determines whether or not the developer's signature is trusted: - For X.509, a root certificate authority is added to the GitLab trust store. (A trust store is a repository of trusted security certificates.) Combined with any required intermediate certificates in the signature, the developer's certificate can be chained back to a trusted root certificate. - For GPG, developers [add their GPG key](gpg.md#add-a-gpg-key-to-your-account) to their account. GitLab uses its own certificate store and therefore defines the [trust chain](https://www.ssl.com/article/what-is-a-certificate-authority-ca/). For a commit or tag to be verified by GitLab: - The signing certificate email must match a verified email address in GitLab. - The GitLab instance requires a full trust chain from the certificate in the signature to a trusted certificate in the GitLab certificate store. This chain may include intermediate certificates supplied in the signature. You may need to add certificates, such as Certificate Authority root certificates, [to the GitLab certificate store](https://docs.gitlab.com/omnibus/settings/ssl/#install-custom-public-certificates). - The signing time must be in the time range of the [certificate validity](https://www.rfc-editor.org/rfc/rfc5280.html#section-4.1.2.5), which is usually up to three years. - The signing time is equal to, or later than, the commit time. {{< alert type="note" >}} If a Root CA or intermediate certificate in the trust chain expires and is renewed, commits may temporarily show as "unverified" until you [re-verify them](#re-verify-commits). {{< /alert >}} If a commit's status has already been determined and stored in the database, use the Rake task [to re-check the status](../../../../administration/raketasks/x509_signatures.md). Refer to the [Troubleshooting section](#troubleshooting). GitLab checks certificate revocation lists on a daily basis with a background worker. ## Known issues - Certificates without `authorityKeyIdentifier`, `subjectKeyIdentifier`, and `crlDistributionPoints` display as **Unverified**. We recommend using certificates from a PKI that are in line with [RFC 5280](https://www.rfc-editor.org/rfc/rfc5280). - The **Verified** badge is not displayed on the GitLab SaaS offering because [uploading a custom Certification Authority (CA)](https://docs.gitlab.com/omnibus/settings/ssl/#install-custom-public-certificates) is only available to GitLab Self-Managed. - Setting values in the Extended Key Usage (EKU) section of your certificate in addition to the required Key Usage (KU) of `Digital Signature` is likely to cause your commits to display as **Unverified**. To resolve this, add `emailProtection` to your EKU list. RFC 5280 specifies this limitation. To diagnose it, follow [S/MIME verification with OpenSSL](#smime-verification-with-openssl). If this change doesn't resolve the issue, provide feedback in [issue 440189](https://gitlab.com/gitlab-org/gitlab/-/issues/440189). - In GitLab 16.2 and earlier, if you have more than one email in the Subject Alternative Name list in your signing certificate, [only the first one is used to verify commits](https://gitlab.com/gitlab-org/gitlab/-/issues/336677). ## Configure for signed commits To sign your commits, tags, or both, you must: 1. [Obtain an X.509 key pair](#obtain-an-x509-key-pair). 1. [Associate your X.509 certificate with Git](#associate-your-x509-certificate-with-git). 1. [Sign and verify commits](#sign-and-verify-commits). 1. [Sign and verify tags](#sign-and-verify-tags). ### Obtain an X.509 key pair If your organization has Public Key Infrastructure (PKI), that PKI provides an S/MIME key. If you do not have an S/MIME key pair from a PKI, create your own self-signed pair or purchase a pair. ### Associate your X.509 certificate with Git To take advantage of X.509 signing, you need Git 2.19.0 or later. You can check your Git version with the command `git --version`. If you have the correct version, you can proceed to configure Git. {{< tabs >}} {{< tab title="Linux" >}} Configure Git to use your key for signing: ```shell signingkey=$( gpgsm --list-secret-keys | egrep '(key usage|ID)' | grep -B 1 digitalSignature | awk '/ID/ {print $2}' ) git config --global user.signingkey $signingkey git config --global gpg.format x509 ``` {{</ tab >}} {{< tab title="Windows and macOS" >}} To configure Windows or macOS: 1. Install [S/MIME Sign](https://github.com/github/smimesign) by either: - Downloading the installer. - Running `brew install smimesign` on macOS. 1. Get the ID of your certificate by running `smimesign --list-keys`. 1. Set your signing key by running `git config --global user.signingkey <ID>`, replacing `<ID>` with the certificate ID. 1. Configure X.509 with this command: ```shell git config --global gpg.x509.program smimesign git config --global gpg.format x509 ``` {{< /tab >}} {{< /tabs >}} ### Sign and verify commits After you have [associated your X.509 certificate with Git](#associate-your-x509-certificate-with-git) you can sign your commits: 1. When you create a Git commit, add the `-S` flag: ```shell git commit -S -m "feat: x509 signed commits" ``` 1. Push to GitLab, and check that your commits are verified with the `--show-signature` flag: ```shell git log --show-signature ``` 1. *If you don't want to type the `-S` flag every time you commit,* run this command for Git to sign your commits every time: ```shell git config --global commit.gpgsign true ``` ### Sign and verify tags After you have [associated your X.509 certificate with Git](#associate-your-x509-certificate-with-git) you can start signing your tags: 1. When you create a Git tag, add the `-s` flag: ```shell git tag -s v1.1.1 -m "My signed tag" ``` 1. Push to GitLab and verify your tags are signed with this command: ```shell git tag --verify v1.1.1 ``` 1. *If you don't want to type the `-s` flag every time you tag,* run this command for Git to sign your tags each time: ```shell git config --global tag.gpgsign true ``` ## Related topics - [Rake task for X.509 signatures](../../../../administration/raketasks/x509_signatures.md) ## Troubleshooting For committers without administrator access, review the list of [verification problems with signed commits](_index.md#fix-verification-problems-with-signed-commits) for possible fixes. The other troubleshooting suggestions on this page require administrator access. ### Re-verify commits GitLab stores the status of checked commits in the database. You can re-verify commits after: - Renewing a root CA or intermediate certificate. - Making changes to the certificate store. To re-verify commits: 1. Ensure the root CA and any intermediate certificates are in the GitLab certificate store. 1. Run the [`update_signatures` Rake task](../../../../administration/raketasks/x509_signatures.md) to check and update the status of previously verified commits. ### Main verification checks The code performs [these key checks](https://gitlab.com/gitlab-org/gitlab/-/blob/v14.1.0-ee/lib/gitlab/x509/signature.rb#L33), which all must return `verified`: - `x509_certificate.nil?` should be false. - `x509_certificate.revoked?` should be false. - `verified_signature` should be true. - `user.nil?` should be false. - `user.verified_emails.include?(@email)` should be true. - `certificate_email == @email` should be true. To investigate why a commit shows as `Unverified`: 1. [Start a Rails console](../../../../administration/operations/rails_console.md#starting-a-rails-console-session): ```shell sudo gitlab-rails console ``` 1. Identify the project (either by path or ID) and full commit SHA that you're investigating. Use this information to create `signature` to run other checks against: ```ruby project = Project.find_by_full_path('group/subgroup/project') project = Project.find_by_id('121') commit = project.repository.commit_by(oid: '87fdbd0f9382781442053b0b76da729344e37653') signedcommit=Gitlab::X509::Commit.new(commit) signature=Gitlab::X509::Signature.new(signedcommit.signature_text, signedcommit.signed_text, commit.committer_email, commit.created_at) ``` If you make changes to address issues identified running through the checks, restart the Rails console and run though the checks again from the start. 1. Check the certificate on the commit: ```ruby signature.x509_certificate.nil? signature.x509_certificate.revoked? ``` Both checks should return `false`: ```ruby > signature.x509_certificate.nil? => false > signature.x509_certificate.revoked? => false ``` A [known issue](https://gitlab.com/gitlab-org/gitlab/-/issues/332503) causes these checks to fail with `Validation failed: Subject key identifier is invalid`. 1. Run a cryptographic check on the signature. The code must return `true`: ```ruby signature.verified_signature ``` If it returns `false` then [investigate this check further](#cryptographic-verification-checks). 1. Confirm the email addresses match on the commit and the signature: - The Rails console displays the email addresses being compared. - The final command must return `true`: ```ruby sigemail=signature.__send__:certificate_email commitemail=commit.committer_email sigemail == commitemail ``` In GitLab 16.2 and earlier, [only the first email](https://gitlab.com/gitlab-org/gitlab/-/issues/336677) in the `Subject Alternative Name` list is compared. To display the `Subject Alternative Name` list, run: ```ruby signature.__send__ :get_certificate_extension,'subjectAltName' ``` If the developer's email address is not the first one in the list, this check fails, and the commit is marked `unverified`. 1. The email address on the commit must be associated with an account in GitLab. This check should return `false`: ```ruby signature.user.nil? ``` 1. Check the email address is associated with a user in GitLab. This check should return a user, such as `#<User id:1234 @user_handle>`: ```ruby User.find_by_any_email(commit.committer_email) ``` If it returns `nil`, the email address is not associated with a user, and the check fails. 1. Confirm the developer's email address is verified. This check must return true: ```ruby signature.user.verified_emails.include?(commit.committer_email) ``` If the previous check returned `nil`, this command displays an error: ```plaintext NoMethodError (undefined method `verified_emails' for nil:NilClass) ``` 1. The verification status is stored in the database. To display the database record: ```ruby pp CommitSignatures::X509CommitSignature.by_commit_sha(commit.sha);nil ``` If all the previous checks returned the correct values: - `verification_status: "unverified"` indicates the database record needs updating. [Use the Rake task](#re-verify-commits). - `[]` indicates the database doesn't have a record yet. Locate the commit in GitLab to check the signature and store the result. #### Cryptographic verification checks If GitLab determines that `verified_signature` is `false`, investigate the reason in the Rails console. These checks require `signature` to exist. Refer to the `signature` step of the previous [main verification checks](#main-verification-checks). 1. Check the signature, without checking the issuer, returns `true`: ```ruby signature.__send__ :valid_signature? ``` 1. Check the signing time and date. This check must return `true`: ```ruby signature.__send__ :valid_signing_time? ``` - The code allows for code signing certificates to expire. - A commit must be signed during the validity period of the certificate, and at or after the commit's datestamp. Display the commit time and certificate details including `not_before`, `not_after` with: ```ruby commit.created_at pp signature.__send__ :cert; nil ``` 1. Check the signature, including that TLS trust can be established. This check must return `true`: ```ruby signature.__send__(:p7).verify([], signature.__send__(:cert_store), signature.__send__(:signed_text)) ``` 1. If this fails, add the missing certificates required to establish trust [to the GitLab certificate store](https://docs.gitlab.com/omnibus/settings/ssl/#install-custom-public-certificates). 1. After adding more certificates, (if these troubleshooting steps then pass) run the Rake task to [re-verify commits](#re-verify-commits). 1. You can add additional certificates dynamically in the Rails console to check if this resolves the problem. 1. Retest the signature with a trust store `cert_store` that can be modified. It should still fail, with `false`: ```ruby cert_store = signature.__send__ :cert_store signature.__send__(:p7).verify([], cert_store, signature.__send__(:signed_text)) ``` 1. Add an additional certificate, and re-test: ```ruby cert_store.add_file("/etc/ssl/certs/my_new_root_ca.pem") signature.__send__(:p7).verify([], cert_store, signature.__send__(:signed_text)) ``` 1. Display the certificates that are included in the signature: ```ruby pp signature.__send__(:p7).certificates ; nil ``` 1. [Further investigation can be performed with OpenSSL on the command line](#smime-verification-with-openssl). Ensure any additional intermediate certificates and the root certificate are added to the certificate store. For consistency with how certificate chains are built on web servers: - Git clients that are signing commits should include the certificate and all intermediate certificates in the signature. - The GitLab certificate store should only contain the root. If you remove a root certificate from the GitLab trust store, such as when it expires, commit signatures which chain back to that root display as `unverified`. #### S/MIME verification with OpenSSL If there are issues with the signature, or if TLS trust fails, further debugging can be performed with OpenSSL on the command line. Export the signature and the signed text, from the [Rails console](../../../../administration/operations/rails_console.md#starting-a-rails-console-session): 1. The initial two steps from [the main verification checks](#main-verification-checks) are required so `signature` has been set. 1. OpenSSL requires that PKCS7 PEM formatted data is bounded with `BEGIN PKCS7` and `END PKCS7` so this usually needs to be fixed: ```ruby pkcs7_text = signature.signature_text.sub('-----BEGIN SIGNED MESSAGE-----', '-----BEGIN PKCS7-----') pkcs7_text = pkcs7_text.sub('-----END SIGNED MESSAGE-----', '-----END PKCS7-----') ``` 1. Write out the signature and signed text: ```ruby f1=File.new('/tmp/signature_text.pk7.pem','w') f1 << pkcs7_text f1.close f2=File.new('/tmp/signed_text.txt','w') f2 << signature.signed_text f2.close ``` This data can now be investigated on the Linux command line using OpenSSL: 1. The PKCS #7 file containing the signature can be queried: ```shell /opt/gitlab/embedded/bin/openssl pkcs7 -inform pem -print_certs \ -in /tmp/signature_text.pk7.pem -print -noout ``` It should include at least one `cert` section in the output; the signer's certificate. There's a lot of low level of detail in the output. Here's an example of some of the structure and headings that should be present: ```plaintext PKCS7: d.sign: cert: cert_info: issuer: validity: notBefore: notAfter: subject: ``` If developers' code signing certificates are issued by an intermediate certificate authority, there should be additional certificate details: ```plaintext PKCS7: d.sign: cert: cert_info: cert: cert_info: ``` 1. Extract the certificate from the signature: ```shell /opt/gitlab/embedded/bin/openssl pkcs7 -inform pem -print_certs \ -in /tmp/signature_text.pk7.pem -out /tmp/signature_cert.pem ``` If this step fails, the signature might be missing the signer's certificate. - Fix this issue on the Git client. - The following step will fail, but if you copy the signer's certificate to the GitLab server, you can use that to do some testing using `-nointern -certfile signerscertificate.pem`. 1. Partially verify the commit, using the extracted certificate: ```shell /opt/gitlab/embedded/bin/openssl smime -verify -binary -inform pem \ -in /tmp/signature_text.pk7.pem -content /tmp/signed_text.txt \ -noverify -certfile /tmp/signature_cert.pem -nointern ``` The output usually includes: - The parent commit - The name, email, and timestamp from the commit - The commit text - `Verification successful` (or similar) This check is not the same as the check GitLab performs, because: - It does not verify the signer's certificate (`-noverify`) - The verification is done using the supplied `-certfile` rather than the one in the message (`-nointern`) 1. Partially verify the commit using the certificate in the message: ```shell /opt/gitlab/embedded/bin/openssl smime -verify -binary -inform pem \ -in /tmp/signature_text.pk7.pem -content /tmp/signed_text.txt \ -noverify ``` This should get the same result as the previous step, using the extracted certificate. If the message is missing the certificate, the error includes `signer certificate not found`. 1. Fully verify the commit: ```shell /opt/gitlab/embedded/bin/openssl smime -verify -binary -inform pem \ -in /tmp/signature_text.pk7.pem -content /tmp/signed_text.txt ``` If this step fails, verification also fails in GitLab. Resolve any errors, for example: - `certificate verify error .. unable to get local issuer certificate`: - The trust chain couldn't be established. - This OpenSSL binary uses the GitLab trust store. Either the root certificate is missing from the trust store or the signature is missing the intermediate certificates and a chain to a trusted root can't be built. - Intermediate certificates can be put in the trust store if it's not possible to include them in the signature. - [The procedure for adding certificates](https://docs.gitlab.com/omnibus/settings/ssl/#install-custom-public-certificates) to the trust store for packaged GitLab - using `/etc/gitlab/trusted-certs`. - Test additional trusted certificates using OpenSSL with: `-CAfile /path/to/rootcertificate.pem` - `unsupported certificate purpose`: - The certificate must specify `Digital Signature` in the `X509v3 Key Usage` section of the signer's certificate. - If the `X509v3 Extended Key Usage` (EKU) section is specified, it must include `emailProtection`. See [RFC 5280](https://datatracker.ietf.org/doc/html/rfc5280#page-44) for more details: > If there is no purpose consistent with both (Key Usage) extensions, then the certificate must not be used for any purpose. If this addition to the EKU list doesn't resolve the issue, provide feedback in [issue 440189](https://gitlab.com/gitlab-org/gitlab/-/issues/440189). - `signer certificate not found`, either: - You have added the `-nointern` argument, but not supplied `-certfile`. - The signature is missing the signer's certificate.
https://docs.gitlab.com/user/project/repository/gpg
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/repository/gpg.md
2025-08-13
doc/user/project/repository/signed_commits
[ "doc", "user", "project", "repository", "signed_commits" ]
gpg.md
Create
Source Code
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Sign commits with GPG
Sign commits in your GitLab repository with GPG (GNU Privacy Guard) keys.
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} You can sign the commits you make in a GitLab repository with a GPG ([GNU Privacy Guard](https://gnupg.org/)) key. {{< alert type="note" >}} GitLab uses the term GPG for all OpenPGP, PGP, and GPG-related material and implementations. {{< /alert >}} For GitLab to consider a commit verified: - The committer must have a GPG public/private key pair. - The committer's public key must be uploaded to their GitLab account. - One of the email addresses in the GPG public key must match a verified email address used by the committer in GitLab. To keep this address private, use the automatically generated [private commit email address](../../../profile/_index.md#use-an-automatically-generated-private-commit-email) GitLab provides in your profile. - The committer's email address must match the verified email address from the GPG key. GitLab uses its own keyring to verify the GPG signature. It does not access any public key server. GPG verified tags are not supported. For more details about GPG, refer to the [related topics list](#related-topics). ## View a user's public GPG key To view a user's public GPG key, you can either: - Go to `https://gitlab.example.com/<USERNAME>.gpg`. GitLab displays the GPG key, if the user has configured one, or a blank page for users without a configured GPG key. - Go to the user's profile (such as `https://gitlab.example.com/<USERNAME>`). In the upper-right corner of the user's profile, select **View public GPG keys** ({{< icon name="key" >}}). This button is shown only if the user has configured the key. ## Configure commit signing To sign commits, you must configure both your local machine and your GitLab account: 1. [Create a GPG key](#create-a-gpg-key). 1. [Add a GPG key to your account](#add-a-gpg-key-to-your-account). 1. [Associate your GPG key with Git](#associate-your-gpg-key-with-git). 1. [Sign your Git commits](#sign-your-git-commits). ### Create a GPG key If you don't already have a GPG key, create one: 1. [Install GPG](https://www.gnupg.org/download/) for your operating system. If your operating system has `gpg2` installed, replace `gpg` with `gpg2` in the commands on this page. 1. To generate your key pair, run the command appropriate for your version of `gpg`: ```shell # Use this command for the default version of GPG, including # Gpg4win on Windows, and most macOS versions: gpg --gen-key # Use this command for versions of GPG later than 2.1.17: gpg --full-gen-key ``` 1. Select the algorithm your key should use, or press <kbd>Enter</kbd> to select the default option, `RSA and RSA`. 1. Select the key length, in bits. GitLab recommends 4096-bit keys. 1. Specify the validity period of your key. This value is subjective, and the default value is no expiration. 1. To confirm your answers, enter `y`. 1. Enter your name. 1. Enter your email address. It must match a [verified email address](../../../profile/_index.md#change-the-email-displayed-on-your-commits) in your GitLab account. 1. Optional. Enter a comment to display in parentheses after your name. 1. GPG displays the information you've entered so far. Edit the information or press <kbd>O</kbd> (for `Okay`) to continue. 1. Enter a strong password, then enter it again to confirm it. 1. To list your private GPG key, run this command, replacing `<EMAIL>` with the email address you used when you generated the key: ```shell gpg --list-secret-keys --keyid-format LONG <EMAIL> ``` 1. In the output, identify the `sec` line, and copy the GPG key ID. It begins after the `/` character. In this example, the key ID is `30F2B65B9246B6CA`: ```plaintext sec rsa4096/30F2B65B9246B6CA 2017-08-18 [SC] D5E4F29F3275DC0CDA8FFC8730F2B65B9246B6CA uid [ultimate] Mr. Robot <your_email> ssb rsa4096/B7ABC0813E4028C0 2017-08-18 [E] ``` 1. To show the associated public key, run this command, replacing `<ID>` with the GPG key ID from the previous step: ```shell gpg --armor --export <ID> ``` 1. Copy the public key, including the `BEGIN PGP PUBLIC KEY BLOCK` and `END PGP PUBLIC KEY BLOCK` lines. You need this key in the next step. ### Add a GPG key to your account To add a GPG key to your user settings: 1. Sign in to GitLab. 1. On the left sidebar, select your avatar. 1. Select **Edit profile**. 1. Select **GPG keys** ({{< icon name="key" >}}). 1. Select **Add new key**. 1. In **Key**, paste your public key. 1. To add the key to your account, select **Add key**. GitLab shows the key's fingerprint, email address, and creation date. After you add a key, you cannot edit it. Instead, remove the offending key and re-add it. ### Associate your GPG key with Git After you [create your GPG key](#create-a-gpg-key) and [add it to your account](#add-a-gpg-key-to-your-account), you must configure Git to use this key: 1. Run this command to list the private GPG key you just created, replacing `<EMAIL>` with the email address for your key: ```shell gpg --list-secret-keys --keyid-format LONG <EMAIL> ``` 1. Copy the GPG private key ID that starts with `sec`. In this example, the private key ID is `30F2B65B9246B6CA`: ```plaintext sec rsa4096/30F2B65B9246B6CA 2017-08-18 [SC] D5E4F29F3275DC0CDA8FFC8730F2B65B9246B6CA uid [ultimate] Mr. Robot <your_email> ssb rsa4096/B7ABC0813E4028C0 2017-08-18 [E] ``` 1. Run this command to configure Git to sign your commits with your key, replacing `<KEY ID>` with your GPG key ID: ```shell git config --global user.signingkey <KEY ID> ``` ### Sign your Git commits After you [add your public key to your account](#add-a-gpg-key-to-your-account), you can sign individual commits manually, or configure Git to default to signed commits: - Sign individual Git commits manually: 1. Add `-S` flag to any commit you want to sign: ```shell git commit -S -m "My commit message" ``` 1. Enter the passphrase of your GPG key when asked. 1. Push to GitLab and check that your commits [are verified](_index.md#verify-commits). - Sign all Git commits by default by running this command: ```shell git config --global commit.gpgsign true ``` #### Set signing key conditionally If you maintain signing keys for separate purposes, such as work and personal use, use an `IncludeIf` statement in your `.gitconfig` file to set which key you sign commits with. Prerequisites: - Requires Git version 2.13 or later. 1. In the same directory as your main `~/.gitconfig` file, create a second file, such as `.gitconfig-gitlab`. 1. In your main `~/.gitconfig` file, add your Git settings for work in non-GitLab projects. 1. Append this information to the end of your main `~/.gitconfig` file: ```ini # The contents of this file are included only for GitLab.com URLs [includeIf "hasconfig:remote.*.url:https://gitlab.com/**"] # Edit this line to point to your alternative configuration file path = ~/.gitconfig-gitlab ``` 1. In your alternative `.gitconfig-gitlab` file, add the configuration overrides to use when you're committing to a GitLab repository. All settings from your main `~/.gitconfig` file are retained unless you explicitly override them. In this example, ```ini # Alternative ~/.gitconfig-gitlab file # These values are used for repositories matching the string 'gitlab.com', # and override their corresponding values in ~/.gitconfig [user] email = you@example.com signingkey = <KEY ID> [commit] gpgsign = true ``` ## Revoke a GPG key If a GPG key becomes compromised, revoke it. Revoking a key changes both future and past commits: - Past commits signed by this key are marked as unverified. - Future commits signed by this key are marked as unverified. To revoke a GPG key: 1. On the left sidebar, select your avatar. 1. Select **Edit profile**. 1. Select **GPG keys** ({{< icon name="key" >}}). 1. Select **Revoke** next to the GPG key you want to delete. ## Remove a GPG key When you remove a GPG key from your GitLab account: - Previous commits signed with this key remain verified. - Future commits (including any commits created but not yet pushed) that attempt to use this key are unverified. To remove a GPG key from your account: 1. On the left sidebar, select your avatar. 1. Select **Edit profile**. 1. Select **GPG keys** ({{< icon name="key" >}}). 1. Select **Remove** ({{< icon name="remove" >}}) next to the GPG key you want to delete. If you must unverify both future and past commits, [revoke the associated GPG key](#revoke-a-gpg-key) instead. ## Related topics - [Configure commit signing for commits made in the web UI](../../../../administration/gitaly/configure_gitaly.md#configure-commit-signing-for-gitlab-ui-commits) - GPG resources: - [Git Tools - Signing Your Work](https://git-scm.com/book/en/v2/Git-Tools-Signing-Your-Work) - [Managing OpenPGP Keys](https://riseup.net/en/security/message-security/openpgp/gpg-keys) - [OpenPGP Best Practices](https://riseup.net/en/security/message-security/openpgp/best-practices) - [Creating a new GPG key with subkeys](https://www.void.gr/kargig/blog/2013/12/02/creating-a-new-gpg-key-with-subkeys/) (advanced) - [View GPG keys in your instance](../../../../administration/credentials_inventory.md#view-gpg-keys) - [Beyond Identity integration](../../integrations/beyond_identity.md) ## Troubleshooting ### Secret key not available If you receive the errors `secret key not available` or `gpg: signing failed: secret key not available`, try using `gpg2` instead of `gpg`: ```shell git config --global gpg.program gpg2 ``` If your GPG key is password protected and the password entry prompt does not appear, add `export GPG_TTY=$(tty)` to your shell's `rc` file (commonly `~/.bashrc` or `~/.zshrc`) ### GPG fails to sign data If your GPG key is password protected, and you receive one of the following errors: ```plaintext error: gpg failed to sign the data fatal: failed to write commit object gpg: signing failed: Inappropriate ioctl for device ``` If the password entry prompt doesn't appear: 1. Open your shell's configuration file, commonly `~/.bashrc` or `~/.zshrc`, in a text editor. 1. Add the following line to the file: ```shell export GPG_TTY=$(tty) ``` 1. Save the file and exit the text editor. 1. Apply the changes. Choose one of the following: - Restart your terminal. - Run `source ~/.bashrc` or `source ~/.zshrc`. {{< alert type="note" >}} The exact steps may vary depending on your operating system and shell configuration. {{< /alert >}}
--- stage: Create group: Source Code info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments description: Sign commits in your GitLab repository with GPG (GNU Privacy Guard) keys. title: Sign commits with GPG breadcrumbs: - doc - user - project - repository - signed_commits --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} You can sign the commits you make in a GitLab repository with a GPG ([GNU Privacy Guard](https://gnupg.org/)) key. {{< alert type="note" >}} GitLab uses the term GPG for all OpenPGP, PGP, and GPG-related material and implementations. {{< /alert >}} For GitLab to consider a commit verified: - The committer must have a GPG public/private key pair. - The committer's public key must be uploaded to their GitLab account. - One of the email addresses in the GPG public key must match a verified email address used by the committer in GitLab. To keep this address private, use the automatically generated [private commit email address](../../../profile/_index.md#use-an-automatically-generated-private-commit-email) GitLab provides in your profile. - The committer's email address must match the verified email address from the GPG key. GitLab uses its own keyring to verify the GPG signature. It does not access any public key server. GPG verified tags are not supported. For more details about GPG, refer to the [related topics list](#related-topics). ## View a user's public GPG key To view a user's public GPG key, you can either: - Go to `https://gitlab.example.com/<USERNAME>.gpg`. GitLab displays the GPG key, if the user has configured one, or a blank page for users without a configured GPG key. - Go to the user's profile (such as `https://gitlab.example.com/<USERNAME>`). In the upper-right corner of the user's profile, select **View public GPG keys** ({{< icon name="key" >}}). This button is shown only if the user has configured the key. ## Configure commit signing To sign commits, you must configure both your local machine and your GitLab account: 1. [Create a GPG key](#create-a-gpg-key). 1. [Add a GPG key to your account](#add-a-gpg-key-to-your-account). 1. [Associate your GPG key with Git](#associate-your-gpg-key-with-git). 1. [Sign your Git commits](#sign-your-git-commits). ### Create a GPG key If you don't already have a GPG key, create one: 1. [Install GPG](https://www.gnupg.org/download/) for your operating system. If your operating system has `gpg2` installed, replace `gpg` with `gpg2` in the commands on this page. 1. To generate your key pair, run the command appropriate for your version of `gpg`: ```shell # Use this command for the default version of GPG, including # Gpg4win on Windows, and most macOS versions: gpg --gen-key # Use this command for versions of GPG later than 2.1.17: gpg --full-gen-key ``` 1. Select the algorithm your key should use, or press <kbd>Enter</kbd> to select the default option, `RSA and RSA`. 1. Select the key length, in bits. GitLab recommends 4096-bit keys. 1. Specify the validity period of your key. This value is subjective, and the default value is no expiration. 1. To confirm your answers, enter `y`. 1. Enter your name. 1. Enter your email address. It must match a [verified email address](../../../profile/_index.md#change-the-email-displayed-on-your-commits) in your GitLab account. 1. Optional. Enter a comment to display in parentheses after your name. 1. GPG displays the information you've entered so far. Edit the information or press <kbd>O</kbd> (for `Okay`) to continue. 1. Enter a strong password, then enter it again to confirm it. 1. To list your private GPG key, run this command, replacing `<EMAIL>` with the email address you used when you generated the key: ```shell gpg --list-secret-keys --keyid-format LONG <EMAIL> ``` 1. In the output, identify the `sec` line, and copy the GPG key ID. It begins after the `/` character. In this example, the key ID is `30F2B65B9246B6CA`: ```plaintext sec rsa4096/30F2B65B9246B6CA 2017-08-18 [SC] D5E4F29F3275DC0CDA8FFC8730F2B65B9246B6CA uid [ultimate] Mr. Robot <your_email> ssb rsa4096/B7ABC0813E4028C0 2017-08-18 [E] ``` 1. To show the associated public key, run this command, replacing `<ID>` with the GPG key ID from the previous step: ```shell gpg --armor --export <ID> ``` 1. Copy the public key, including the `BEGIN PGP PUBLIC KEY BLOCK` and `END PGP PUBLIC KEY BLOCK` lines. You need this key in the next step. ### Add a GPG key to your account To add a GPG key to your user settings: 1. Sign in to GitLab. 1. On the left sidebar, select your avatar. 1. Select **Edit profile**. 1. Select **GPG keys** ({{< icon name="key" >}}). 1. Select **Add new key**. 1. In **Key**, paste your public key. 1. To add the key to your account, select **Add key**. GitLab shows the key's fingerprint, email address, and creation date. After you add a key, you cannot edit it. Instead, remove the offending key and re-add it. ### Associate your GPG key with Git After you [create your GPG key](#create-a-gpg-key) and [add it to your account](#add-a-gpg-key-to-your-account), you must configure Git to use this key: 1. Run this command to list the private GPG key you just created, replacing `<EMAIL>` with the email address for your key: ```shell gpg --list-secret-keys --keyid-format LONG <EMAIL> ``` 1. Copy the GPG private key ID that starts with `sec`. In this example, the private key ID is `30F2B65B9246B6CA`: ```plaintext sec rsa4096/30F2B65B9246B6CA 2017-08-18 [SC] D5E4F29F3275DC0CDA8FFC8730F2B65B9246B6CA uid [ultimate] Mr. Robot <your_email> ssb rsa4096/B7ABC0813E4028C0 2017-08-18 [E] ``` 1. Run this command to configure Git to sign your commits with your key, replacing `<KEY ID>` with your GPG key ID: ```shell git config --global user.signingkey <KEY ID> ``` ### Sign your Git commits After you [add your public key to your account](#add-a-gpg-key-to-your-account), you can sign individual commits manually, or configure Git to default to signed commits: - Sign individual Git commits manually: 1. Add `-S` flag to any commit you want to sign: ```shell git commit -S -m "My commit message" ``` 1. Enter the passphrase of your GPG key when asked. 1. Push to GitLab and check that your commits [are verified](_index.md#verify-commits). - Sign all Git commits by default by running this command: ```shell git config --global commit.gpgsign true ``` #### Set signing key conditionally If you maintain signing keys for separate purposes, such as work and personal use, use an `IncludeIf` statement in your `.gitconfig` file to set which key you sign commits with. Prerequisites: - Requires Git version 2.13 or later. 1. In the same directory as your main `~/.gitconfig` file, create a second file, such as `.gitconfig-gitlab`. 1. In your main `~/.gitconfig` file, add your Git settings for work in non-GitLab projects. 1. Append this information to the end of your main `~/.gitconfig` file: ```ini # The contents of this file are included only for GitLab.com URLs [includeIf "hasconfig:remote.*.url:https://gitlab.com/**"] # Edit this line to point to your alternative configuration file path = ~/.gitconfig-gitlab ``` 1. In your alternative `.gitconfig-gitlab` file, add the configuration overrides to use when you're committing to a GitLab repository. All settings from your main `~/.gitconfig` file are retained unless you explicitly override them. In this example, ```ini # Alternative ~/.gitconfig-gitlab file # These values are used for repositories matching the string 'gitlab.com', # and override their corresponding values in ~/.gitconfig [user] email = you@example.com signingkey = <KEY ID> [commit] gpgsign = true ``` ## Revoke a GPG key If a GPG key becomes compromised, revoke it. Revoking a key changes both future and past commits: - Past commits signed by this key are marked as unverified. - Future commits signed by this key are marked as unverified. To revoke a GPG key: 1. On the left sidebar, select your avatar. 1. Select **Edit profile**. 1. Select **GPG keys** ({{< icon name="key" >}}). 1. Select **Revoke** next to the GPG key you want to delete. ## Remove a GPG key When you remove a GPG key from your GitLab account: - Previous commits signed with this key remain verified. - Future commits (including any commits created but not yet pushed) that attempt to use this key are unverified. To remove a GPG key from your account: 1. On the left sidebar, select your avatar. 1. Select **Edit profile**. 1. Select **GPG keys** ({{< icon name="key" >}}). 1. Select **Remove** ({{< icon name="remove" >}}) next to the GPG key you want to delete. If you must unverify both future and past commits, [revoke the associated GPG key](#revoke-a-gpg-key) instead. ## Related topics - [Configure commit signing for commits made in the web UI](../../../../administration/gitaly/configure_gitaly.md#configure-commit-signing-for-gitlab-ui-commits) - GPG resources: - [Git Tools - Signing Your Work](https://git-scm.com/book/en/v2/Git-Tools-Signing-Your-Work) - [Managing OpenPGP Keys](https://riseup.net/en/security/message-security/openpgp/gpg-keys) - [OpenPGP Best Practices](https://riseup.net/en/security/message-security/openpgp/best-practices) - [Creating a new GPG key with subkeys](https://www.void.gr/kargig/blog/2013/12/02/creating-a-new-gpg-key-with-subkeys/) (advanced) - [View GPG keys in your instance](../../../../administration/credentials_inventory.md#view-gpg-keys) - [Beyond Identity integration](../../integrations/beyond_identity.md) ## Troubleshooting ### Secret key not available If you receive the errors `secret key not available` or `gpg: signing failed: secret key not available`, try using `gpg2` instead of `gpg`: ```shell git config --global gpg.program gpg2 ``` If your GPG key is password protected and the password entry prompt does not appear, add `export GPG_TTY=$(tty)` to your shell's `rc` file (commonly `~/.bashrc` or `~/.zshrc`) ### GPG fails to sign data If your GPG key is password protected, and you receive one of the following errors: ```plaintext error: gpg failed to sign the data fatal: failed to write commit object gpg: signing failed: Inappropriate ioctl for device ``` If the password entry prompt doesn't appear: 1. Open your shell's configuration file, commonly `~/.bashrc` or `~/.zshrc`, in a text editor. 1. Add the following line to the file: ```shell export GPG_TTY=$(tty) ``` 1. Save the file and exit the text editor. 1. Apply the changes. Choose one of the following: - Restart your terminal. - Run `source ~/.bashrc` or `source ~/.zshrc`. {{< alert type="note" >}} The exact steps may vary depending on your operating system and shell configuration. {{< /alert >}}
https://docs.gitlab.com/user/project/repository/csv
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/repository/csv.md
2025-08-13
doc/user/project/repository/files
[ "doc", "user", "project", "repository", "files" ]
csv.md
Create
Source Code
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
CSV files
How comma-separated values (CSV) files display in GitLab projects.
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} A comma-separated values (CSV) file is a delimited text file that uses a comma to separate values. Each line of the file is a data record. Each record consists of one or more fields, separated by commas. The use of the comma as a field separator is the source of the name for this file format. A CSV file typically stores tabular data (numbers and text) in plain text, in which case each line has the same number of fields. The CSV file format is not fully standardized. Other characters can be used as column delimiters. Fields may or may not be surrounded to escape special characters. When added to a repository, files with a `.csv` extension are rendered as a table when viewed in GitLab: ![CSV file rendered as a table](img/csv_as_table_v17_10.png) ## CSV parsing considerations GitLab uses the [Papa Parse](https://github.com/mholt/PapaParse/) library to parse CSV files. This library follows [RFC4180](https://datatracker.ietf.org/doc/html/rfc4180) and has strict formatting requirements that can cause parsing issues with certain CSV formats. For example: - Spacing around comma (`,`) separators and double quotes (`"`) can cause parsing errors. - Fields containing both commas and double quotes can cause the parser to misidentify field boundaries. The following format causes parsing errors: ```plaintext "field1", "field2", "field3" ``` The following format parses successfully: ```plaintext "field1","field2","field3" ``` If your CSV file doesn't display correctly in GitLab: - If fields are enclosed in double quotes (`"`), ensure the double quotes and comma (`,`) separators are immediately adjacent, with no spaces in between. - Enclose all fields that contain special characters in double quotes (`"`). - Test how the CSV file displays in GitLab after making changes. These parsing requirements only affect the visual rendering of CSV files and do not impact the actual file content stored in your repository.
--- stage: Create group: Source Code info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments description: How comma-separated values (CSV) files display in GitLab projects. title: CSV files breadcrumbs: - doc - user - project - repository - files --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} A comma-separated values (CSV) file is a delimited text file that uses a comma to separate values. Each line of the file is a data record. Each record consists of one or more fields, separated by commas. The use of the comma as a field separator is the source of the name for this file format. A CSV file typically stores tabular data (numbers and text) in plain text, in which case each line has the same number of fields. The CSV file format is not fully standardized. Other characters can be used as column delimiters. Fields may or may not be surrounded to escape special characters. When added to a repository, files with a `.csv` extension are rendered as a table when viewed in GitLab: ![CSV file rendered as a table](img/csv_as_table_v17_10.png) ## CSV parsing considerations GitLab uses the [Papa Parse](https://github.com/mholt/PapaParse/) library to parse CSV files. This library follows [RFC4180](https://datatracker.ietf.org/doc/html/rfc4180) and has strict formatting requirements that can cause parsing issues with certain CSV formats. For example: - Spacing around comma (`,`) separators and double quotes (`"`) can cause parsing errors. - Fields containing both commas and double quotes can cause the parser to misidentify field boundaries. The following format causes parsing errors: ```plaintext "field1", "field2", "field3" ``` The following format parses successfully: ```plaintext "field1","field2","field3" ``` If your CSV file doesn't display correctly in GitLab: - If fields are enclosed in double quotes (`"`), ensure the double quotes and comma (`,`) separators are immediately adjacent, with no spaces in between. - Enclose all fields that contain special characters in double quotes (`"`). - Test how the CSV file displays in GitLab after making changes. These parsing requirements only affect the visual rendering of CSV files and do not impact the actual file content stored in your repository.
https://docs.gitlab.com/user/project/repository/git_history
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/repository/git_history.md
2025-08-13
doc/user/project/repository/files
[ "doc", "user", "project", "repository", "files" ]
git_history.md
Create
Source Code
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Git file history
How to view a file's Git history in GitLab.
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} Git file history provides information about the commit history associated with a file: ![A list of 3 commits for a single file, with the newest commit marked as 'Verified'.](img/file_history_output_v17_2.png) Each commit shows: - The date of the commit. GitLab groups together all commits made on the same day. - The user's avatar. - The user's name. Hover over the name to see the user's job title, location, local time, and current status message. - The date of the commit, in time-ago format. To see the precise date and time of the commit, hover over the date. - If the [commit is signed](../signed_commits/_index.md), a **Verified** badge. - The commit SHA. GitLab shows the first 8 characters. Select **Copy commit SHA** ({{< icon name="copy-to-clipboard" >}}) to copy the entire SHA. - A link to browse ({{< icon name="folder-open" >}}) the file as it appeared at the time of this commit. GitLab retrieves the user name and email information from the [Git configuration](https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration) of the contributor when the user creates a commit. ## View a file's Git history To see a file's Git history in the UI: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Code > Repository**. 1. Go to your desired file in the repository. 1. In the last commit block, select **History**. ## Limit history range of results {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/423108) in GitLab 16.9. {{< /history >}} When reviewing history for old files, or files with many commits, you can limit the search results by date. Limiting the dates for commits helps fix [commit history requests timeouts](https://gitlab.com/gitlab-org/gitaly/-/issues/5426) in very large repositories. In the GitLab UI, edit the URL. Include these parameters in `YYYY-MM-DD` format: - `committed_before` - `committed_after` Separate each key-value pair in the query string with an ampersand (`&`), like this: ```plaintext ?ref_type=heads&committed_after=2023-05-15&committed_before=2023-11-22 ``` The full URL to the range of commits looks like this: ```plaintext https://gitlab.com/gitlab-org/gitlab/-/commits/master/CONTRIBUTING.md?ref_type=heads&committed_after=2023-05-15&committed_before=2023-11-22 ``` ## Related topics - [Git blame](git_blame.md) - [Common Git commands](../../../../topics/git/commands.md) - [File management with Git](../../../../topics/git/file_management.md)
--- stage: Create group: Source Code info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments description: How to view a file's Git history in GitLab. title: Git file history breadcrumbs: - doc - user - project - repository - files --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} Git file history provides information about the commit history associated with a file: ![A list of 3 commits for a single file, with the newest commit marked as 'Verified'.](img/file_history_output_v17_2.png) Each commit shows: - The date of the commit. GitLab groups together all commits made on the same day. - The user's avatar. - The user's name. Hover over the name to see the user's job title, location, local time, and current status message. - The date of the commit, in time-ago format. To see the precise date and time of the commit, hover over the date. - If the [commit is signed](../signed_commits/_index.md), a **Verified** badge. - The commit SHA. GitLab shows the first 8 characters. Select **Copy commit SHA** ({{< icon name="copy-to-clipboard" >}}) to copy the entire SHA. - A link to browse ({{< icon name="folder-open" >}}) the file as it appeared at the time of this commit. GitLab retrieves the user name and email information from the [Git configuration](https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration) of the contributor when the user creates a commit. ## View a file's Git history To see a file's Git history in the UI: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Code > Repository**. 1. Go to your desired file in the repository. 1. In the last commit block, select **History**. ## Limit history range of results {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/423108) in GitLab 16.9. {{< /history >}} When reviewing history for old files, or files with many commits, you can limit the search results by date. Limiting the dates for commits helps fix [commit history requests timeouts](https://gitlab.com/gitlab-org/gitaly/-/issues/5426) in very large repositories. In the GitLab UI, edit the URL. Include these parameters in `YYYY-MM-DD` format: - `committed_before` - `committed_after` Separate each key-value pair in the query string with an ampersand (`&`), like this: ```plaintext ?ref_type=heads&committed_after=2023-05-15&committed_before=2023-11-22 ``` The full URL to the range of commits looks like this: ```plaintext https://gitlab.com/gitlab-org/gitlab/-/commits/master/CONTRIBUTING.md?ref_type=heads&committed_after=2023-05-15&committed_before=2023-11-22 ``` ## Related topics - [Git blame](git_blame.md) - [Common Git commands](../../../../topics/git/commands.md) - [File management with Git](../../../../topics/git/file_management.md)
https://docs.gitlab.com/user/project/repository/git_blame
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/repository/git_blame.md
2025-08-13
doc/user/project/repository/files
[ "doc", "user", "project", "repository", "files" ]
git_blame.md
Create
Source Code
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Git file blame
Documentation on Git file blame.
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} [Git blame](https://git-scm.com/docs/git-blame) provides more information about every line in a file, including the last modified time, author, and commit hash. ## View blame for a file {{< history >}} - Viewing blame directly in the file view [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/430950) in GitLab 16.7 [with flag](../../../../administration/feature_flags/_index.md) named `inline_blame`. Disabled by default. {{< /history >}} Prerequisites: - The file type must be text-based. The GitLab UI does not display `git blame` results for binary files. To view the blame for a file: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Code > Repository**. 1. Select the file you want to review. 1. Either: - To change the view of the current file, in the file header, select **Blame**. - To open the full blame page, in the upper-right corner, select **Blame**. 1. Go to the line you want to see. When you select **Blame**, this information is displayed: ![Git blame output](img/file_blame_output_v16_6.png "Blame button output") To see the precise date and time of the commit, hover over the date. The vertical bar to the left of the user avatar shows the general age of the commit. The newest commits have a dark blue bar. As the age of the commit increases, the bar color changes to light gray. ### Blame previous commit To see earlier revisions of a specific line: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Code > Repository**. 1. Select the file you want to review. 1. In the upper-right corner, select **Blame**, and go to the line you want to see. 1. Select **View blame prior to this change** ({{< icon name="doc-versions" >}}) until you've found the changes you're interested in viewing. ### Ignore specific revisions {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/514684) in GitLab 17.10 [with a flag](../../../../administration/feature_flags/_index.md) named `blame_ignore_revs`. Disabled by default. - [Enabled on GitLab.com, GitLab Self-Managed, and GitLab Dedicated](https://gitlab.com/gitlab-org/gitlab/-/issues/514325) in GitLab 17.10. - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/issues/525095) in GitLab 17.11. Feature flag `blame_ignore_revs` removed. {{< /history >}} To configure Git blame to ignore specific revisions: 1. In the root of your repository, create a `.git-blame-ignore-revs` file. 1. Add the commit hashes you want to ignore, one per line. For example: ```plaintext a24cb33c0e1390b0719e9d9a4a4fc0e4a3a069cc 676c1c7e8b9e2c9c93e4d5266c6f3a50ad602a4c ``` 1. Open a file in the blame view. 1. Select the **Blame preferences** dropdown list. 1. Select **Ignore specific revisions**. The blame view refreshes and skips the revisions specified in the `.git-blame-ignore-revs` file, showing the previous meaningful changes instead. ## Related topics - [Git file blame REST API](../../../../api/repository_files.md#get-file-blame-from-repository) - [Common Git commands](../../../../topics/git/commands.md) - [File management with Git](../../../../topics/git/file_management.md)
--- stage: Create group: Source Code info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments description: Documentation on Git file blame. title: Git file blame breadcrumbs: - doc - user - project - repository - files --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} [Git blame](https://git-scm.com/docs/git-blame) provides more information about every line in a file, including the last modified time, author, and commit hash. ## View blame for a file {{< history >}} - Viewing blame directly in the file view [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/430950) in GitLab 16.7 [with flag](../../../../administration/feature_flags/_index.md) named `inline_blame`. Disabled by default. {{< /history >}} Prerequisites: - The file type must be text-based. The GitLab UI does not display `git blame` results for binary files. To view the blame for a file: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Code > Repository**. 1. Select the file you want to review. 1. Either: - To change the view of the current file, in the file header, select **Blame**. - To open the full blame page, in the upper-right corner, select **Blame**. 1. Go to the line you want to see. When you select **Blame**, this information is displayed: ![Git blame output](img/file_blame_output_v16_6.png "Blame button output") To see the precise date and time of the commit, hover over the date. The vertical bar to the left of the user avatar shows the general age of the commit. The newest commits have a dark blue bar. As the age of the commit increases, the bar color changes to light gray. ### Blame previous commit To see earlier revisions of a specific line: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Code > Repository**. 1. Select the file you want to review. 1. In the upper-right corner, select **Blame**, and go to the line you want to see. 1. Select **View blame prior to this change** ({{< icon name="doc-versions" >}}) until you've found the changes you're interested in viewing. ### Ignore specific revisions {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/514684) in GitLab 17.10 [with a flag](../../../../administration/feature_flags/_index.md) named `blame_ignore_revs`. Disabled by default. - [Enabled on GitLab.com, GitLab Self-Managed, and GitLab Dedicated](https://gitlab.com/gitlab-org/gitlab/-/issues/514325) in GitLab 17.10. - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/issues/525095) in GitLab 17.11. Feature flag `blame_ignore_revs` removed. {{< /history >}} To configure Git blame to ignore specific revisions: 1. In the root of your repository, create a `.git-blame-ignore-revs` file. 1. Add the commit hashes you want to ignore, one per line. For example: ```plaintext a24cb33c0e1390b0719e9d9a4a4fc0e4a3a069cc 676c1c7e8b9e2c9c93e4d5266c6f3a50ad602a4c ``` 1. Open a file in the blame view. 1. Select the **Blame preferences** dropdown list. 1. Select **Ignore specific revisions**. The blame view refreshes and skips the revisions specified in the `.git-blame-ignore-revs` file, showing the previous meaningful changes instead. ## Related topics - [Git file blame REST API](../../../../api/repository_files.md#get-file-blame-from-repository) - [Common Git commands](../../../../topics/git/commands.md) - [File management with Git](../../../../topics/git/file_management.md)
https://docs.gitlab.com/user/project/repository/git_attributes
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/repository/git_attributes.md
2025-08-13
doc/user/project/repository/files
[ "doc", "user", "project", "repository", "files" ]
git_attributes.md
Create
Source Code
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Git attributes
Define custom Git attributes for your GitLab project to set options for file handling, display, locking, and storage.
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} GitLab supports defining custom Git attributes in a `.gitattributes` file in the root directory of your repository. Use the `.gitattributes` file to declare changes to file handling and display, such as: - [Collapse generated files](../../merge_requests/changes.md#collapse-generated-files) in diffs. - Create [custom merge drivers](#custom-merge-drivers). - Create [exclusive lock files](../../file_lock.md) to mark files as read-only. - Change [syntax highlighting](highlighting.md) in diffs. - Declare binary file handling with [Git LFS](../../../../topics/git/lfs/_index.md). - Declare [languages used in your repository](../_index.md#add-repository-languages). ## Encoding requirements The `.gitattributes` file must be encoded in UTF-8 and must not contain a Byte Order Mark. If a different encoding is used, the file's contents are ignored. ## Support for mixed file encodings GitLab attempts to detect the encoding of files automatically, but defaults to UTF-8 unless the detector is confident of a different type (such as `ISO-8859-1`). Incorrect encoding detection can result in some characters not displaying in the text, such as accented characters in a non-UTF-8 encoding. Git has built-in support for handling this eventuality and automatically converts files between a designated encoding and UTF-8 for the repository itself. Configure support for mixed file encoding in the `.gitattributes` file using the `working-tree-encoding` attribute. Example: ```plaintext *.xhtml text working-tree-encoding=ISO-8859-1 ``` With this example configuration, Git maintains all `.xhtml` files in the repository in ISO-8859-1 encoding in the local tree, but converts to and from UTF-8 when committing into the repository. GitLab renders the files accurately as it only sees correctly encoded UTF-8. If applying this configuration to an existing repository, files may need to be touched and recommitted if the local copy has the correct encoding but the repository does not. This can be performed for the whole repository by running `git add --renormalize .`. For more information, see [working-tree-encoding](https://git-scm.com/docs/gitattributes#_working_tree_encoding). ## Syntax highlighting The `.gitattributes` file can be used to define which language to use when syntax highlighting files and diffs. For more information, see [Syntax highlighting](highlighting.md). ## Custom merge drivers {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab Self-Managed, GitLab Dedicated {{< /details >}} GitLab Self-Managed administrators can define [custom merge drivers](https://git-scm.com/docs/gitattributes#_defining_a_custom_merge_driver) in a GitLab configuration file, then use the custom merge drivers in a Git `.gitattributes` file. Custom merge drivers are not supported on GitLab.com. Custom merge drivers are a Git feature that gives you advanced control over conflict resolution. A custom merge driver is invoked only in the case of a non-trivial [merge conflict](../../merge_requests/conflicts.md), so it is not a reliable way of preventing some files from being merged. ### Configure a custom merge driver The following example illustrates how to define and use a custom merge driver in GitLab. How to configure a custom merge driver depends on the type of installation. {{< tabs >}} {{< tab title="Linux package (Omnibus)" >}} 1. Edit `/etc/gitlab/gitlab.rb`. 1. Add configuration similar to the following: ```ruby gitaly['configuration'] = { # ... git: { # ... config: [ # ... { key: "merge.foo.driver", value: "true" }, ], }, } ``` {{< /tab >}} {{< tab title="Self-compiled (source)" >}} 1. Edit `gitaly.toml`. 1. Add configuration similar to the following: ```toml [[git.config]] key = "merge.foo.driver" value = "true" ``` {{< /tab >}} {{< /tabs >}} In this example, during a merge, Git uses the `driver` value as the command to execute. In this case, because we are using [`true`](https://man7.org/linux/man-pages/man1/true.1.html) with no arguments, it always returns a non-zero return code. This means that for the files specified in `.gitattributes`, merges do nothing. To use your own merge driver, replace the value in `driver` to point to an executable. For more details on how this command is invoked, see the Git documentation on [custom merge drivers](https://git-scm.com/docs/gitattributes#_defining_a_custom_merge_driver). ### Use `.gitattributes` to set files custom merge driver applies to In a `.gitattributes` file, you can set the paths of files you want to use with the custom merge driver. For example: ```plaintext config/* merge=foo ``` In this case, every file under the `config/` folder uses the custom merge driver called `foo` defined in the GitLab configuration. ## Resources - Official Git documentation for [Git attributes](https://git-scm.com/docs/gitattributes)
--- stage: Create group: Source Code info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments description: Define custom Git attributes for your GitLab project to set options for file handling, display, locking, and storage. title: Git attributes breadcrumbs: - doc - user - project - repository - files --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} GitLab supports defining custom Git attributes in a `.gitattributes` file in the root directory of your repository. Use the `.gitattributes` file to declare changes to file handling and display, such as: - [Collapse generated files](../../merge_requests/changes.md#collapse-generated-files) in diffs. - Create [custom merge drivers](#custom-merge-drivers). - Create [exclusive lock files](../../file_lock.md) to mark files as read-only. - Change [syntax highlighting](highlighting.md) in diffs. - Declare binary file handling with [Git LFS](../../../../topics/git/lfs/_index.md). - Declare [languages used in your repository](../_index.md#add-repository-languages). ## Encoding requirements The `.gitattributes` file must be encoded in UTF-8 and must not contain a Byte Order Mark. If a different encoding is used, the file's contents are ignored. ## Support for mixed file encodings GitLab attempts to detect the encoding of files automatically, but defaults to UTF-8 unless the detector is confident of a different type (such as `ISO-8859-1`). Incorrect encoding detection can result in some characters not displaying in the text, such as accented characters in a non-UTF-8 encoding. Git has built-in support for handling this eventuality and automatically converts files between a designated encoding and UTF-8 for the repository itself. Configure support for mixed file encoding in the `.gitattributes` file using the `working-tree-encoding` attribute. Example: ```plaintext *.xhtml text working-tree-encoding=ISO-8859-1 ``` With this example configuration, Git maintains all `.xhtml` files in the repository in ISO-8859-1 encoding in the local tree, but converts to and from UTF-8 when committing into the repository. GitLab renders the files accurately as it only sees correctly encoded UTF-8. If applying this configuration to an existing repository, files may need to be touched and recommitted if the local copy has the correct encoding but the repository does not. This can be performed for the whole repository by running `git add --renormalize .`. For more information, see [working-tree-encoding](https://git-scm.com/docs/gitattributes#_working_tree_encoding). ## Syntax highlighting The `.gitattributes` file can be used to define which language to use when syntax highlighting files and diffs. For more information, see [Syntax highlighting](highlighting.md). ## Custom merge drivers {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab Self-Managed, GitLab Dedicated {{< /details >}} GitLab Self-Managed administrators can define [custom merge drivers](https://git-scm.com/docs/gitattributes#_defining_a_custom_merge_driver) in a GitLab configuration file, then use the custom merge drivers in a Git `.gitattributes` file. Custom merge drivers are not supported on GitLab.com. Custom merge drivers are a Git feature that gives you advanced control over conflict resolution. A custom merge driver is invoked only in the case of a non-trivial [merge conflict](../../merge_requests/conflicts.md), so it is not a reliable way of preventing some files from being merged. ### Configure a custom merge driver The following example illustrates how to define and use a custom merge driver in GitLab. How to configure a custom merge driver depends on the type of installation. {{< tabs >}} {{< tab title="Linux package (Omnibus)" >}} 1. Edit `/etc/gitlab/gitlab.rb`. 1. Add configuration similar to the following: ```ruby gitaly['configuration'] = { # ... git: { # ... config: [ # ... { key: "merge.foo.driver", value: "true" }, ], }, } ``` {{< /tab >}} {{< tab title="Self-compiled (source)" >}} 1. Edit `gitaly.toml`. 1. Add configuration similar to the following: ```toml [[git.config]] key = "merge.foo.driver" value = "true" ``` {{< /tab >}} {{< /tabs >}} In this example, during a merge, Git uses the `driver` value as the command to execute. In this case, because we are using [`true`](https://man7.org/linux/man-pages/man1/true.1.html) with no arguments, it always returns a non-zero return code. This means that for the files specified in `.gitattributes`, merges do nothing. To use your own merge driver, replace the value in `driver` to point to an executable. For more details on how this command is invoked, see the Git documentation on [custom merge drivers](https://git-scm.com/docs/gitattributes#_defining_a_custom_merge_driver). ### Use `.gitattributes` to set files custom merge driver applies to In a `.gitattributes` file, you can set the paths of files you want to use with the custom merge driver. For example: ```plaintext config/* merge=foo ``` In this case, every file under the `config/` folder uses the custom merge driver called `foo` defined in the GitLab configuration. ## Resources - Official Git documentation for [Git attributes](https://git-scm.com/docs/gitattributes)
https://docs.gitlab.com/user/project/repository/files
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/repository/_index.md
2025-08-13
doc/user/project/repository/files
[ "doc", "user", "project", "repository", "files" ]
_index.md
Create
Remote Development
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
File management
Search for files in your GitLab repository directly from the GitLab user interface.
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} The GitLab UI extends the history and tracking capabilities of Git with user-friendly features in your browser. You can: - Search for files. - Change file handling. - Explore the history of an entire file, or a single line. ## Understand how file types render in the UI When you add files of these types to your project, GitLab renders their output to improve readability: - [GeoJSON](geojson.md) files display as maps. - [Jupyter Notebook](jupyter_notebooks/_index.md) files display as rendered HTML. - Files in many markup languages are rendered for display. ### Supported markup languages If your file has one of the these file extensions, GitLab renders the contents of the file's [markup language](https://en.wikipedia.org/wiki/Lightweight_markup_language) in the UI. | Markup language | Extensions | |--------------------------------------------------------------|------------| | Plain text | `txt` | | [Markdown](../../../markdown.md) | `mdown`, `mkd`, `mkdn`, `md`, `markdown` | | [reStructuredText](https://docutils.sourceforge.io/rst.html) | `rst` | | [AsciiDoc](../../../asciidoc.md) | `adoc`, `ad`, `asciidoc` | | [Textile](https://textile-lang.com/) | `textile` | | [Rdoc](https://rdoc.sourceforge.net/doc/index.html) | `rdoc` | | [Org mode](https://orgmode.org/) | `org` | | [creole](http://www.wikicreole.org/) | `creole` | | [MediaWiki](https://www.mediawiki.org/wiki/MediaWiki) | `wiki`, `mediawiki` | ### README and index files When a `README` or `index` file is present in a repository, GitLab renders its contents. These files can either be plain text or have the extension of a supported markup language. - When both a `README` and an `index` file are present, the `README` takes precedence. - When multiple files with the same name have different extensions, the files are ordered alphabetically. GitLab orders files without an extension last, like this: 1. `README.adoc` 1. `README.md` 1. `README.rst` 1. `README`. ### Render OpenAPI files GitLab renders OpenAPI specification files if the filename includes `openapi` or `swagger`, and the extension is `yaml`, `yml`, or `json`. These examples are all correct: - `openapi.yml`, `openapi.yaml`, `openapi.json` - `swagger.yml`, `swagger.yaml`, `swagger.json` - `OpenAPI.YML`, `openapi.Yaml`, `openapi.JSON` - `openapi_gitlab.yml`, `openapi.gitlab.yml` - `gitlab_swagger.yml` - `gitlab.openapi.yml` To render an OpenAPI file: 1. [Search for](#search-for-a-file) the OpenAPI file in your repository. 1. Select **Display rendered file**. 1. To display the `operationId` in the operations list, add `displayOperationId=true` to the query string. {{< alert type="note" >}} When `displayOperationId` is present in the query string and has any value, it evaluates to `true`. This behavior matches the default behavior of Swagger. {{< /alert >}} ## View Git records for a file Historical information about files in your repository is available in the GitLab UI: - [Git file history](git_history.md): shows the commit history of an entire file. - [Git blame](git_blame.md): shows each line of a text-based file, and the most recent commit that changed the line. ## Create permalinks Permalinks are permanent URLs that point to specific files, directories, or sections of code in your repository. They remain valid even when the repository changes, making them ideal for sharing and referencing code in documentation, issues, or merge requests. To create a permalink: 1. On the left sidebar, select **Search or go to** and find your project. 1. Go to the file or directory you want to link to. 1. Optional. For specific code selections: - **Single line**: Select the line number. - **Multiple lines**: Select the first line number, then hold <kbd>Shift</kbd> and select the last line number. - **Markdown anchor**: Hover over a heading to reveal the anchor link ({{< icon name="link" >}}), and select it. 1. Select **Actions** ({{< icon name="ellipsis_v" >}}), then select **Copy Permalink**. Alternatively, press <kbd>y</kbd>. For more shortcuts, see [keyboard shortcuts](../../../shortcuts.md). ## View open merge requests for a file {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/448868) in GitLab 17.10 [with a flag](../../../../administration/feature_flags/_index.md) named `filter_blob_path`. - [Enabled on GitLab.com](https://gitlab.com/gitlab-org/gitlab/-/issues/505449) in GitLab 17.11. - [Enabled on GitLab Self-Managed and GitLab Dedicated](https://gitlab.com/gitlab-org/gitlab/-/issues/505449) in GitLab 18.0. - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/issues/539215) in GitLab 18.2. Feature flag `filter_blob_path` removed. {{< /history >}} {{< alert type="flag" >}} The availability of this feature is controlled by a feature flag. For more information, see the history. {{< /alert >}} When viewing a repository file, GitLab shows a badge with the number of open merge requests that target the current branch and modify the file. This helps you identify files that have pending changes. To view the open merge requests for a file: 1. On the left sidebar, select **Search or go to** and find your project. 1. Go to the file you want to view. 1. At the top right of the screen, next to the filename, look for the green badge with the number of {{< icon name="merge-request-open" >}} **Open** merge requests. 1. Select the badge to see a list of open merge requests created in the past 30 days. 1. Select any merge request in the list to go to that merge request. ## Search for a file {{< history >}} - [Changed](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/148025) to a dialog in GitLab 16.11. {{< /history >}} Use the file finder to search directly from the GitLab UI for a file in your repository. The file finder uses fuzzy search and highlights results as you type. To search for a file, press <kbd>t</kbd> anywhere in your project, or: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Code** > **Repository**. 1. In the upper right, select **Find file**. 1. On the dialog, start entering the filename: ![Find file button](img/file_finder_v17_2.png) 1. Optional. To narrow the search options, press <kbd>Command</kbd> + <kbd>K</kbd> or select **Commands** on the lower right corner of the dialog: - For **Pages or actions**, enter <kbd>></kbd>. - For **Users**, enter <kbd>@</kbd>. - For **Projects**, enter <kbd>:</kbd>. - For **Files**, enter <kbd>~</kbd>. 1. From the dropdown list, select the file to view it in your repository. To go back to the **Files** page, press <kbd>Esc</kbd>. This feature uses the [`fuzzaldrin-plus`](https://github.com/jeancroy/fuzz-aldrin-plus) library. ## Change how Git handles a file To change the default handling of a file or file type, create a [`.gitattributes` file](git_attributes.md). Use `.gitattributes` files to: - Configure file display in diffs, such as [syntax highlighting](highlighting.md) or [collapsing generated files](../../merge_requests/changes.md#collapse-generated-files). - Control file storage and protection, such as [making files read-only](../../file_lock.md), or storing large files [with Git LFS](../../../../topics/git/lfs/_index.md). ## Related topics - [Repository files API](../../../../api/repository_files.md) - [File management with Git](../../../../topics/git/file_management.md) ## Troubleshooting ### Repository Languages: excessive CPU use To determine which languages are in a repository's files, GitLab uses a Ruby gem. When the gem parses a file to determine its file type, [the process can use excessive CPU](https://gitlab.com/gitlab-org/gitaly/-/issues/1565). The gem contains a [heuristics configuration file](https://github.com/github/linguist/blob/master/lib/linguist/heuristics.yml) that defines which file extensions to parse. These file types can take excessive CPU: - Files with the `.txt` extension. - XML files with an extension not defined by the gem. To fix this problem, edit your `.gitattributes` file and assign a language to specific file extensions. You can also use this approach to fix misidentified file types: 1. Identify the language to specify. The gem contains a [configuration file for known data types](https://github.com/github/linguist/blob/master/lib/linguist/languages.yml). 1. To add an entry for text files, for example: ```yaml Text: type: prose wrap: true aliases: - fundamental - plain text extensions: - ".txt" ``` 1. Add or edit `.gitattributes` in the root of your repository: ```plaintext *.txt linguist-language=Text ``` `*.txt` files have an entry in the heuristics file. This example prevents parsing of these files.
--- stage: Create group: Remote Development info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments description: Search for files in your GitLab repository directly from the GitLab user interface. title: File management breadcrumbs: - doc - user - project - repository - files --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} The GitLab UI extends the history and tracking capabilities of Git with user-friendly features in your browser. You can: - Search for files. - Change file handling. - Explore the history of an entire file, or a single line. ## Understand how file types render in the UI When you add files of these types to your project, GitLab renders their output to improve readability: - [GeoJSON](geojson.md) files display as maps. - [Jupyter Notebook](jupyter_notebooks/_index.md) files display as rendered HTML. - Files in many markup languages are rendered for display. ### Supported markup languages If your file has one of the these file extensions, GitLab renders the contents of the file's [markup language](https://en.wikipedia.org/wiki/Lightweight_markup_language) in the UI. | Markup language | Extensions | |--------------------------------------------------------------|------------| | Plain text | `txt` | | [Markdown](../../../markdown.md) | `mdown`, `mkd`, `mkdn`, `md`, `markdown` | | [reStructuredText](https://docutils.sourceforge.io/rst.html) | `rst` | | [AsciiDoc](../../../asciidoc.md) | `adoc`, `ad`, `asciidoc` | | [Textile](https://textile-lang.com/) | `textile` | | [Rdoc](https://rdoc.sourceforge.net/doc/index.html) | `rdoc` | | [Org mode](https://orgmode.org/) | `org` | | [creole](http://www.wikicreole.org/) | `creole` | | [MediaWiki](https://www.mediawiki.org/wiki/MediaWiki) | `wiki`, `mediawiki` | ### README and index files When a `README` or `index` file is present in a repository, GitLab renders its contents. These files can either be plain text or have the extension of a supported markup language. - When both a `README` and an `index` file are present, the `README` takes precedence. - When multiple files with the same name have different extensions, the files are ordered alphabetically. GitLab orders files without an extension last, like this: 1. `README.adoc` 1. `README.md` 1. `README.rst` 1. `README`. ### Render OpenAPI files GitLab renders OpenAPI specification files if the filename includes `openapi` or `swagger`, and the extension is `yaml`, `yml`, or `json`. These examples are all correct: - `openapi.yml`, `openapi.yaml`, `openapi.json` - `swagger.yml`, `swagger.yaml`, `swagger.json` - `OpenAPI.YML`, `openapi.Yaml`, `openapi.JSON` - `openapi_gitlab.yml`, `openapi.gitlab.yml` - `gitlab_swagger.yml` - `gitlab.openapi.yml` To render an OpenAPI file: 1. [Search for](#search-for-a-file) the OpenAPI file in your repository. 1. Select **Display rendered file**. 1. To display the `operationId` in the operations list, add `displayOperationId=true` to the query string. {{< alert type="note" >}} When `displayOperationId` is present in the query string and has any value, it evaluates to `true`. This behavior matches the default behavior of Swagger. {{< /alert >}} ## View Git records for a file Historical information about files in your repository is available in the GitLab UI: - [Git file history](git_history.md): shows the commit history of an entire file. - [Git blame](git_blame.md): shows each line of a text-based file, and the most recent commit that changed the line. ## Create permalinks Permalinks are permanent URLs that point to specific files, directories, or sections of code in your repository. They remain valid even when the repository changes, making them ideal for sharing and referencing code in documentation, issues, or merge requests. To create a permalink: 1. On the left sidebar, select **Search or go to** and find your project. 1. Go to the file or directory you want to link to. 1. Optional. For specific code selections: - **Single line**: Select the line number. - **Multiple lines**: Select the first line number, then hold <kbd>Shift</kbd> and select the last line number. - **Markdown anchor**: Hover over a heading to reveal the anchor link ({{< icon name="link" >}}), and select it. 1. Select **Actions** ({{< icon name="ellipsis_v" >}}), then select **Copy Permalink**. Alternatively, press <kbd>y</kbd>. For more shortcuts, see [keyboard shortcuts](../../../shortcuts.md). ## View open merge requests for a file {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/448868) in GitLab 17.10 [with a flag](../../../../administration/feature_flags/_index.md) named `filter_blob_path`. - [Enabled on GitLab.com](https://gitlab.com/gitlab-org/gitlab/-/issues/505449) in GitLab 17.11. - [Enabled on GitLab Self-Managed and GitLab Dedicated](https://gitlab.com/gitlab-org/gitlab/-/issues/505449) in GitLab 18.0. - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/issues/539215) in GitLab 18.2. Feature flag `filter_blob_path` removed. {{< /history >}} {{< alert type="flag" >}} The availability of this feature is controlled by a feature flag. For more information, see the history. {{< /alert >}} When viewing a repository file, GitLab shows a badge with the number of open merge requests that target the current branch and modify the file. This helps you identify files that have pending changes. To view the open merge requests for a file: 1. On the left sidebar, select **Search or go to** and find your project. 1. Go to the file you want to view. 1. At the top right of the screen, next to the filename, look for the green badge with the number of {{< icon name="merge-request-open" >}} **Open** merge requests. 1. Select the badge to see a list of open merge requests created in the past 30 days. 1. Select any merge request in the list to go to that merge request. ## Search for a file {{< history >}} - [Changed](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/148025) to a dialog in GitLab 16.11. {{< /history >}} Use the file finder to search directly from the GitLab UI for a file in your repository. The file finder uses fuzzy search and highlights results as you type. To search for a file, press <kbd>t</kbd> anywhere in your project, or: 1. On the left sidebar, select **Search or go to** and find your project. 1. Select **Code** > **Repository**. 1. In the upper right, select **Find file**. 1. On the dialog, start entering the filename: ![Find file button](img/file_finder_v17_2.png) 1. Optional. To narrow the search options, press <kbd>Command</kbd> + <kbd>K</kbd> or select **Commands** on the lower right corner of the dialog: - For **Pages or actions**, enter <kbd>></kbd>. - For **Users**, enter <kbd>@</kbd>. - For **Projects**, enter <kbd>:</kbd>. - For **Files**, enter <kbd>~</kbd>. 1. From the dropdown list, select the file to view it in your repository. To go back to the **Files** page, press <kbd>Esc</kbd>. This feature uses the [`fuzzaldrin-plus`](https://github.com/jeancroy/fuzz-aldrin-plus) library. ## Change how Git handles a file To change the default handling of a file or file type, create a [`.gitattributes` file](git_attributes.md). Use `.gitattributes` files to: - Configure file display in diffs, such as [syntax highlighting](highlighting.md) or [collapsing generated files](../../merge_requests/changes.md#collapse-generated-files). - Control file storage and protection, such as [making files read-only](../../file_lock.md), or storing large files [with Git LFS](../../../../topics/git/lfs/_index.md). ## Related topics - [Repository files API](../../../../api/repository_files.md) - [File management with Git](../../../../topics/git/file_management.md) ## Troubleshooting ### Repository Languages: excessive CPU use To determine which languages are in a repository's files, GitLab uses a Ruby gem. When the gem parses a file to determine its file type, [the process can use excessive CPU](https://gitlab.com/gitlab-org/gitaly/-/issues/1565). The gem contains a [heuristics configuration file](https://github.com/github/linguist/blob/master/lib/linguist/heuristics.yml) that defines which file extensions to parse. These file types can take excessive CPU: - Files with the `.txt` extension. - XML files with an extension not defined by the gem. To fix this problem, edit your `.gitattributes` file and assign a language to specific file extensions. You can also use this approach to fix misidentified file types: 1. Identify the language to specify. The gem contains a [configuration file for known data types](https://github.com/github/linguist/blob/master/lib/linguist/languages.yml). 1. To add an entry for text files, for example: ```yaml Text: type: prose wrap: true aliases: - fundamental - plain text extensions: - ".txt" ``` 1. Add or edit `.gitattributes` in the root of your repository: ```plaintext *.txt linguist-language=Text ``` `*.txt` files have an entry in the heuristics file. This example prevents parsing of these files.
https://docs.gitlab.com/user/project/repository/highlighting
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/repository/highlighting.md
2025-08-13
doc/user/project/repository/files
[ "doc", "user", "project", "repository", "files" ]
highlighting.md
Create
Source Code
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
Syntax Highlighting
Syntax highlighting helps you read files in your GitLab project and identify what files contain.
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} GitLab provides syntax highlighting on all files through [Highlight.js](https://github.com/highlightjs/highlight.js/) and the [Rouge](https://rubygems.org/gems/rouge) Ruby gem. It attempts to guess what language to use based on the file extension, which most of the time is sufficient. The paths here use the [`.gitattributes` interface](https://git-scm.com/docs/gitattributes) in Git. {{< alert type="note" >}} The [Web IDE](../../web_ide/_index.md) and [Snippets](../../../snippets.md) use [Monaco Editor](https://microsoft.github.io/monaco-editor/) for text editing, which internally uses the [Monarch](https://microsoft.github.io/monaco-editor/monarch.html) library for syntax highlighting. {{< /alert >}} ## Override syntax highlighting for a file type {{< alert type="note" >}} The Web IDE [does not support `.gitattribute` files](https://gitlab.com/gitlab-org/gitlab/-/issues/22014). {{< /alert >}} To override syntax highlighting for a file type: 1. If a `.gitattributes` file does not exist in the root directory of your project, create a blank file with this name. 1. For each file type you want to modify, add a line to the `.gitattributes` file declaring the file extension and your desired highlighting language: ```conf # This extension would typically receive Perl syntax highlighting # but if we also use Prolog, we may want to override highlighting for # files with this extension: *.pl gitlab-language=prolog ``` 1. Commit, push, and merge your changes into your default branch. After the changes merge into your [default branch](../branches/default.md), all `*.pl` files in your project are highlighted in your preferred language. You can also extend the highlighting with Common Gateway Interface (CGI) options, such as: ``` conf # JSON file with .erb in it /my-cool-file gitlab-language=erb?parent=json # An entire file of highlighting errors! /other-file gitlab-language=text?token=Error ``` ## Disable syntax highlighting for a file type To disable highlighting entirely for a file type, follow the instructions for overriding the highlighting for a file type, and use `gitlab-language=text`: ```conf # Disable syntax highlighting for this file type *.module gitlab-language=text ``` ## Configure maximum file size for highlighting By default, GitLab renders any file larger than 512 KB in plain text. To change this value: 1. Open the [`gitlab.yml`](https://gitlab.com/gitlab-org/gitlab-foss/blob/master/config/gitlab.yml.example) configuration file for your project. 1. Add this section, replacing `maximum_text_highlight_size_kilobytes` with the value you want. ```yaml gitlab: extra: ## Maximum file size for syntax highlighting ## https://docs.gitlab.com/ee/user/project/highlighting.html maximum_text_highlight_size_kilobytes: 512 ``` 1. Commit, push, and merge your changes into your default branch.
--- stage: Create group: Source Code info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments description: Syntax highlighting helps you read files in your GitLab project and identify what files contain. title: Syntax Highlighting breadcrumbs: - doc - user - project - repository - files --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} GitLab provides syntax highlighting on all files through [Highlight.js](https://github.com/highlightjs/highlight.js/) and the [Rouge](https://rubygems.org/gems/rouge) Ruby gem. It attempts to guess what language to use based on the file extension, which most of the time is sufficient. The paths here use the [`.gitattributes` interface](https://git-scm.com/docs/gitattributes) in Git. {{< alert type="note" >}} The [Web IDE](../../web_ide/_index.md) and [Snippets](../../../snippets.md) use [Monaco Editor](https://microsoft.github.io/monaco-editor/) for text editing, which internally uses the [Monarch](https://microsoft.github.io/monaco-editor/monarch.html) library for syntax highlighting. {{< /alert >}} ## Override syntax highlighting for a file type {{< alert type="note" >}} The Web IDE [does not support `.gitattribute` files](https://gitlab.com/gitlab-org/gitlab/-/issues/22014). {{< /alert >}} To override syntax highlighting for a file type: 1. If a `.gitattributes` file does not exist in the root directory of your project, create a blank file with this name. 1. For each file type you want to modify, add a line to the `.gitattributes` file declaring the file extension and your desired highlighting language: ```conf # This extension would typically receive Perl syntax highlighting # but if we also use Prolog, we may want to override highlighting for # files with this extension: *.pl gitlab-language=prolog ``` 1. Commit, push, and merge your changes into your default branch. After the changes merge into your [default branch](../branches/default.md), all `*.pl` files in your project are highlighted in your preferred language. You can also extend the highlighting with Common Gateway Interface (CGI) options, such as: ``` conf # JSON file with .erb in it /my-cool-file gitlab-language=erb?parent=json # An entire file of highlighting errors! /other-file gitlab-language=text?token=Error ``` ## Disable syntax highlighting for a file type To disable highlighting entirely for a file type, follow the instructions for overriding the highlighting for a file type, and use `gitlab-language=text`: ```conf # Disable syntax highlighting for this file type *.module gitlab-language=text ``` ## Configure maximum file size for highlighting By default, GitLab renders any file larger than 512 KB in plain text. To change this value: 1. Open the [`gitlab.yml`](https://gitlab.com/gitlab-org/gitlab-foss/blob/master/config/gitlab.yml.example) configuration file for your project. 1. Add this section, replacing `maximum_text_highlight_size_kilobytes` with the value you want. ```yaml gitlab: extra: ## Maximum file size for syntax highlighting ## https://docs.gitlab.com/ee/user/project/highlighting.html maximum_text_highlight_size_kilobytes: 512 ``` 1. Commit, push, and merge your changes into your default branch.
https://docs.gitlab.com/user/project/repository/geojson
https://gitlab.com/gitlab-org/gitlab/-/tree/master/doc/user/project/repository/geojson.md
2025-08-13
doc/user/project/repository/files
[ "doc", "user", "project", "repository", "files" ]
geojson.md
Create
Source Code
To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
GeoJSON files
How GeoJSON files are rendered when viewed in GitLab projects.
{{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/14134) in GitLab 16.1. {{< /history >}} A GeoJSON file is a format for encoding geographical data structures using JavaScript Object Notation (JSON). It is commonly used for representing geographic features, such as points, lines, and polygons, along with their associated attributes. When added to a repository, files with a `.geojson` extension are rendered as a map containing the GeoJSON data when viewed in GitLab. Map data comes from [OpenStreetMap](https://www.openstreetmap.org/) under the [Open Database License](https://www.openstreetmap.org/copyright). ![GeoJSON file rendered as a map](img/geo_json_file_rendered_v16_1.png)
--- stage: Create group: Source Code info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments description: How GeoJSON files are rendered when viewed in GitLab projects. title: GeoJSON files breadcrumbs: - doc - user - project - repository - files --- {{< details >}} - Tier: Free, Premium, Ultimate - Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated {{< /details >}} {{< history >}} - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/14134) in GitLab 16.1. {{< /history >}} A GeoJSON file is a format for encoding geographical data structures using JavaScript Object Notation (JSON). It is commonly used for representing geographic features, such as points, lines, and polygons, along with their associated attributes. When added to a repository, files with a `.geojson` extension are rendered as a map containing the GeoJSON data when viewed in GitLab. Map data comes from [OpenStreetMap](https://www.openstreetmap.org/) under the [Open Database License](https://www.openstreetmap.org/copyright). ![GeoJSON file rendered as a map](img/geo_json_file_rendered_v16_1.png)