Doing this manually is no longer necessary, with modern versions of
git! See Malvineous‘s solution, below.
git remote set-url origin --push --add <a remote> git remote set-url origin --push --add <another remote>
This something I’ve been using for quite a while without bad consequences and suggested by Linus Torvalds on the git mailing list.
araqnid’s solution is the proper one for bringing code into your repository… but when you, like me, have multiple equivalent authoritative upstreams (I keep some of my more critical projects cloned to both a private upstream, GitHub, and Codaset), it can be a pain to push changes to each one, every day.
Long story short,
git remote add all of your remotes individually… and then
git config -e and add a merged‐remote. Assuming you have this repository
[remote "GitHub"] url = email@example.com:elliottcable/Paws.o.git fetch = +refs/heads/*:refs/remotes/GitHub/* [branch "Master"] remote = GitHub merge = refs/heads/Master [remote "Codaset"] url = firstname.lastname@example.org:elliottcable/paws-o.git fetch = +refs/heads/*:refs/remotes/Codaset/* [remote "Paws"] url = email@example.com:Paws/Paws.o.git fetch = +refs/heads/*:refs/remotes/Paws/*
… to create a merged‐remote for
"Codaset", I can add the following after all of those:
[remote "Origin"] url = firstname.lastname@example.org:Paws/Paws.o.git url = email@example.com:elliottcable/paws-o.git
Once I’ve done this, when I
git push Origin Master, it will push to both
Codaset/Master sequentially, making life a little easier.