Project import/export administration (FREE SELF)

GitLab provides Rake tasks relating to project import and export. For more information, see:

Project import status

You can query an import through the Project import/export API. As described in the API documentation, the query may return an import error or exceptions.

Import/export Rake tasks

The GitLab import/export version can be checked by using the following command:

# Omnibus installations
sudo gitlab-rake gitlab:import_export:version

# Installations from source
bundle exec rake gitlab:import_export:version RAILS_ENV=production

The current list of DB tables to export can be listed by using the following command:

# Omnibus installations
sudo gitlab-rake gitlab:import_export:data

# Installations from source
bundle exec rake gitlab:import_export:data RAILS_ENV=production

Note the following:

  • Importing is only possible if the version of the import and export GitLab instances are compatible as described in the Version history.

  • The project import option must be enabled:

    1. On the top bar, select Main menu > Admin.
    2. On the left sidebar, select Settings > General.
    3. Expand Visibility and access controls.
    4. Under Import sources, check the "Project export enabled" option.
    5. Select Save changes.
  • The exports are stored in a temporary directory and are deleted every 24 hours by a specific worker.

Import large projects using a Rake task

If you have a larger project, consider using a Rake task as described in our developer documentation.

Export using a Rake task

Introduced in GitLab 12.9.

You can use a Rake task to export large project.

Parameters:

Attribute Type Required Description
username string yes User name
namespace_path string yes Namespace path
project_path string yes Project name
archive_path string yes Path to file to store the export project tarball
gitlab-rake "gitlab:import_export:export[username, namespace_path, project_path, archive_path]"

Troubleshooting

If you are having trouble with import/export, you can enable debug mode using the same Rake task:

# Import
IMPORT_DEBUG=true gitlab-rake "gitlab:import_export:import[root, group/subgroup, testingprojectimport, /path/to/file_to_import.tar.gz]"

# Export
EXPORT_DEBUG=true gitlab-rake "gitlab:import_export:export[root, group/subgroup, projectnametoexport, /tmp/export_file.tar.gz]"