Developing software in the Real World

Git push to multiple repositories

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:

However, I recently discovered that I can create a remote that points to more than one repository using these commands:

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:

Create this as /usr/local/bin/git-add-push-all.sh and then you can just run it in the root of your project.