18 Jan 2022
Adding multiple remotes for a single git repository
It is sometimes useful to make multiple remote copies of a git repository, for instance, pushing your changes to both GitLab and GitHub. This can easily be done by calling the following commands:
git remote add gitlab url-to-your-gitlab-repository git remote add github url-to-your-github-repository
The url-to-your-gitlab/github-repository
part assumes that you already have
created an empty repository in GitLab/GitHub. Now we are ready to push the
latest changes using:
git push gitlab branch-name git push github branch-name
where the branch-name
variable refers to the actual name of the branch
you need to push.