本文翻译自:How to move git repository with all branches from bitbucket to github?

What is the best way to move a git repository with all branches and full history from bitbucket to github? 将所有分支和完整历史从bitbucket移动到github的git存储库的最佳方法是什么? Is there a script or a list of commands I have to use? 是否有脚本或命令列表我必须使用?


#1楼

参考:https://stackoom.com/question/1Y78P/如何从bitbucket到github的所有分支移动git存储库


#2楼

You can refer to the GitHub page " Duplicating a repository " 您可以参考GitHub页面“ 复制存储库 ”

It uses: 它用:

  • git clone --mirror : to clone every references (commits, tags, branches) git clone --mirror :克隆每个引用(提交,标记,分支)
  • git push --mirror : to push everything git push --mirror :推送一切

That would give: 这会给:

git clone --mirror https://bitbucket.org/exampleuser/repository-to-mirror.git
# Make a bare mirrored clone of the repositorycd repository-to-mirror.git
git remote set-url --push origin https://github.com/exampleuser/mirrored
# Set the push location to your mirrorgit push --mirror

As Noted in the comment s by LS : 正如LS 的评论中所述 :

  • it is easier to use the Import Code feature from GitHub described by MarMass . 使用MarMass描述的GitHub中的Import Code功能更容易。
    See https://github.com/new/import 请参阅https://github.com/new/import
  • Unless ... your repo includes a large file: the problem is, the import tool will fail without a clear error message. 除非 ...你的repo包含一个大文件:问题是,导入工具将失败而没有明确的错误消息。 Only GitHub Support would be able to diagnose what happened. 只有GitHub支持才能诊断发生了什么。

#3楼

http://www.blackdogfoundry.com/blog/moving-repository-from-bitbucket-to-github/ http://www.blackdogfoundry.com/blog/moving-repository-from-bitbucket-to-github/

This helped me move from one git provider to another. 这帮助我从一个git提供者转移到另一个。 At the end of it, all the commits were in the destination git. 最后,所有提交都在目标git中。 Simple and straight forward. 简单直接。

 git remote rename origin bitbucket git remote add origin https://github.com/edwardaux/Pipelines.git git push origin master 

Once I was happy that the push had been successful to GitHub, I could delete the old remote by issuing: 一旦我对GitHub的推送成功感到高兴,我可以通过发出以下命令删除旧的遥控器:

 git remote rm bitbucket 

#4楼

It's very simple. 这很简单。

Create a new empty repository in GitHub (without readme or licesne, you can add them before) and the following screen will show 在GitHub中创建一个新的空存储库(没有自述文件或licesne,您可以在之前添加它们),以下屏幕将显示

Inside to import code option you paste your bitbucket URL's repo and voilà!! 在里面导入代码选项你粘贴你的bitbucket URL的repo和voilà!!


#5楼

In case you couldn't find "Import code" button on github, you can: 如果您在github上找不到“导入代码”按钮,您可以:

  1. directly open Github Importer and enter the url . 直接打开Github Importer并输入url It will look like: 它看起来像:
  2. give it a name (or it will import the name automatically) 给它一个名字(或者它会自动导入名字)
  3. select Public or Private repo 选择PublicPrivate仓库
  4. Click Begin Import 单击Begin Import

UPDATE: Recently, Github announced the ability to " Import repositories with large files " 更新:最近,Github宣布了“ 导入大文件存储库 ”的能力


#6楼

I had the reverse use case of importing an existing repository from github to bitbucket. 我有一个将现有存储库从github导入bitbucket的反向用例。

Bitbucket offers an Import tool as well. Bitbucket也提供导入工具 。 The only necessary step is to add URL to repository. 唯一必要的步骤是将URL添加到存储库。

It looks like: 看起来像:

如何从bitbucket到github的所有分支移动git存储库?相关推荐

  1. git idea 本地历史版本回滚_如何为IDEA项目创建GitHub存储库和本地Git存储库

    有几种方法可以使用IntelliJ IDEA来发布我们在GitHub上编写的代码.在此博客中,我们将介绍两种方法.第一个步骤是最快的一步,您可以在其中创建本地和远程存储库.第二种方法是多步骤,当您要为 ...

  2. 2020.2idea怎么创建html项目_如何为IDEA项目创建GitHub存储库和本地Git存储库

    有几种方法可以使用IntelliJ IDEA来发布我们在GitHub上编写的代码.在此博客中,我们将介绍两种方法.第一个步骤是最快的一步,您可以在其中创建本地和远程存储库.第二种方法是多步骤,当您要为 ...

  3. git bitbucket_如何在Bitbucket上创建新的Git存储库并查看提交的对象

    git bitbucket For the purpose of this article, Bitbucket is chosen as a Git hosting service. In orde ...

  4. 从GitHub存储库下载单个文件夹或目录

    如何从GitHub上托管的远程Git存储库中仅下载特定文件夹或目录? 假设示例GitHub存储库位于此处: git@github.com:foobar/Test.git 其目录结构: Test/ ├─ ...

  5. 注意!今日起 GitHub 新建存储库的默认分支就不叫“master”了!

    整理 | 郑丽媛 头图 | CSDN下载自东方IC GitHub 宣布,自2020年10月1日起,在 GitHub 平台上创建的所有源代码存储库都将默认命名为 main ,而非原本的 master . ...

  6. 注意!下个月开始 GitHub 新建存储库的默认分支就不叫“master”了!

    整理 | 郑丽媛 头图 | CSDN下载自东方IC 近日,GitHub宣布,自2020年10月1日起,在GitHub平台上创建的所有源代码存储库都将默认命名为 main ,而非原本的 master . ...

  7. 如何在GitHub上重命名存储库?

    本文翻译自:How do I rename a repository on GitHub? I wanted to rename one of my repositories on GitHub, b ...

  8. 将新更新从原始GitHub存储库中提取到派生的GitHub存储库中

    我在GitHub上分叉了某人的存储库,并希望使用原始存储库中的提交和更新来更新我的版本. 这些是我分叉副本后制作的. 如何提取原产地所做的更改并将其合并到我的存储库中? #1楼 除了VonC的答案,您 ...

  9. 从另一个分支在Git中创建一个分支

    我有两个分支: master和dev 我想从dev分支创建一个"功能分支". 目前在分支机构dev上,我执行以下操作: $ git checkout -b myfeature de ...

最新文章

  1. 2020全球Top10 AI专利公司:美国过半,中国仅占两席
  2. Android编程: MVC模式、应用的生命周期
  3. Bit-Scalable Deep Hashing with Regularized Similarity Learning for Image Retrieval and Person Re-ide
  4. Windows下使用ffmpeg为视频添加字幕
  5. HDU 1566 Count the Colors 树状树组 区间更新 单点求值
  6. Opencv--findHomography 与 getPerspectiveTransform异同
  7. RCurl网络数据抓取
  8. 设计一算法,判断给定单链表的长度是奇数还是偶数
  9. Windows7中右键菜单无新建文本文档选项的解决办法(注册表)
  10. 设置word07标题样式
  11. Vue 源码学习过程 - Observer/Dep/Watcher三者实现数据双向绑定
  12. 海康录制视频文件无法播放以及FFmpeg最新版下载
  13. WebSphere/WebLogic缓存清理
  14. 宋浩《概率论与数理统计》自用笔记
  15. 【产品经理】AARRR模型
  16. 将本地图片或者网上图片用post方式上传到图片服务器
  17. 拼多多怎么发布机会产品|百择电商
  18. 力扣算法题-19.秋叶收藏集 C语言实现
  19. 基于MATLAB的线性规划:linprog用法
  20. 预付费水电表系统功能有哪些?

热门文章

  1. ios ipod library 读,写,等常见管理方法
  2. Cannot start compiler
  3. Datawhale-数据分析-泰坦尼克-第一单元
  4. GarsiaWachs算法
  5. 英雄联盟怎么解除小窗口_英雄联盟手游亚索怎么操作-英雄联盟手游亚索操作攻略...
  6. 修改csdn博客的名称
  7. 计算机技术维修网,计算机维修技术
  8. MyBatis(2)
  9. 《白夜行》读后感:忽视就是虐待
  10. 车联网安全知识点总结