Skip to content

Instantly share code, notes, and snippets.

@80xer
Last active June 3, 2016 00:12
Show Gist options
  • Save 80xer/26f686174d3b7e8123cc4182bddbaf5d to your computer and use it in GitHub Desktop.
Save 80xer/26f686174d3b7e8123cc4182bddbaf5d to your computer and use it in GitHub Desktop.
Git push to multiple repositories
$ git clone git@github.com:80xer/study.git
$ git remote -v
origin git@github.com:80xer/study.git (fetch)
origin git@github.com:80xer/study.git (push)
$ git config -l | grep '^remote\.'
remote.origin.url=git@github.com:80xer/study.git
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
$ git remote add all git@github.com:80xer/study.git
$ git remote -v
all git@github.com:80xer/study.git (fetch) <-- ADDED
all git@github.com:80xer/study.git (push) <-- ADDED
origin git@github.com:80xer/study.git (fetch)
origin git@github.com:80xer/study.git (push)
$ git config -l | grep '^remote\.all'
remote.all.url=git@github.com:80xer/study.git <-- ADDED
remote.all.fetch=+refs/heads/*:refs/remotes/all/* <-- ADDED
$ git remote set-url --add --push all git@git.otherserver.com:user/study.git
$ git remote -v
all git@github.com:80xer/study.git (fetch)
all git@git.otherserver.com:user/study.git (push) <-- CHANGED
origin git@github.com:80xer/study.git (fetch)
origin git@github.com:80xer/study.git (push)
$ git config -l | grep '^remote\.all'
remote.all.url=git@github.com:80xer/study.git
remote.all.fetch=+refs/heads/*:refs/remotes/all/*
remote.all.pushurl=git@git.otherserver.com:user/study.git <-- ADDED
$ git remote set-url --add --push all git@github.com:80xer/study.git
$ git remote -v
all git@github.com:80xer/study.git (fetch)
all git@git.otherserver.com:user/study.git (push)
all git@github.com:80xer/study.git (push) <-- ADDED
origin git@github.com:80xer/study.git (fetch)
origin git@github.com:80xer/study.git (push)
$ git config -l | grep '^remote\.all'
remote.all.url=git@github.com:80xer/study.git
remote.all.fetch=+refs/heads/*:refs/remotes/all/*
remote.all.pushurl=git@git.otherserver.com:user/study.git
remote.all.pushurl=git@github.com:80xer/study.git <-- ADDED
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment