This project facilitates the migration of repositories between different version control platforms, such as GitLab, Bitbucket, and GitHub, to a GitHub organization.
bitbucket/ flow.sh github/ gitlab/ logs/ readme.md scripts/ add_rules.sh add_teams.sh add_workflows.sh bitbucket_github.sh gitlab_github.sh sources/ source_repos.csv source_teams.csv
Below are the most relevant files of the project:
- /sources/*.csv: Contains the lists of repositories and teams to migrate.
- /scripts/status_repos.sh: Checks if the repositories exist on GitHub.
- /scripts/migrate_repos.sh: Performs the migration of repositories to GitHub.
- /scripts/cleanup.sh: Deletes repositories from GitHub and cleans directories.
- /scripts/*.sh: Additional scripts for migration.
- /flow.sh: Central script to organize tasks (migrate, validate, clean, etc.).
- /config.env: Environment variables with the required credentials.
The config.env
file contains the environment variables needed for the migration process. These variables include tokens and usernames for accessing the different version control platforms. Below is an example of the config.env
file:
GH_TOKEN="your_github_token"
BITBUCKET_TOKEN="your_bitbucket_token"
BITBUCKET_USERNAME="your_bitbucket_username"
GITLAB_TOKEN="your_gitlab_token"
GH_OLD_TOKEN="your_old_github_token"
AZDEVOPS_TOKEN="your_azure_devops_token"
AZDEVOPS_USERNAME="your_azure_devops_username"
Make sure to replace the placeholder values with your actual credentials before running the migration scripts.
flow.sh
: Main script to execute the different migration tasks.scripts/add_rules.sh
: Adds specific rules for the migration.scripts/add_teams.sh
: Adds teams to the destination platforms.scripts/add_workflows.sh
: Adds workflows to the destination platforms.scripts/bitbucket_github.sh
: Migrates repositories from Bitbucket to GitHub.scripts/gitlab_github.sh
: Migrates repositories from GitLab to GitHub.
To migrate repositories, you can use the flow.sh
script with the following options:
-m|--migrate
: Starts the migration process.-s|--status
: Shows the current status of the migration.-c|--cleanup
: Cleans up temporary files generated during the migration.
- -h, --help: Shows help and general usage of the script.
- -m, --migrate [platform]: Starts the migration of repositories from the specified platform (gitlab, bitbucket, github_old, azdevops).
- -s, --status [platform]: Checks the status of the repositories on GitHub for the selected platform.
- -c, --cleanup [platform]: Deletes the repositories from GitHub for the specified platform.
- -v, --validate: Checks the presence of the necessary files and folders for the migration.
- --load-variables: Loads the environment variables defined in config.env.
- --show-variables: Shows the variables with part of their content hidden.
sources/source_repos.csv: Contains the list of repositories to migrate. sources/source_teams.csv: Contains the list of teams associated with the repositories.
The migration logs are stored in the logs/ directory. For example, the logs/log_gitlab_github.log file contains the details of the migration from GitLab to GitHub.
Processing repository 1 of 1
Migrating repository WebDog from gitlab to GitHub...
- gitlab URL: gitlab.com/Ovas04/WebDog.git
- GitHub organization: test-migration-credi Cloning into bare repository 'WebDog.git'... % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 100 132 100 132 0 0 376 0 --:--:-- --:--:-- --:--:-- 377 To https://github.com/test-migration-credi/WebDog.git
- [new branch] develop -> develop
- [new branch] feature/change-any -> feature/change-any
- [new branch] main -> main Cloning into 'WebDog'... Repository WebDog migrated successfully from gitlab to GitHub.