[英]How to migrate a Bitbucket repository to Github?
I want to migrate an old Bitbucket repository, containing multiple branches, to Github.我想将包含多个分支的旧 Bitbucket 存储库迁移到 Github。 To accomplish this, I've followed this description:
为此,我遵循了以下描述:
# 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
Only the master
branch is pushed to the Github repository (also for git push --all upstream
).只有
master
分支被推送到 Github 存储库(也适用于git push --all upstream
)。
In order to push all branches to Github, I need to checkout
them individually and do git push upstream
.为了将所有分支推送到 Github,我需要单独
checkout
它们并执行git push upstream
。
How can I push all branches to Github without first checkout
them?如何在不先
checkout
出所有分支的情况下将所有分支推送到 Github?
Follow the below steps.请按照以下步骤操作。
Mirror the source repo.镜像源代码库。
git clone --mirror https://url-of-the-source-git-repo.git
Go to the newly cloned repo Go 到新克隆的 repo
cd to-your-git-repo-folder.git
set the new remote url.设置新的遥控器 url。
git remote set-url --push origin https://url-of-the-destination-git-repo.git
Push to the new repo推送到新的仓库
git push --mirror
By following these commands you will migrate to new repo with all the branches and commits.通过遵循这些命令,您将迁移到包含所有分支和提交的新仓库。
First make sure that you have fetched all branches .首先确保您已获取所有分支。
git fetch --all
Then push all branches to the new remote然后将所有分支推送到新的远程
git push upstream --all
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.