Push to Multiple Remotes at the Same Time
Let’s say you have multiple git repos that you’d like to keep in sync.
Normally you might do something like this:
git remote add github github.com:user/repo.git
git remote add bitbucket bitbucket.org:user/repo.gitAnd then you need to push to both of them to keep them in sync:
git push github master
git push bitbucket masterYou can make a shell script to wrap pushes, but that’s tedious. Instead, set the remote push URLs like so:
git remote set-url --add --push origin github.com:user/repo.git
git remote set-url --add --push origin bitbucket.org:user/repo.gitMake sure that you see both repos pointed to as origin by running:
git remote show originNext time you push, you should see both remotes properly synced.