Can one transfer repositories from GitLab to GitHub if the need be. If so, how exactly can I go about doing the same?
Also, are there any pitfalls in doing so or pre
For anyone 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.