Skip to content

Instantly share code, notes, and snippets.

@pixelbrackets
Last active August 5, 2022 12:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pixelbrackets/be1937fb6920478cbf6c02853106f110 to your computer and use it in GitHub Desktop.
Save pixelbrackets/be1937fb6920478cbf6c02853106f110 to your computer and use it in GitHub Desktop.
Add a Git remote named »all« which groups all existing remotes
#!/bin/bash
# Source: https://akrabat.com/git-push-to-multiple-repositories/
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
@pixelbrackets
Copy link
Author

pixelbrackets commented Dec 19, 2018

Installation

wget [URL to raw gist]
chmod +x git-add-all-remote.sh
mv git-add-all-remote.sh /usr/local/bin/git-add-all-remote

Usage

cd [some-git-repository]
git-add-all-remote

# now instead of `git push origin && git push another-origin && git push yet-another-origin`
# run the following command to push to all remote repositories at once:
git push all

# to remove or update the »all« origin, run `git-add-all-remote` again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment