Submitting changes to several git repositories


Detailed setting description

Let’s start with the usual settings remote

git remote add origin https://github.com/xorcare/example.git

Further, what would happen automatically push in the additional repository, you need to run the following command

git remote set-url --add --push origin https://bitbucket.org/xorcare/example.git

After executing this command, we get the situation that fetch changes occur from Github, but sending the changes push to the repository ** Bitbucket **, in order to return sending the changes to the repository Github and get The desired result with sending changes to both repositories needs to execute one more command.

git remote set-url --add --push origin https://github.com/xorcare/example.git

Now each time you run git push origin changes, two repositories will be sent, you can add more than two repositories if necessary.

Full set of commands for Github, Bitbucket

git remote add origin https://github.com/xorcare/example.git

git remote set-url --add --push origin https://bitbucket.org/xorcare/example.git
git remote set-url --add --push origin https://github.com/xorcare/example.git

It is worth noting that with the current setting, the repository on Github turns out to be the main thing, since reading changes only happens from this repository and if changes are sent to another Bitbucket ** from another working meta, they cannot be downloaded without additional gestures with replacement remote.

Submitting changes to Github, Gitlab, Bitbucket

git remote add origin https://github.com/xorcare/example.git

git remote set-url --add --push origin https://github.com/xorcare/example.git
git remote set-url --add --push origin https://gitlab.com/xorcare/example.git
git remote set-url --add --push origin https://bitbucket.org/xorcare/example.git

P. S. It is understood that when executing commands, the addresses of your repositories will be substituted.