将一个完整的git repo从一个帐户移动到另一个帐户

时间:2011-06-17 09:34:19

标签: git

我是git的新手。我在repositoryhosting.com上有一个git存储库(它包含3个分支),我想将它移动到assembla.com。如何使用代码历史记录和分支移动整个批次,以便最终在不同的git服务提供程序上使用相同的存储库?

1 个答案:

答案 0 :(得分:4)

首先,克隆旧存储库:

git clone git://old-repo-url

然后创建一个指向新存储库的新远程:

git remote add new-repo-name git://new-repo-url

现在推送到新的遥控器:

git push new-repo-name branch1:refs/heads/branch1
git push new-repo-name branch2:refs/heads/branch2
...

推动你关心的每个分支,瞧!一个很好的复制存储库。

相关问题