During a recent project, I encountered the need to migrate from Bonobo Git, which we had been using for internal testing purposes, to GitLab.
The initial reasons for using Bonobo Git were:
- Easy installation in a Windows environment
- Quick setup with simple functionality
However, as the project grew and required more scalability, we decided to switch to GitLab, which allows for configuration in a Linux environment.
Below is a guide for migrating Git repositories:
[Git Backup]
Backing up Bonobo Git repositories
To back up your repositories from Bonobo Git, use the clone command to mirror each repository.
cd /path/to/repo-name.git # Navigate to the directory of the cloned bare repository
git push --mirror http://gitlab-server-url/username/repo-name.git
The --bare option ensures that all data (commit history, branches, tags, etc.) is included in the backup.
Repeat this process for all repositories you want to back up.
[Git Restore]
Restoring the backup to GitLab
First, you need to create a new project in GitLab:
- Log in to GitLab.
- Click the "New Project" button at the top menu.
- Select "Create blank project".
- Enter the project name, configure visibility settings if necessary, and click "Create project" to complete the setup.
Once the project is created, GitLab will provide you with a remote repository URL. To push the bare repository to GitLab, run the following command:
git push --mirror http://gitlab-server-url/username/repo-name.git
In this command, replace http://gitlab-server-url/username/repo-name.git with the actual URL of the project you just created.
[Project Verification]
Go to the project's page on GitLab to verify that the code has been uploaded successfully.
Additionally, to clone the repository from your Bonobo Git server, use:
git clone --bare http://bonobo-server-url/repo-name.git
This will allow you to migrate your repositories smoothly from Bonobo Git to GitLab.