Moving your git repos and all branches to a new remote repository

Recently I have been moving a lot of our old repositories into our local gitosis from github.
There seems to be no quick an easy solution for moving all of the remote branches across too, so this is how I am currently doing this.
Below are the commands I have been using to do this:

Firstly go into the top level folder for your repository clone and pull down a local copy of all of the remote branches:

for remote in `git branch -r `; do git branch --track $remote; done

Next add your new remote repository

git remote add new-origin git@my_gitosis_server.com:my_new_repos.git

Now push everything up to your new remote repository:

git push --all new-remote

Et voila! All remote branches are in…

No Comments

RSS feed for comments on this post. TrackBack URL

No comments yet.

Leave a comment

Preview: