debian-mirror-gitlab/doc/user/project/settings/import_export.md

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

255 lines
13 KiB
Markdown
Raw Normal View History

2020-10-24 23:57:45 +05:30
---
2021-01-29 00:20:46 +05:30
stage: Manage
group: Import
2022-11-25 23:54:43 +05:30
info: "To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/product/ux/technical-writing/#assignments"
2020-10-24 23:57:45 +05:30
---
2022-07-23 23:45:48 +05:30
# Migrating projects using file exports **(FREE)**
2016-08-24 12:49:21 +05:30
2022-03-02 08:16:31 +05:30
Existing projects on any self-managed GitLab instance or GitLab.com can be exported to a file and
2022-07-23 23:45:48 +05:30
then imported into a new GitLab instance. You can also:
2023-05-27 22:25:52 +05:30
- Migrate projects when you [migrate groups by direct transfer](../../group/import/index.md#migrate-groups-by-direct-transfer-recommended).
- [Migrate groups by using file exports](../../group/import/index.md#migrate-groups-by-uploading-an-export-file-deprecated).
2020-03-13 15:44:24 +05:30
2023-03-04 22:38:38 +05:30
GitLab maps user contributions correctly when an admin access token is used to perform the import.
2023-04-23 21:23:45 +05:30
Consequently, migrating projects using file exports does not map user contributions correctly when you are importing
2023-03-04 22:38:38 +05:30
projects from a self-managed instance to GitLab.com.
Instead, all GitLab user associations (such as comment author) are changed to the user importing the project. For more
information, see the prerequisites and important notes in these sections:
- [Export a project and its data](../settings/import_export.md#export-a-project-and-its-data).
- [Import the project](../settings/import_export.md#import-a-project-and-its-data).
To preserve contribution history, [migrate using direct transfer](../../group/import/index.md#migrate-groups-by-direct-transfer-recommended).
If you migrate from GitLab.com to self-managed GitLab, an administrator can create users on the self-managed GitLab instance.
2023-04-23 21:23:45 +05:30
## Compatibility
FLAG:
On self-managed GitLab by default project, file exports are in NDJSON format. To make GitLab produce project file
exports in JSON format, ask an administrator to [disable the feature flags](../../../administration/feature_flags.md)
named `project_export_as_ndjson`. To allow GitLab to import project file exports in JSON format, ask an administrator to
[disable the feature flags](../../../administration/feature_flags.md) named `project_import_ndjson`. On GitLab.com,
project file exports are in NDJSON format only.
Project file exports are in NDJSON format. Before version 14.0, GitLab produced project file exports in JSON format.
To support transitions, you can still import JSON-formatted project file exports if you configure the relevant feature
flags.
From GitLab 13.0, GitLab can import project file exports that were exported from a version of GitLab up to two
[minor](../../../policy/maintenance.md#versioning) versions behind, which is similar to our process for
[security releases](../../../policy/maintenance.md#security-releases).
For example:
| Destination version | Compatible source versions |
|:--------------------|:---------------------------|
| 13.0 | 13.0, 12.10, 12.9 |
| 13.1 | 13.1, 13.0, 12.10 |
2023-03-17 16:20:25 +05:30
## Configure file exports as an import source **(FREE SELF)**
2020-03-13 15:44:24 +05:30
2023-03-17 16:20:25 +05:30
Before you can migrate projects on a self-managed GitLab instance using file exports, GitLab administrators must:
2020-03-13 15:44:24 +05:30
2023-03-17 16:20:25 +05:30
1. [Enable file exports](../../admin_area/settings/visibility_and_access_controls.md#enable-project-export) on the source
instance.
1. Enable file exports as an import source for the destination instance. On GitLab.com, file exports are already enabled
as an import source.
To enable file exports as an import source for the destination instance:
1. On the top bar, select **Main menu > Admin**.
2022-03-02 08:16:31 +05:30
1. On the left sidebar, select **Settings > General**.
1. Expand **Visibility and access controls**.
1. Scroll to **Import sources**.
2023-03-17 16:20:25 +05:30
1. Select the **GitLab export** checkbox.
2020-03-13 15:44:24 +05:30
2022-03-02 08:16:31 +05:30
## Between CE and EE
2021-06-08 01:23:25 +05:30
2022-03-02 08:16:31 +05:30
You can export projects from the [Community Edition to the Enterprise Edition](https://about.gitlab.com/install/ce-or-ee/)
2023-04-23 21:23:45 +05:30
and vice versa, assuming [compatibility](#compatibility) is met.
2020-07-28 23:09:34 +05:30
2022-03-02 08:16:31 +05:30
If you're exporting a project from the Enterprise Edition to the Community Edition, you may lose
data that is retained only in the Enterprise Edition. For more information, see
[downgrading from EE to CE](../../../index.md).
2020-05-24 23:13:21 +05:30
2022-03-02 08:16:31 +05:30
## Export a project and its data
2020-05-24 23:13:21 +05:30
2022-03-02 08:16:31 +05:30
Before you can import a project, you must export it.
2020-05-24 23:13:21 +05:30
2022-03-02 08:16:31 +05:30
Prerequisites:
2020-05-24 23:13:21 +05:30
2023-03-04 22:38:38 +05:30
- Review the list of [items that are exported](#items-that-are-exported). Not all items are exported.
2022-03-02 08:16:31 +05:30
- You must have at least the Maintainer role for the project.
2023-03-17 16:20:25 +05:30
- Users must [set a public email](../../profile/index.md#set-your-public-email) in the source GitLab instance that matches one of their verified emails in the target GitLab instance for the user mapping to work correctly.
2020-03-13 15:44:24 +05:30
2022-03-02 08:16:31 +05:30
To export a project and its data, follow these steps:
2020-05-24 23:13:21 +05:30
2022-10-11 01:57:18 +05:30
1. On the top bar, select **Main menu > Projects** and find your project.
2022-07-16 23:28:13 +05:30
1. On the left sidebar, select **Settings > General**.
2022-03-02 08:16:31 +05:30
1. Expand **Advanced**.
1. Select **Export project**.
1. After the export is generated, you should receive an email with a link to download the file.
1. Alternatively, you can come back to the project settings and download the file from there or
generate a new export. After the file is available, the page should show the **Download export**
button.
2020-05-24 23:13:21 +05:30
2022-03-02 08:16:31 +05:30
The export is generated in your configured `shared_path`, a temporary shared directory, and then
moved to your configured `uploads_directory`. Every 24 hours, a worker deletes these export files.
2020-05-24 23:13:21 +05:30
2022-03-02 08:16:31 +05:30
### Items that are exported
2016-08-24 12:49:21 +05:30
2022-10-11 01:57:18 +05:30
The [`import_export.yml`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/import_export/project/import_export.yml)
2022-11-25 23:54:43 +05:30
file for projects lists many of the items exported and imported when migrating projects using file exports. View this file in the branch
2022-10-11 01:57:18 +05:30
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](https://gitlab.com/gitlab-org/gitlab/-/blob/14-10-stable-ee/lib/gitlab/import_export/project/import_export.yml).
Migrating projects with file exports uses the same export and import mechanisms as creating projects from templates at the [group](../../group/custom_project_templates.md) and
[instance](../../admin_area/custom_project_templates.md) levels. Therefore, the list of exported items is the same.
Items that are exported include:
2016-08-24 12:49:21 +05:30
- Project and wiki repositories
- Project uploads
2020-07-28 23:09:34 +05:30
- Project configuration, excluding integrations
2022-10-11 01:57:18 +05:30
- Issues
- Issue comments
2022-11-25 23:54:43 +05:30
- Issue iteration ([Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/96184) in 15.4)
2022-10-11 01:57:18 +05:30
- Issue resource state events ([Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/291983) in GitLab 15.4)
- Issue resource milestone events ([Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/291983) in GitLab 15.4)
2022-11-25 23:54:43 +05:30
- Issue resource iteration events ([Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/291983) in GitLab 15.4)
2022-10-11 01:57:18 +05:30
- Merge requests
- Merge request diffs
- Merge request comments
- Merge request resource state events ([Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/291983) in GitLab 15.4)
- Merge request multiple assignees ([Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/339520) in GitLab 15.3)
- Merge request reviewers ([Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/339520) in GitLab 15.3)
- Merge request approvers ([Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/339520) in GitLab 15.3)
- Labels
- Milestones
- Snippets
- Time tracking and other project entities
2020-04-22 19:07:51 +05:30
- Design Management files and data
2018-05-09 12:01:36 +05:30
- LFS objects
2019-10-12 21:52:04 +05:30
- Issue boards
2020-04-08 14:13:33 +05:30
- Pipelines history
2021-02-22 17:27:13 +05:30
- Push Rules
2021-04-17 20:07:23 +05:30
- Awards
2022-03-02 08:16:31 +05:30
- Group members are exported as project members, as long as the user has the Maintainer role in the
exported project's group, or is an administrator
2016-08-24 12:49:21 +05:30
2022-10-11 01:57:18 +05:30
Items that are **not** exported include:
2016-08-24 12:49:21 +05:30
2022-06-21 17:19:12 +05:30
- [Child pipeline history](https://gitlab.com/gitlab-org/gitlab/-/issues/221088)
2016-08-24 12:49:21 +05:30
- Build traces and artifacts
2022-07-23 23:45:48 +05:30
- Package and container registry images
2021-04-17 20:07:23 +05:30
- CI/CD variables
2021-09-30 23:02:18 +05:30
- Pipeline triggers
2019-02-15 15:39:39 +05:30
- Webhooks
2017-08-17 22:00:37 +05:30
- Any encrypted tokens
2023-04-23 21:23:45 +05:30
- [Number of required approvals](https://gitlab.com/gitlab-org/gitlab/-/issues/221087)
2021-09-30 23:02:18 +05:30
- Repository size limits
2022-03-02 08:16:31 +05:30
- Deploy keys allowed to push to protected branches
2022-07-16 23:28:13 +05:30
- Secure Files
2023-05-27 22:25:52 +05:30
- [Activity logs for Git-related events](https://gitlab.com/gitlab-org/gitlab/-/issues/214700) (for example, pushing and creating tags)
- Security policies associated with your project
2019-09-30 21:07:59 +05:30
2022-03-02 08:16:31 +05:30
## Import a project and its data
2021-01-29 00:20:46 +05:30
2022-03-02 08:16:31 +05:30
> Default maximum import file size [changed](https://gitlab.com/gitlab-org/gitlab/-/issues/251106) from 50 MB to unlimited in GitLab 13.8.
2016-08-24 12:49:21 +05:30
2022-03-02 08:16:31 +05:30
WARNING:
Only import projects from sources you trust. If you import a project from an untrusted source, it
may be possible for an attacker to steal your sensitive data.
2021-12-11 22:18:48 +05:30
2022-03-02 08:16:31 +05:30
Prerequisites:
2016-08-24 12:49:21 +05:30
2022-03-02 08:16:31 +05:30
- You must have [exported the project and its data](#export-a-project-and-its-data).
- Compare GitLab versions and ensure you are importing to a GitLab version that is the same or later
than the GitLab version you exported to.
2023-04-23 21:23:45 +05:30
- Review [compatibility](#compatibility) for any issues.
2023-03-17 16:20:25 +05:30
- At least the Maintainer role on the destination group to migrate to. Using the Developer role for this purpose was
[deprecated](https://gitlab.com/gitlab-org/gitlab/-/issues/387891) in GitLab 15.8 and will be removed in GitLab 16.0.
2016-08-24 12:49:21 +05:30
2022-03-02 08:16:31 +05:30
To import a project:
2016-08-24 12:49:21 +05:30
2023-03-17 16:20:25 +05:30
1. When [creating a new project](../index.md#create-a-project),
2022-03-02 08:16:31 +05:30
select **Import project**.
1. In **Import project from**, select **GitLab export**.
1. Enter your project name and URL. Then select the file you exported previously.
1. Select **Import project** to begin importing. Your newly imported project page appears shortly.
2016-08-24 12:49:21 +05:30
2023-03-04 22:38:38 +05:30
To get the status of an import, you can query it through the [API](../../../api/project_import_export.md#import-status).
2022-03-02 08:16:31 +05:30
As described in the API documentation, the query may return an import error or exceptions.
2016-08-24 12:49:21 +05:30
2022-11-25 23:54:43 +05:30
### Changes to imported items
2016-08-24 12:49:21 +05:30
2022-11-25 23:54:43 +05:30
Exported items are imported with the following changes:
2016-08-24 12:49:21 +05:30
2022-11-25 23:54:43 +05:30
- Project members with the Owner role are imported with the Maintainer role.
- If an imported project contains merge requests originating from forks, new branches associated with these merge
requests are created in the project. Therefore, the number of branches in the new project can be more than in the
source project.
- If the `Internal` visibility level [is restricted](../../public_access.md#restrict-use-of-public-or-internal-projects),
2022-03-02 08:16:31 +05:30
all imported projects are given `Private` visibility.
2021-10-27 15:23:28 +05:30
2022-03-02 08:16:31 +05:30
Deploy keys aren't imported. To use deploy keys, you must enable them in your imported project and update protected branches.
2021-12-11 22:18:48 +05:30
2022-03-02 08:16:31 +05:30
### Import large projects **(FREE SELF)**
2016-08-24 12:49:21 +05:30
2023-05-27 22:25:52 +05:30
If you have a larger project, consider [using a Rake task](../../../administration/raketasks/project_import_export.md#import-large-projects).
2016-08-24 12:49:21 +05:30
2022-03-02 08:16:31 +05:30
## Automate group and project import **(PREMIUM)**
2016-08-24 12:49:21 +05:30
2022-03-02 08:16:31 +05:30
For information on automating user, group, and project import API calls, see
[Automate group and project import](../import/index.md#automate-group-and-project-import).
2016-08-24 12:49:21 +05:30
2022-03-02 08:16:31 +05:30
## Maximum import file size
2016-08-24 12:49:21 +05:30
2022-03-02 08:16:31 +05:30
Administrators can set the maximum import file size one of two ways:
2019-10-12 21:52:04 +05:30
2022-03-02 08:16:31 +05:30
- With the `max_import_size` option in the [Application settings API](../../../api/settings.md#change-application-settings).
- In the [Admin Area UI](../../admin_area/settings/account_and_limit_settings.md#max-import-size).
2020-03-13 15:44:24 +05:30
2022-03-02 08:16:31 +05:30
The default is `0` (unlimited).
2020-06-23 00:09:42 +05:30
2022-07-23 23:45:48 +05:30
For the GitLab.com setting, see the [Account and limit settings](../../gitlab_com/index.md#account-and-limit-settings)
section of the GitLab.com settings page.
2022-03-02 08:16:31 +05:30
## Map users for import
2020-07-28 23:09:34 +05:30
2022-03-02 08:16:31 +05:30
Imported users can be mapped by their public email addresses on self-managed instances, if an administrator (not an owner) does the import.
2020-07-28 23:09:34 +05:30
2022-06-21 17:19:12 +05:30
- The project must be exported by a project or group member with the Owner role.
- Public email addresses are not set by default. Users must [set it in their profiles](../../profile/index.md#set-your-public-email)
for mapping to work correctly.
2022-03-02 08:16:31 +05:30
- For contributions to be mapped correctly, users must be an existing member of the namespace,
2022-10-11 01:57:18 +05:30
or they can be added as a member of the project. Otherwise, a supplementary comment is left to mention that the original
author and the merge requests, notes, or issues that are owned by the importer.
2022-04-04 11:22:00 +05:30
- Imported users are set as [direct members](../members/index.md)
in the imported project.
2020-07-28 23:09:34 +05:30
2022-03-02 08:16:31 +05:30
For project migration imports performed over GitLab.com groups, preserving author information is
possible through a [professional services engagement](https://about.gitlab.com/services/migration/).
2020-07-28 23:09:34 +05:30
2023-03-04 22:38:38 +05:30
## Rate limits
2021-02-22 17:27:13 +05:30
To help avoid abuse, by default, users are rate limited to:
2020-03-13 15:44:24 +05:30
2022-03-02 08:16:31 +05:30
| Request Type | Limit |
| ---------------- | ----- |
| Export | 6 projects per minute |
| Download export | 1 download per group per minute |
| Import | 6 projects per minute |
2020-03-13 15:44:24 +05:30
2022-03-02 08:16:31 +05:30
## Related topics
2023-03-04 22:38:38 +05:30
- [Project import and export API](../../../api/project_import_export.md)
- [Project import and export administration Rake tasks](../../../administration/raketasks/project_import_export.md)
- [Migrating GitLab groups](../../group/import/index.md)
- [Group import and export API](../../../api/group_import_export.md)