gitgithubtransfergitlabrepository

Transfer git repositories from GitLab to GitHub - can we, how to and pitfalls (if any)?


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 precautionary measures that I need to keep in mind before doing so given that I may decide to eventually move them to GitHub (as it has more features at the moment that I might find handy for my project).


Solution

  • You can transfer those (simply by adding a remote to a GitHub repo and pushing them)

    The history will be the same.

    But you will lose the access control (teams defined in GitLab with specific access rights on your repo)

    If you face any issue with the https URL of the GitHub repo:

    The requested URL returned an error: 403
    

    All you need to do is to enter your GitHub password, but the OP suggests:

    Then you might need to push it the ssh way. You can read more on how to do it here.

    See "Pushing to Git returning Error Code 403 fatal: HTTP request failed".


    Note that mike also adds in the comments:

    GitLab can also be set to push mirror to downstream repositories, and there are specific instructions for push mirroring to GitHub.
    This can use a GitHub Personal Access Token and also be set to periodically push.
    You might use this option to share on GitHub, but keep your main development activity in your GitLab instance.


    tswaehn suggests in the comments the tool piceaTech/node-gitlab-2-github

    It is possible to migrate issues, labels, ... with this tool github.com/piceaTech/node-gitlab-2-github: I tested it, not bad.
    But had issues when transferring attachments of the issues itself.
    Still worth a try, maybe.

    Frotz notes in the comments that:

    I've since discovered that there's a wait option available to use in the user-editable settings.ts file that's not documented anywhere.
    I discovered it while implementing my own quick-and-dirty delay, which did work in stopping the "Abuse detected" slowdowns


    Does this mean that when I want to push new changes I would have to do git push github [branch_name] instead of using origin?

    No, you can: