How to migrate a git repository from gitlab self-hosted to

Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.

If you are new to git and want to learn more, the doc section of the official site is full of content.

There are several repository managers that exploit the potential of git and offer their customers features connected to it.
The two most famous tools are github and gitlab.

Gitlab can be installed on your local server or you can create your own repositories on; in both cases, your repositories can be public or private.
In this article I don’t want to discuss which of the two solutions is the best: it’s better to have a local installation that you have under control but that you have to maintain and update or it’ better to use the platform? The decision it’s up to you!

In this article I want to help you to migrate your projects from a self-hosted installation to without losing any information about the repository.

Here the step:

  • create a new user on and login
  • create a new blank project in (without create README or any file)
  • follow this steps in the terminal on your PC
  • archive the project in your self-hosted gitlab [optional step]
    go in settings - general - archive project
    This is useful step because it saves you from making changes in the old project by mistake.
  • tell to people who work on the project, to change the remote pointer and moving to the new repository hosted by with this command:
    git remote set-url origin

With this procedure you will move all your code (including branches and commits) to, thus keeping all the historicity of the project.
NB what you will not be able to migrate with this procedure: issue and merge requests

For newbies, you can find a great freecodecamp article “What is Git? A Beginner’s Guide to Git Version Control” here

Thanks a lot for reading, sharing and comment this article





Enthusiastic Seeker. I love to constantly improve my freedom. I’m very passionate about technology, sport and nature

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Save 80% of development time with Serverless architecture

A Q&A With QA Managers | Kenneth Macalino, Leaf Group

How To Digitize Your Water Operations and Maintenance Work

First Projects and Pseudo Classes

Web App for Healthcare: Case From Practice

New & improved Datree — policy engine for your git repositories

Step by step CI/CD configuration for a data science project with Azure DevOps and Azure Machine…

Ever since I was a little boy, I have only ever wanted to be a Doctor.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Giovanni Tommasini

Giovanni Tommasini

Enthusiastic Seeker. I love to constantly improve my freedom. I’m very passionate about technology, sport and nature

More from Medium

Multiple git accounts on same machine

Docker for beginners

Git SSH | Merge Conflicts

Using cron to neatly automate tasks

Introduction Image containing a clock and some code