本文翻译自: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:
它用:-
: to clone every references (commits, tags, branches)git clone --mirror
:克隆每个引用(提交,标记,分支)git clone --mirror
-
: to push everythinggit push --mirror
:推送一切git push --mirror
That would give:
这会给:git clone --mirror https://bitbucket.org/exampleuser/repository-to-mirror.git
# Make a bare mirrored clone of the repository
cd repository-to-mirror.git
git remote set-url --push origin https://github.com/exampleuser/mirrored
# Set the push location to your mirror
git push --mirror
As Noted in the comment s by LS :
正如LS 的评论中所述 :- it is easier to use the
feature from GitHub described by MarMass . 使用MarMass描述的GitHub中的Import Code
功能更容易。 See https://github.com/new/import 请参阅https://github.com/new/importImport Code
- 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.
简单直接。Once I was happy that the push had been successful to GitHub, I could delete the old remote by issuing: 一旦我对GitHub的推送成功感到高兴,我可以通过发出以下命令删除旧的遥控器:
#4楼
It's very simple.
这很简单。1º Create a new empty repository in GitHub (without readme or licesne, you can add them before) and the following screen will show
1º在GitHub中创建一个新的空存储库(没有自述文件或licesne,您可以在之前添加它们),以下屏幕将显示2º Inside to import code option you paste your bitbucket URL's repo and voilà!!
2º在里面导入代码选项你粘贴你的bitbucket URL的repo和voilà!!#5楼
In case you couldn't find "Import code" button on github, you can:
如果您在github上找不到“导入代码”按钮,您可以:- directly open Github Importer and enter the
. 直接打开Github Importer并输入url
。 It will look like: 它看起来像:url
- give it a name (or it will import the name automatically) 给它一个名字(或者它会自动导入名字)
- select
orPublic
repo 选择Private
或Public
仓库Private
- 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:
看起来像: