[英]How to migrate a Bitbucket repository to Github?
我想将包含多个分支的旧 Bitbucket 存储库迁移到 Github。 为此,我遵循了以下描述:
# add remote github repository
$ git remote add upstream https://github.com:USER/PROJECT.git
# push all branches <-- doesn't work
$ git push upstream master
$ git push --tags upstream
只有master
分支被推送到 Github 存储库(也适用于git push --all upstream
)。
为了将所有分支推送到 Github,我需要单独checkout
它们并执行git push upstream
。
如何在不先checkout
出所有分支的情况下将所有分支推送到 Github?
请按照以下步骤操作。
镜像源代码库。
git clone --mirror https://url-of-the-source-git-repo.git
Go 到新克隆的 repo
cd to-your-git-repo-folder.git
设置新的遥控器 url。
git remote set-url --push origin https://url-of-the-destination-git-repo.git
推送到新的仓库
git push --mirror
通过遵循这些命令,您将迁移到包含所有分支和提交的新仓库。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.