将Git仓库从GitLab转移到GitHub - 我们可以,如何和陷阱(如果有的话)? [英] Transfer git repositories from GitLab to GitHub - can we, how to and pitfalls (if any)?

查看:195
本文介绍了将Git仓库从GitLab转移到GitHub - 我们可以,如何和陷阱(如果有的话)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果需要的话,可以将存储库从GitLab转移到GitHub。如果是这样,我该怎么做同样的事情?



另外,这样做或预防措施有什么缺陷,我在此之前需要记住因为我可能决定最终将它们移动到GitHub上(因为它有更多的功能,可以在我的项目中找到方便的时刻)。

解决方案您可以转移这些(只需将一个远程添加到GitHub仓库并推送它们)
$ b $ ul
  • 创建一个空的仓库在GitHub上

  • git remote add github https://yourLogin@github.com/yourLogin/yourRepoName.git






  • 历史记录将会是相同的。



    但是您将失去访问控制权(在GitLab中定义的团队具有特定的回购权限)



    OP boddhisattva

     有一个问题,请求的URL返回错误:403 

    您只需输入您的GitHub密码,但OP建议:


    然后,您可能需要按ssh方式推送它。您可以在这里阅读更多关于如何操作的信息。


    请参阅推送到Git返回错误代码403致命:HTTP请求失败


    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).

    解决方案

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

    • create an empty repo on GitHub
    • git remote add github https://yourLogin@github.com/yourLogin/yourRepoName.git
    • git push --mirror github

    The history will be the same.

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

    The OP boddhisattva reports having an issue with the https url of the GitHub repo:

    The requested URL returned 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".

    这篇关于将Git仓库从GitLab转移到GitHub - 我们可以,如何和陷阱(如果有的话)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆