- Security
- Available project importers
- Import from Subversion
- Migrate using the API
- Migrate between two self-managed GitLab instances
- View project import history
- LFS authentication
- Project aliases
- Automate group and project import
- Troubleshooting
Import and migrate projects
If you want to bring existing projects to GitLab or copy GitLab projects to a different location, you can:
- Import projects from external systems using one of the available importers.
- Migrate GitLab projects:
- Between two GitLab self-managed instances.
- Between a self-managed instance and GitLab.com in both directions.
- In the same GitLab instance.
For any type of source and target, you can migrate GitLab projects:
- When migrating groups by direct transfer, which allows you to migrate all projects in a group simultaneously. Migrating projects by direct transfer is in Beta. The feature is not ready for production use.
- Using file exports. With this method you can migrate projects one by one. No network connection between instances is required.
If you only need to migrate Git repositories, you can import each project by URL. However, you can’t import issues and merge requests this way. To retain metadata like issues and merge requests, either:
- Migrate projects with groups by direct transfer. This feature is in Beta. It is not ready for production use.
- Use file exports to import projects.
Keep in mind the limitations of migrating using file exports. When migrating from self-managed to GitLab.com, user associations (such as comment author) are changed to the user who is importing the projects.
Security
Only import projects from sources you trust. If you import a project from an untrusted source,
an attacker could steal your sensitive data. For example, an imported project
with a malicious .gitlab-ci.yml
file could allow an attacker to exfiltrate group CI/CD variables.
GitLab self-managed administrators can reduce their attack surface by disabling import sources they don’t need:
- On the left sidebar, select Search or go to.
- Select Admin Area.
- Select Settings > General.
- Expand Visibility and access controls.
- Scroll to Import sources.
- Clear checkboxes for importers that are not required.
Available project importers
You can import projects from:
- Bitbucket Cloud
- Bitbucket Server (also known as Stash)
- ClearCase
- CVS
- FogBugz
- GitHub.com or GitHub Enterprise
- Gitea
- Perforce
- TFVC
- Repository by URL
- Uploading a manifest file (AOSP)
- Jira (issues only)
You can also import any Git repository through HTTP from the New Project page. If the repository is too large, the import can timeout.
You can then connect your external repository to get CI/CD benefits.
Import from Subversion
GitLab can not automatically migrate Subversion repositories to Git. Converting Subversion repositories to Git can be difficult, but several tools exist including:
-
git svn
, for very small and basic repositories. -
reposurgeon
, for larger and more complex repositories.
Migrate using the API
To migrate all data from self-managed to GitLab.com, you can leverage the API. Migrate the assets in this order:
You must still migrate your Container Registry over a series of Docker pulls and pushes. Re-run any CI pipelines to retrieve any build artifacts.
Migrate between two self-managed GitLab instances
To migrate from an existing self-managed GitLab instance to a new self-managed GitLab instance, you should back up the existing instance and restore it on the new instance. For example, you could use this method to migrate a self-managed instance from an old server to a new server.
The backups produced don’t depend on the operating system running GitLab. You can therefore use the restore method to switch between different operating system distributions or versions, as long as the same GitLab version is available for installation.
Administrators can use the Users API to migrate users.
View project import history
You can view all project imports created by you. This list includes the following:
- Paths of source projects if projects were imported from external systems, or import method if GitLab projects were migrated.
- Paths of destination projects.
- Start date of each import.
- Status of each import.
- Error details if any errors occurred.
To view project import history:
- Sign in to GitLab.
- On the left sidebar, at the top, select Create new () and New project/repository.
- Select Import project.
- In the upper-right corner, select History.
- If there are any errors for a particular import, you can see them by selecting Details.
The history also includes projects created from built-in or custom templates. GitLab uses import repository by URL to create a new project from a template.
LFS authentication
When importing a project that contains LFS objects, if the project has an .lfsconfig
file with a URL host (lfs.url
) different from the repository URL host, LFS files are not downloaded.
Project aliases
Introduced in GitLab 12.1.
GitLab repositories are usually accessed with a namespace and a project name. When migrating frequently accessed repositories to GitLab, however, you can use project aliases to access those repositories with the original name. Accessing repositories through a project alias reduces the risk associated with migrating such repositories.
This feature is only available on Git over SSH. Also, only GitLab administrators can create project aliases, and they can only do so through the API. For more information, see the Project Aliases API documentation.
After an administrator creates an alias for a project, you can use the alias to clone the
repository. For example, if an administrator creates the alias gitlab
for the project
https://gitlab.com/gitlab-org/gitlab
, you can clone the project with
git clone git@gitlab.com:gitlab.git
instead of git clone git@gitlab.com:gitlab-org/gitlab.git
.
Automate group and project import
The GitLab Professional Services team uses Congregate to orchestrate user, group, and project import API calls. With Congregate, you can migrate data to GitLab from:
- Other GitLab instances
- GitHub Enterprise
- GitHub.com
- Bitbucket Server
- Bitbucket Data Center
For more information, see:
- Information on paid GitLab migration services.
- Quick Start.
- Frequently Asked Migration Questions, including settings that need checking afterwards and other limitations.
For support, customers must enter into a paid engagement with GitLab Professional Services.
Troubleshooting
Imported repository is missing branches
If an imported repository does not contain all branches of the source repository:
- Set the environment variable
IMPORT_DEBUG=true
. - Retry the import with a different group, subgroup, or project name.
- If some branches are still missing, inspect
importer.log
(for example, withjq
).