How to push to two github remotes at once
For the purposes of backup and resilience, it may be useful to maintain two identical git remotes for a repo. Maybe one is on github, and another one is on a machine on another cloud. Then, you may want to automate pushing every change to the two repos at once.
git remote set-url --push origin git@github.com:<username>/<reponame>.git
git remote set-url --add --push origin git@git:/home/git/repos/
git push origin
Push to multiple remotes. Add the hosted Git server as a remote:
git remote add git git@git:/home/git/repos/jamserver.gitSet multiple push URLs for Github and the server:
git remote set-url --push origin git@github.com:<username>/<reponame>.git
git remote set-url --add --push origin git@git:/home/git/repos/<reponame>.gitVerify push URLs:
git remote get-url --all --push originPush to both remotes:
git push originor to a specific remote:
git push gitThat's it!
.^.

Related Articles
Please log in to post a comment: