There are several ways to mirror a repository both on GitLab and GitHub.

Repository Mirroring πŸ”—︎

The free GitLab plan allows you to pull from a remote repository.
You could use a GitHub repository as the main repo, and the GitLab repo as the mirror.

In theory, you can also push from GitLab to GitHub. But I couldn't get it working on GitLab's free plan.

Remote Repositories and Overloading πŸ”—︎

The alternative is to “overload” your remote repository address. This method works well for personal projects:

git remote set-url ––add origin

You don’t see this trick everyday, but in git the relationship between a remote name and remote URL is not necessarily one-to-one! Git will quite happily map a remote name to multiple repository URL’s.

Use Conditional Includes πŸ”—︎

If you want to use either GitLab or GitHub, or if you want to use separate git identities, you can use conditional includes.

Git will automatically apply the correct configuration (email, user, etc.) depending on the directory you set up.

Further Reading πŸ”—︎