DEV Community

Cover image for Migrating repository from github to gitlab
Olawale Adepoju for AWS Community Builders

Posted on β€’ Originally published at dev.classmethod.jp

4

Migrating repository from github to gitlab

I will be showing how I migrated a repository from GitHub to GitLab. There are two methods;

Option 1
Firstly you can do it on the console by going to GitLab and authenticating your GitHub credential there and you will be able to import all the repositories you want on GitLab.

  • Log in to your GitLab, and create a new project

Image description

  • Choose the import project option

Image description

  • Choose the GitHub option

Image description

  • It will show the option of Authorization from GitHub.

Image description

  • you can import all repositories or choose the repository to be migrated. Also, there is an option of importing issues pull request events.

Image description

Option 2
The second option, let's say your GitHub is in a private network and you want to take one repository and push it to GitLab, where GitLab is on some other network or hosted in some other cloud environment. How do you migrate in this case?

  • Clone the GitHub repository you want to migrate. use
git clone --bare <GitHub URL>
Enter fullscreen mode Exit fullscreen mode

Image description

  • Create a new project in GitLab, and choose the create the blank project option

Image description

  • Give a project name and click create project.

Image description

  • Push the cloned repository to GitLab.
git push --mirror <GitLab URL>
Enter fullscreen mode Exit fullscreen mode

Error Alert: while I push to GitLab I encountered an error

Image description

How did I solve it?
Go to project: "Settings" β†’ "Repository" β†’ "Expand" on "Protected branches" and click on unprotect.

Image description

Now the GitHub repository is migrated successfully to GitLab

Image description

Heroku

Simplify your DevOps and maximize your time.

Since 2007, Heroku has been the go-to platform for developers as it monitors uptime, performance, and infrastructure concerns, allowing you to focus on writing code.

Learn More

Top comments (2)

Collapse
 
jordantylerburchett profile image
Jordan-Tyler Burchett β€’

Nice tutorial!

Collapse
 
jatinmehrotra profile image
Jatin Mehrotra β€’

Classmethod <3

Best Practices for Running  Container WordPress on AWS (ECS, EFS, RDS, ELB) using CDK cover image

Best Practices for Running Container WordPress on AWS (ECS, EFS, RDS, ELB) using CDK

This post discusses the process of migrating a growing WordPress eShop business to AWS using AWS CDK for an easily scalable, high availability architecture. The detailed structure encompasses several pillars: Compute, Storage, Database, Cache, CDN, DNS, Security, and Backup.

Read full post

πŸ‘‹ Kindness is contagious

Please leave a ❀️ or a friendly comment on this post if you found it helpful!

Okay