Assume that you have the same project code project-awesome
, but hosted on three different repositories:
## on Github
https://github.com/vikbert/project-awesome
## on GitLab
https://gitlab.com/vikbert/project-awesome
## on Bitbucket
https://bitbucket.com/vikbert/project-awesome
And you use the GitHub repository as your MAJOR repository, but you wanna push also the new features to the other repositories on gitlab
and bitbucket
at the same time
.
Here is the solution to make it possible:
1) define the major remote repository named origin
git remote add origin https://github.com/vikbert/project-awesome
2) define another remote repository named all
git remote add all https://github.com/vikbert/project-awesome
3) add the additional Urls to the remote group all
## we add the two other additional remote URL to the "all" remote.
git remote set-url all --push --add https://gitlab.com/vikbert/project-awesome
git remote set-url all --push --add https://bitbucket.com/vikbert/project-awesome
4) check if the grouped URLs are set to the remote all
git remote -v
we will see the remote "all" repository own the three different URLs
# origin https://github.com/vikbert/project-awesome (fetch)
# origin https://github.com/vikbert/project-awesome (push)
# all https://github.com/vikbert/project-awesome (fetch)
# all https://gitlab.com/vikbert/project-awesome (push)
# all https://bitbucket.com/vikbert/project-awesome (push)
5) Now push the current changes to all of 3x remote repositories
## if your current local branch is "master"
git push -u all master
💥 Remove the remote repository from the group all
git remote set-url all --push --delete https://bitbucket.com/vikbert/project-awesome
Top comments (0)