Automate the migration of multiple repositories from GitHub to GitLab with this powerful Python script. Designed for developers and organizations looking to effortlessly transfer their projects, including private repositories, without manual intervention.
- Bulk migration of repositories from GitHub to GitLab
- Supports both public and private repositories
- Automated cloning and pushing to GitLab
- Detailed logging for easy monitoring
- Configurable for different GitHub organizations and GitLab groups
- Secure credential management using environment variables
- Clone this repository:
git clone https://github.com/Am-Issath/github-to-gitlab-migration-tool.git
cd github-to-gitlab-migration-tool
- Install required packages:
pip install gitlab PyGithub python-dotenv
-
Set up the environment file (see Environment Setup)
-
Create a
repositories.txtfile listing repos to migrate -
Run the script:
python github_to_gitlab_migration.py
To securely manage your credentials, we use environment variables. Follow these steps to set up your environment:
- Create a file named
.envin the root directory of the project - Add the following content to the
.envfile, replacing the placeholder values with your actual credentials:
GITHUB_TOKEN=your_github_token
GITHUB_ORG=your_github_organization
GITLAB_URL=your_gitlab_url
GITLAB_TOKEN=your_gitlab_token
GITLAB_GROUP=your_gitlab_group
- Make sure to add
.envto your.gitignorefile to prevent accidentally committing sensitive information:
echo ".env" >> .gitignore
- Ensure you have Python 3.x installed on your system.
- Install the required Python packages as mentioned in the Quick Start section.
- Set up your environment file as described in the Environment Setup section.
- Create a
repositories.txtfile in the same directory as the script. List each repository you want to migrate on a separate line. - Run the script using
python github_to_gitlab_migration.py. - The script will process each repository listed in
repositories.txt, migrating it from GitHub to GitLab. - Check the console output for progress and any error messages.
- Time-Saving: Migrate multiple repositories in one go
- Flexible: Works with various GitHub organizations and GitLab groups
- Secure: Handles private repositories with proper authentication
- Safe: Uses environment variables for sensitive information
We welcome contributions! Please check our Contributing Guidelines for more details.
This project is licensed under the MIT License - see the LICENSE file for details.
For issues, questions, or contributions, please open an issue in this repository.
Happy migrating!