将整个git回购从一个账户移动到另一个账户

问题描述:

我是git的新手。我在repositoryhosting.com上有一个git仓库(它包含3个分支),我想将它移动到assembla.com。我如何移动整个代码历史和分支,以便最终在不同的git服务提供者上使用同一个存储库?将整个git回购从一个账户移动到另一个账户

首先,克隆旧仓库:

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 
... 

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

+1

或'git push --all'。 'git clone --mirror'也可以提供帮助。 – 2011-06-17 17:28:41