Migrate GitLab projects from a GitLab group to another GitLab's group
Project description
gitlab-projects-migrate
Migrate GitLab projects from a GitLab group to another GitLab's group
Purpose
The migration can be performed between entirely different GitLab servers.
The following steps are required before using the tool:
- The groups need to be created manually by the user or by a GitLab administrator
- The GitLab user tokens must be created with an
api
scope (a short expiration date is recommended)
Examples
# Show the helper menu
gitlab-projects-migrate
# Migrate projects from one group to another, then migrate subgroups
gitlab-projects-migrate 'https://gitlab.com' 'old/group' 'https://gitlab.com' 'new/group'
gitlab-projects-migrate 'https://gitlab.com' 'old/group/subgroup1' 'https://gitlab.com' 'new/group/subgroup1'
gitlab-projects-migrate 'https://gitlab.com' 'old/group/subgroup2' 'https://gitlab.com' 'new/group/subgroup2'
# Migrate projects from one GitLab to another GitLab
gitlab-projects-migrate 'https://old.gitlab.com' 'group/subgroup' 'https://new.gitlab.com'
Usage
usage: gitlab-projects-migrate [-h] [--version] [--update-check] [--settings] [--set GROUP KEY VAL] [-I INPUT_TOKEN]
[-O OUTPUT_TOKEN] [--archive-exports FOLDER] [--delete-sources] [--dry-run]
[--exclude-group] [--exclude-subgroups] [--exclude-projects] [--keep-members]
[--overwrite] [--set-avatar FILE] [--update-description] [--]
[input_gitlab] [input_path] [output_gitlab] [output_namespace]
gitlab-projects-migrate: Migrate GitLab projects from a GitLab group to another GitLab's group
internal arguments:
-h, --help # Show this help message
--version # Show the current version
--update-check # Check for newer package updates
--settings # Show the current settings path and contents
--set GROUP KEY VAL # Set settings specific 'VAL' value to [GROUP] > KEY
# or unset by using 'UNSET' as 'VAL'
credentials arguments:
-I INPUT_TOKEN # Input GitLab API token (default: GITLAB_INPUT_TOKEN or GITLAB_TOKEN environments)
-O OUTPUT_TOKEN # Output GitLab API token (default: GITLAB_OUTPUT_TOKEN, GITLAB_TOKEN environments, or INPUT_TOKEN argument)
migration arguments:
--archive-exports FOLDER # Store exported projects and groups to a folder
--delete-sources # Delete sources after successful migration
--dry-run # Enable dry run mode to check without saving
--exclude-group # Exclude parent group migration
--exclude-subgroups # Exclude children subgroups migration
--exclude-projects # Exclude children projects migration
--keep-members # Keep input members after importing on output GitLab
--overwrite # Overwrite existing projects on output GitLab
general settings arguments:
--set-avatar FILE # Set avatar of GitLab output projects and groups
--update-description # Update description of GitLab output projects and groups automatically
positional arguments:
-- # Positional arguments separator (recommended)
input_gitlab # Input GitLab URL (default: https://gitlab.com)
input_path # Input GitLab group, user namespace or project path
output_gitlab # Output GitLab URL (default: https://gitlab.com)
output_namespace # Output GitLab group or user namespace
Userspace available settings
gitlab-projects-migrate
creates a settings.ini
configuration file in a userspace folder.
For example, it allows to disable the automated updates daily check ([updates] > enabled
)
The settings.ini
file location and contents can be shown with the following command:
gitlab-projects-migrate --settings
Environment available configurations
gitlab-projects-migrate
uses colored
for colors outputs and questionary
for interactive menus.
If colors of both outputs types do not match the terminal's theme,
an environment variable NO_COLOR=1
can be defined to disable colors.
Dependencies
- colored: Terminal colors and styles
- python-gitlab: A python wrapper for the GitLab API
- questionary: Interactive terminal user interfaces
- setuptools: Build and manage Python packages
- update-checker: Check for package updates on PyPI
References
- git-chglog: CHANGELOG generator
- gitlab-release: Utility for publishing on GitLab
- gitlabci-local: Launch .gitlab-ci.yml jobs locally
- mypy: Optional static typing for Python
- PyPI: The Python Package Index
- twine: Utility for publishing on PyPI
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for gitlab_projects_migrate-3.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | abd8882fd90cde164cb8fb9fa8e601e2a62d817b906367ac9cf84d1142206657 |
|
MD5 | 8220fe33461902237c86b05734df1c37 |
|
BLAKE2b-256 | 2c8796558588828b5bc914b048caa3c3a5bcc32e7e75e28b81d663f5381ee6a3 |
Hashes for gitlab_projects_migrate-3.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ef5a93b51e65bcad801059cc1acb103a72f10dcfca83d2099fe8950e337ab51e |
|
MD5 | f27dc8c90a9cc3dcde1423cb9541d341 |
|
BLAKE2b-256 | ff5b3dfae64f772046e7bdede0c5e134ddc95280ea8271826dff636bba8d9333 |