'Migrate multiple projects from GitLab to Azure DevOps
I am trying to find a way to migrate all projects (+600) from our Gitlab server to our DevOps platform. Are you aware of any scripts/automation?
Thank you!
I tried different tutorials from Microsoft. They are however designed for single project migration (usually GUI). Yet, in this case, we have multiple users and multiple projects.
Solution 1:[1]
My development team has been using GitLab on-premise to manage their code repositories. As we are moving development work to our new on-premise development cloud with expanded processing capabilities, we also need to migrate our code repositories to the new development cloud which uses Azure DevOps Team Foundation Server (TFS) for Git workflows. To support the chief architect in the migration, I prepared a quick migration guide for the team’s move to Azure DevOps TFS.
Our existing and new on-premise development clouds are accessible via different Virtual Private Networks (VPN), hence we had to migrate our code repositories manually instead of using the automatic Git migrator in Azure DevOps TFS. If your code repository services are within the same network, automatic migration is possible.
Creating local Git repository from GitLab
Log into existing cloud VPN (if applicable).
Open Git Bash.
Navigate into target local directory.
Clone your GitLab source repository (e.g. YourTeam/YourSourceRepo) to target local directory.
git clone https://YourTeamGitlabAddress/YourTeam//YourTeam/YourSourceRepo
Creating new upstream at Azure DevOps (TFS)
Log into new cloud VPN (if applicable).
Create target repository at Azure DevOps. (e.g. YourTargetRepo)
Open Git Bash.
List the current configured remote repository for your (GitLab) fork.
git remote -v
- Specify a new remote upstream repository that will be synced with the fork.
git remote add upstream https://YourTeamTFSAddress:8080/TFS/DefaultCollection/_git/YourTargetRepo
- Verify the new upstream repository you’ve specified for your fork.
git remote -v
Migrating codes from GitLab to Azure DevOps (TFS)
Log into existing cloud VPN (if applicable).
Check that local repository is up to date with GitLab upstream.
git fetch
- Update local repository with GitLab repository.
git pull
Connect to new cloud VPN (if applicable).
Push local repository to Azure DevOps (TFS).
git push --mirror https://YourTeamTFSAddress:8080/TFS/DefaultCollection/_git/YourTargetRepo
You need to key in your Azure DevOps (TFS) username and password for authentication. If authentication error, try the following command to clear cache:
git config --system --unset crendential.helper
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Kangcheng Jin-MSFT |