How do I move my remote git repo to another remote git repo?

Thunder Rabbit picture Thunder Rabbit · Jan 21, 2013 · Viewed 9.9k times · Source

I want to move my remote git repository and all its branches to a new remote repository.

old remote = [email protected]:thunderrabbit/thunderrabbit.github.com.git

new remote = [email protected]:tr/tr.newrepo.git

Answer

Thunder Rabbit picture Thunder Rabbit · Jan 21, 2013

In terminal on your local machine:

cd ~
git clone <old-remote> unique_local_name
cd unique_local_name

for remote in `git branch -r | grep -v master `; \
do git checkout --track $remote ; done

git remote add neworigin <new-remote>
git push --all neworigin