Migrating GitLab groups (FREE)
You can migrate GitLab groups:
- From self-managed GitLab to GitLab.com.
- From GitLab.com to self-managed GitLab.
- From one self-managed GitLab instance to another.
- Between groups in the same GitLab instance.
You can migrate groups in two ways:
- By direct transfer (recommended).
- By uploading an export file.
If you migrate from GitLab.com to self-managed GitLab, an administrator can create users on the self-managed GitLab instance.
Migrate groups by direct transfer (recommended)
- Introduced in GitLab 13.7 for group resources with a flag named
bulk_import
. Disabled by default.- Group items enabled on GitLab.com and self-managed in GitLab 14.3.
- Introduced in GitLab 14.4 for project resources with a flag named
bulk_import_projects
. Disabled by default.- Enabled on GitLab.com in GitLab 15.6.
- New application setting
bulk_import_enabled
introduced in GitLab 15.8.bulk_import
feature flag removed.
FLAG:
On self-managed GitLab, by default migrating group items is not available. To show the
feature, ask an administrator to enable it in application settings.
Also on self-managed GitLab, by default migrating project items is not available. To show
this feature, ask an administrator to enable the feature flag named
bulk_import_projects
. The feature is not ready for production use. On GitLab.com, migration of both groups and projects is available.
You can migrate top-level groups to:
- Another top-level group.
- The subgroup of any existing top-level group.
- Another GitLab instance, including GitLab.com.
You can migrate:
- By direct transfer through either the UI or the API.
- Many groups at once.
- With projects (in Beta and not ready for production use) or without projects.
When you migrate a group by direct transfer, you can also migrate subgroups and projects. When you migrate a group:
- To GitLab.com, all its subgroups and projects are migrated too.
- To a self-managed instance, migrating project items is not available by default. An administrator must
enable the feature flag named
bulk_import_projects
.
WARNING: Migrating subgroups and projects this way is in Beta and is not ready for production use.
Not all group and project resources are imported. See list of migrated resources below:
Prerequisites:
- Network connection between instances or GitLab.com. Must support HTTPS.
- Both GitLab instances have migration enabled in application settings by an instance administrator.
- Owner role on the top-level source group to migrate from.
- At least the Maintainer role on the destination group to migrate to. Using the Developer role for this purpose was deprecated in GitLab 15.8 and will be removed in GitLab 16.0.
Preparation
GitLab maps users and their contributions correctly provided:
- Users already exist on the target GitLab instance.
- Users have a public email on the source GitLab instance that matches their primary email on the target GitLab instance.
- Users' primary email addresses on the target GitLab instance are confirmed. Most users receives an email asking them to confirm their email address.
- When using an OmniAuth provider like SAML, GitLab and SAML accounts of users on GitLab must be linked. All users on the target GitLab instance must sign in and verify their account on the target GitLab instance.
You might need to reconfigure your firewall to prevent blocking the connection on the self-managed instance.
If you use SAML SSO for GitLab.com groups, contributing users must have linked their SAML identity to their GitLab.com account.
When migrating to GitLab.com, you must create users manually unless SCIM is used. Creating users with the API is only available to self-managed instances because it requires administrator access.
Connect to the source GitLab instance
Create the group you want to import to and connect the source:
-
Create either:
- A new group. On the top bar, select {plus-square}, then New group, and select Import group.
- A new subgroup. On existing group's page, either:
- Select New subgroup.
- On the top bar, Select {plus-square} and then New subgroup. Then on the left sidebar, select the import an existing group link.
-
Enter the URL of your source GitLab instance.
-
Generate or copy a personal access token with the
api
scope on your source GitLab instance. Bothapi
andread_repository
scopes are required when migrating from GitLab 15.0 and earlier. -
Enter the personal access token for your source GitLab instance.
-
Select Connect instance.
Select the groups to import
Introduced in GitLab 15.8, option to import groups with or without projects.
After you have authorized access to the source GitLab instance, you are redirected to the GitLab group importer page. The top-level groups on the connected source instance you have the Owner role for are listed.
- By default, the proposed group namespaces match the names as they exist in source instance, but based on your permissions, you can choose to edit these names before you proceed to import any of them.
- Next to the groups you want to import, select either:
- Import with projects. Importing groups with projects is in Beta. This feature is not ready for production use.
- Import without projects.
-
Import on self-managed GitLab, when the
bulk_import_projects
feature flag is disabled and the feature is not available.
- The Status column shows the import status of each group. If you leave the page open, it updates in real-time.
- After a group has been imported, select its GitLab path to open its GitLab URL.
Group import history
You can view all groups migrated by you by direct transfer listed on the group import history page. This list includes:
- Paths of source groups.
- Paths of destination groups.
- Start date of each import.
- Status of each import.
- Error details if any errors occurred.
To view group import history:
- Sign in to GitLab.
- On the top bar, select Create new… ({plus-square}).
- Select New group.
- Select Import group.
- Select History in the upper right corner.
- If there are any errors for a particular import, you can see them by selecting Details.
Migrated group items
The import_export.yml
file for groups lists many of the items imported when migrating groups by direct transfer. View this file in the branch
for your version of GitLab to see the list of items relevant to you. For example,
import_export.yml
on the 14-10-stable-ee
branch.
Group items that are migrated to the target instance include:
- Badges (Introduced in 13.11)
- Board Lists
- Boards
- Epics (Introduced in 13.7)
- Epic resource state events (Introduced in GitLab 15.4)
- Finisher
- Group Labels (Introduced in 13.9)
- Iterations (Introduced in 13.10)
- Iterations cadences (Introduced in 15.4)
- Members (Introduced in 13.9)
Group members are associated with the imported group if:
- The user already exists in the target GitLab instance and
- The user has a public email in the source GitLab instance that matches a confirmed email in the target GitLab instance
- Milestones (Introduced in 13.10)
- Namespace Settings
- Releases
- Milestones (Introduced in GitLab 15.0).
- Subgroups
- Uploads
Any other items are not migrated.
Migrated project items (beta)
- Introduced in GitLab 14.4 with a flag named
bulk_import_projects
. Disabled by default.- Enabled on GitLab.com in GitLab 15.6.
FLAG:
On self-managed GitLab, migrating project resources when migrating groups is not available by default.
To make it available ask an administrator to enable the feature flag named
bulk_import_projects
. On GitLab.com, groups are migrated with all their projects by default.
The import_export.yml
file for projects lists many of the items imported when migrating projects using group migration. View this file in the branch
for your version of GitLab to see the list of items relevant to you. For example,
import_export.yml
on the 14-10-stable-ee
branch.
WARNING: Migrating projects when migrating groups by direct transfer is in Beta and is not ready for production use.
Project items that are migrated to the target instance include:
- Projects (Introduced in GitLab 14.4)
- Auto DevOps (Introduced in GitLab 14.6)
- Badges (Introduced in GitLab 14.6)
- Branches (including protected branches) (Introduced in GitLab 14.7)
- CI Pipelines (Introduced in GitLab 14.6)
- Designs (Introduced in GitLab 15.1)
- Issues (Introduced in GitLab 14.4)
- Issue iteration (Introduced in 15.4)
- Issue resource state events (Introduced in GitLab 15.4)
- Issue resource milestone events (Introduced in GitLab 15.4)
- Issue resource iteration events (Introduced in GitLab 15.4)
- Merge request URL references (Introduced in GitLab 15.6)
- Time Tracking (Introduced in GitLab 14.4)
- Issue boards (Introduced in GitLab 14.4)
- Labels (Introduced in GitLab 14.4)
- LFS Objects (Introduced in GitLab 14.8)
- Members (Introduced in GitLab 14.8)
- Merge Requests (Introduced in GitLab 14.5)
- Multiple merge request assignees (Introduced in GitLab 15.3)
- Merge request reviewers (Introduced in GitLab 15.3)
- Merge request approvers (Introduced in GitLab 15.3)
- Merge request resource state events (Introduced in GitLab 15.4)
- Merge request resource milestone events (Introduced in GitLab 15.4)
- Issue URL references (Introduced in GitLab 15.6)
- Time Tracking (Introduced in GitLab 14.5)
- Push Rules (Introduced in GitLab 14.6)
- Milestones (Introduced in GitLab 14.5)
- External Pull Requests (Introduced in GitLab 14.5)
- Pipeline History (Introduced in GitLab 14.6)
- Pipeline Schedules (Introduced in GitLab 14.8)
- Project Features (Introduced in GitLab 14.6)
- Releases (Introduced in GitLab 15.1)
- Release Evidences (Introduced in GitLab 15.1)
- Repositories (Introduced in GitLab 14.4)
- Snippets (Introduced in GitLab 14.6)
- Settings (Introduced in GitLab 14.6)
- Avatar (Introduced in GitLab 14.6)
- Container Expiration Policy (Introduced in GitLab 14.6)
- Project Properties (Introduced in GitLab 14.6)
- Service Desk (Introduced in GitLab 14.6)
- Uploads (Introduced in GitLab 14.5)
- Wikis (Introduced in GitLab 14.6)
Items excluded from migration, because they contain sensitive information:
- Pipeline Triggers.
Migrating projects with file exports uses the same export and import mechanisms as creating projects from templates at the group and instance levels. Therefore, the list of exported items is the same.
Troubleshooting
In a rails console session, you can find the failure or error messages for the group import attempt using:
# Get relevant import records
import = BulkImports::Entity.where(namespace_id: Group.id).map(&:bulk_import)
# Alternative lookup by user
import = BulkImport.where(user_id: User.find(...)).last
# Get list of import entities. Each entity represents either a group or a project
entities = import.entities
# Get a list of entity failures
entities.map(&:failures).flatten
# Alternative failure lookup by status
entities.where(status: [-1]).pluck(:destination_name, :destination_namespace, :status)
You can also see all migrated entities with any failures related to them using an API endpoint.
Stale imports
Introduced in GitLab 14.10.
When troubleshooting group migration, an import may not complete because the import workers took
longer than 8 hours to execute. In this case, the status
of either a BulkImport
or
BulkImport::Entity
is 3
(timeout
):
# Get relevant import records
import = BulkImports::Entity.where(namespace_id: Group.id).map(&:bulk_import)
import.status #=> 3 means that the import timed out.
404 Group Not Found
Error: If you attempt to import a group that has a path comprised of only numbers (for example, 5000
), GitLab attempts to
find the group by ID instead of the path. This causes a 404 Group Not Found
error in GitLab 15.4 and earlier.
To solve this, you must change the source group path to include a non-numerical character using either:
-
The GitLab UI:
- On the top bar, select Main menu > Groups and find your group.
- On the left sidebar, select Settings > General.
- Expand Advanced.
- Under Change group URL, change the group URL to include non-numeric characters.
-
The Groups API.
Provide feedback
Please leave your feedback about migrating groups by direct transfer in the feedback issue.
Migrate groups by uploading an export file (deprecated)
- Introduced in GitLab 13.0 as an experimental feature. May change in future releases.
- Deprecated in GitLab 14.6.
WARNING: This feature was deprecated in GitLab 14.6 and replaced by migrating groups by direct transfer. To follow progress on a solution for offline environments, see the relevant epic.
Prerequisites:
- Owner role on the group to migrate.
Using file exports, you can:
- Export any group to a file and upload that file to another GitLab instance or to another location on the same instance.
- Use either the GitLab UI or the API.
- Migrate groups one by one, then export and import each project for the groups one by one.
GitLab maps user contributions correctly when an admin access token is used to perform the import. GitLab does not map user contributions correctly when you are importing from a self-managed instance to GitLab.com. Correct mapping of user contributions when importing from a self-managed instance to GitLab.com can be preserved with paid involvement of Professional Services team.
Note the following:
- Exports are stored in a temporary directory and are deleted every 24 hours by a specific worker.
- To preserve group-level relationships from imported projects, export and import groups first so that projects can be imported into the desired group structure.
- Imported groups are given a
private
visibility level, unless imported into a parent group. - If imported into a parent group, a subgroup inherits the same level of visibility unless otherwise restricted.
- You can export groups from the Community Edition to the Enterprise Edition and vice versa. The Enterprise Edition retains some group data that isn't part of the Community Edition. If you're exporting a group from the Enterprise Edition to the Community Edition, you may lose this data. For more information, see downgrading from EE to CE.
Exported contents
The import_export.yml
file for groups lists items exported and imported when migrating groups using file exports. View this file in the branch
for your version of GitLab to see the list of items relevant to you. For example,
import_export.yml
on the 14-10-stable-ee
branch.
Group items that are exported include:
- Milestones
- Labels
- Boards and Board Lists
- Badges
- Subgroups (including all the aforementioned data)
- Epics
- Epic resource state events (Introduced in GitLab 15.4)
- Events
- Wikis (Introduced in GitLab 13.9)
- Iterations cadences (Introduced in 15.4)
Items that are not exported include:
- Projects
- Runner tokens
- SAML discovery tokens
Preparation
- To preserve the member list and their respective permissions on imported groups, review the users in these groups. Make sure these users exist before importing the desired groups.
- Users must set a public email in the source GitLab instance that matches one of their verified emails in the target GitLab instance.
Enable export for a group
Prerequisite:
- You must have the Owner role for the group.
To enable import and export for a group:
- On the top bar, select Main menu > Admin.
- On the left sidebar, select Settings > General.
- Expand Visibility and access controls.
- In the Import sources section, select the checkboxes for the sources you want.
Export a group
Prerequisites:
- You must have the Owner role for the group.
To export the contents of a group:
-
On the top bar, select Main menu > Groups and find your group.
-
On the left sidebar, select Settings > General.
-
In the Advanced section, select Export Group.
-
After the export is generated, you should receive an email with a link to the exported contents in a compressed tar archive, with contents in NDJSON format.
-
Alternatively, you can download the export from the UI:
- Return to your group's Settings > General page.
- In the Advanced section, select Download export. You can also generate a new file by selecting Regenerate export.
You can also export a group using the API.
Import the group
- Create a new group:
- On the top bar, select Create new… ({plus-square}) and then New group.
- On an existing group's page, select New subgroup.
- Select Import group.
- Enter your group name.
- Accept or modify the associated group URL.
- Select Choose file.
- Select the file that you exported in the Export a group section.
- To begin importing, select Import group.
Your newly imported group page appears after the operation completes.
NOTE:
The maximum import file size can be set by the administrator, default is 0
(unlimited).
As an administrator, you can modify the maximum import file size. To do so, use the max_import_size
option in the
Application settings API or the
Admin Area.
Default modified from 50 MB to 0 in GitLab 13.8.
Rate limits
To help avoid abuse, by default, users are rate limited to:
Request Type | Limit |
---|---|
Export | 6 groups per minute |
Download export | 1 download per group per minute |
Import | 6 groups per minute |
Version history
14.0+
In GitLab 14.0, the JSON format is no longer supported for project and group exports. To allow for a transitional period, you can still import any JSON exports. The new format for imports and exports is NDJSON.
13.0+
GitLab can import bundles that were exported from a different GitLab deployment. This ability is limited to two previous GitLab minor releases, which is similar to our process for Security Releases.
For example:
Current version | Can import bundles exported from |
---|---|
13.0 | 13.0, 12.10, 12.9 |
13.1 | 13.1, 13.0, 12.10 |
Automate group and project import (PREMIUM)
For information on automating user, group, and project import API calls, see Automate group and project import.