Push :: To Multiple Repos Simultaneously
1 min read
This tutorial helps demonstrate the process configuration to push your source code to multiple repositories.
If a need arises to have multiple repos, then it's always better that they are in sync. Fortunately, Git allows pushing the source code to multiple repos at once.
Let's consider the following repo urls for the source code to be pushed. You can observe, the urls are almost identical except the domain name.
Note : To prevent being asked for passwords while pushing the source code, make sure to set up SSH access for each service.
Let's have an alias created called origin to your main remote repository (i.e. Github)
git remote add origin email@example.com:g33kzone/multi-repo.git
Configure Push Remote URLs
Following commands (over the command line) will do the trick.
git remote set-url --add --push origin firstname.lastname@example.org:g33kzone/multi-repo.git
git remote set-url --add --push origin email@example.com:g33kzone/multi-repo.git
This can be confirmed by running the following command
git remote show origin
Push Multiple Repos
Use the following command (over the command line - once) to set the upstream
git push --set-upstream origin master
Later only "git push" should also work.