Move a whole git repo from one account to another
I'm new to git. I have a git repository on repositoryhosting.com (it contains 3 branches) and I want to move it to开发者_开发知识库 assembla.com. How can I move the whole lot with code history and branches so that I end up with the same repository on a different git service provider?
First, clone your old repository:
git clone git://old-repo-url
Then create a new remote pointing to the new repository:
git remote add new-repo-name git://new-repo-url
Now push to the new remote:
git push new-repo-name branch1:refs/heads/branch1
git push new-repo-name branch2:refs/heads/branch2
...
Push each branch you care about, and voila! A nicely copied repository.
精彩评论