Migrated from GitHub to GitLab to use Private Repository for free
I wanted to use Private Repository for free, so I migrated from GitHub to GitLab.
While GitHub charges for Private Repository usage, GitLab allows free Private Repository usage, and you can add unlimited collaborators for free. It’s unlimited. It’s the best.
For details, please refer to the following comparison article:
GitLab does have an “Import repositories from GitHub” feature properly prepared.
https://gitlab.com/import/github/status
However, when I tried using it, for some reason I got the error An error occurred while importing project: Error: Request failed with status code 422 and it didn’t work.
Since I couldn’t use GitLab’s Import repositories from GitHub feature, I performed the migration with the following flow:
Create a Blank project from New project https://gitlab.com/projects/new.
Change the remote origin from GitHub to GitLab.
Right after Create project, at https://gitlab.com/your-group-name/your-project-name, there’s a migration script like below, so execute it as shown:
Existing Git repository
cd existing_repo
git remote rename origin old-origin
git remote add origin [email protected]:your-group-name/your-project-name.git
git push -u origin --all
git push -u origin --tags
That’s all from the Gemba where I migrated from GitHub to GitLab to use Private Repository for free.