I love GitLab, but a problem I have with it is I wish it showed my commit activity on GitHub (which most people look at), and I also wish I had a backup / mirror of my repository on GitHub either for other people to look at, or just a private backup.
- Create a repository on GitLab (skip if already done)
- Create a repository on GitHub. Make it public or private depending on what you want to use the repository for. Note: even if the repo is private it will still show up on your GitHub activity
- Open your GitHub user settings, and open the “Developer Settings”
- Under “Personal Access Token”, generate a new token
- For the token permissions, just grant the repo scope
- Once the token is generated: copy it to somewhere safe. If you lose the token and need to get it again for some reason, you will have to generate a new one!
- Open the GitLab repository you want to mirror
- Under settings->repository there is a “Mirroring Repositories” section
- For repository URL, copy and paste the repository URL from Github. Change the URL to have your username. For example,
- Under password, put the previously generated personal access token
- Click “Mirror Repository” to add your mirroring settings
- Click the refresh button to begin mirroring. It should take a minute, but you will see that all the commits will be pushed over to GitHub
Done! Now the GitLab repository will automatically sync to GitHub, and all of the commit data will be shown on your GitHub profile.