Last Updated: February 25, 2016
·
1.382K
· freiden

Manage multiple Git repositories for a project

Originally from http://deanclatworthy.com/2013/01/how-to-avoid-relying-on-github-mirror-your-repository/

1.Rename default remote 'origin'

git remote rename origin <old_origin>

2.Create the new repository for the project if not already done

3.Add the new repo to the project:

git remote add <new_repo> git@<platform_git>/username/somerepo.git
git push -u <platform_git> --all

4.Add a new remote named 'origin' to allow you to push to the two previous remote at the same time:

git remote add origin ''

5.Update your project .git/config remote origin part to this:

[remote "origin"]
  url = git@<old_repo>:username/somerepo.git
  url = git@<new_repo>/username/somerepo.git

6.Then set your project new upstream for your current branch:

git push -u origin <project_branch>

Or

git push -u origin --all

Et voila !!