4

I want to use these bash function to push my local repo to two remote repos, but I'm not sure if this will work.

p_foo_0() {
  git add -A .
  git commit -m "test"
  git push origin master
  echo "success"
}

p_foo_1() {
  git add -A .
  git commit -m "test"
  git push heroku master
  echo "success"
}
Lazy Badger
  • 94,711
  • 9
  • 78
  • 110
cade galt
  • 3,843
  • 8
  • 32
  • 48
  • 2
    Here is one way to do it - http://stackoverflow.com/questions/14290113/git-pushing-code-to-two-remotes – cade galt Sep 05 '15 at 15:56
  • And here was the old way to do it, which also contains an updated answer similar to above - http://stackoverflow.com/questions/849308/pull-push-from-multiple-remote-locations – cade galt Sep 05 '15 at 15:57

1 Answers1

2

Configure your remotes using:

git remote set-url all --push --add <first-repo>
git remote set-url all --push --add <second-repo>

Now you can use:

git push all master

to push to both repos

sergej
  • 17,147
  • 6
  • 52
  • 89