There are certain times you need to change move your repository to different service provider with history.
Assume that you have a repository in GitLab and you wanted to migrate it to GitHub. Here is the basic steps to follow.
Clone your repo
Clone repository to your local machine including all branches and tags.
git clone --mirror https://gitlab.com/username/your-repo.git
Note: --mirror
option ensures that all branches, tags and history are cloned.
Create a new repo on GitHub
- Login to Github
- Create a new repo.
- Do not initialize readme, .gitignore or license to prevent conflicts.
Push to Github
Update the remote repo url to point to new GitHub repo.
git remote set-url origin https://github.com/username/your-new-repo.git
Then push your repo to the new target.