When using Git for version control, many people use GitHub as a place to hold remote repositories and push their repositories there. I recently started using BitBucket also and wanted to be able to simultaneously update my GitHub and BitBucket repositories when changes were made.

To begin, rename your current remote (most likely named origin) to a different name. I’d rename this to the name of the service you are using, such as Github or bitbucket.

You can then add the remote for your second remote repository, in this case, a BitBucket repository.

Afterward, you’ll want to set up your origin remote to push to both of these. Issue the following command:

You will be greeted with your Git configuration (most likely using vim). Add the [remote "origin"] section to the bottom of the file with the URLs from each remote repository you’d like to push to.


You can then push to both repositories by issuing:

Or to a single one by issuing either of these commands: