AKA automagic mirroring of your GitHub into GitLab.

There is a simple way to set up Git to use multiple push URLs for a single remote. This way you can easily mirror any Git repository into any hosting provider when git pushing.

Let’s say your GitHub’s user is user and you want to mirror your repo into GitLab. Your local clone is initially:

$ git remote -v
origin  git@github.com:user/repo.git (fetch)
origin  git@github.com:user/repo.git (push)

Now we need to configure the origin remote to have two URLs:

$ git remote set-url --add --push origin git@github.com:user/repo.git
$ git remote set-url --add --push origin git@gitlab.com:user/repo.git

And the magical result:

$ git remote -v
origin  git@github.com:user/repo.git (fetch)
origin  git@github.com:user/repo.git (push)
origin  git@gitlab.com:user/repo.git (push)

This makes every git push send the changes to both GitHub and GitLab, creating an automatic backup.

But note that git pull is still from GitHub. It is not possible to pull changes from two different repositories.