I have a couple of projects where I need to push to more than one repo all the time.
I have been using this command line to do so:
git push origin && git push other-remote
However, I recently discovered that I can create a remote that points to more than one repository using these commands:
git remote add all firstname.lastname@example.org:akrabat/projectname.git git remote set-url --add all ssh://example.com/path/to/projectname.git
I now have a remote called all that will push to both repositories!
There's no automatic way to go the other way and fetch from multiple repositories though as apparently it makes less sense to fetch the same branch identifier from multiple places.
Further details in this email by Linus in 2006.
If you want to script the creation of the all remote, then you could use this script which manipulates the remote configuration settings directly:
#!/bin/bash if [ "`git remote| grep all`" == "all" ] ; then git remote remove all fi for r in `git remote` do git config --add remote.all.url `git config remote.$r.url` done
Create this as /usr/local/bin/git-add-push-all.sh and then you can just run it in the root of your project.