Transfer git repositories from GitLab to GitHub

Still looking for a simpler method to transfer repos from Gitlab to Github while preserving all history?

Step 1. Login to Github, create a private repo with the exact same name as the repo you would like to transfer.

Step 2. Under "push an existing repository from the command" copy the link of the new repo, it will look something like this:

git@github.com:your-name/name-of-repo.git

Step 3. Open up your local project and look for the folder .git. Typically this will be a hidden folder. Inside the .git folder, open up config.

The config file will contain something like:

[remote "origin"]
url = git@github.com:your-name/name-of-repo.git
fetch = +refs/heads/:refs/remotes/origin/

Under [remote "origin"], change the URL to the one that you copied on Github.

Step 4. Open your project folder in the terminal and run: git push --all. This will push your code to Github as well as all the commit history.

Step 5. To make sure everything is working as expected, make changes, commit, push and new commits should appear on the newly created Github repo.

Step 6. As a last step, you can now archive your Gitlab repo or set it to read only.

This answer was originally posted on Stack Overflow. You can find the full discussion here .

Related Posts

Transfer git repositories from GitLab to GitHub

Still looking for a simpler method to transfer repos from Gitlab to Github while preserving all history? Step 1. Login to Github, create a private repo with the exact same name as the repo you would

Read More

How to make toys from old Olarpaper

Nemo vel ad consectetur namut rutrum ex, venenatis sollicitudin urna. Aliquam erat volutpat. Integer eu ipsum sem. Ut bibendum lacus vestibulum maximus suscipit. Quisque vitae nibh iaculis neque blan

Read More