Sync Gitlab to Github

April 17, 2020 | ☕ 1 minute read

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.

GitHub Steps

  1. Create a repository on GitLab (skip if already done)
  2. 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
  3. Open your GitHub user settings, and open the “Developer Settings”

Github user settings

  1. Under “Personal Access Token”, generate a new token
  2. For the token permissions, just grant the repo scope
  3. 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!

GitLab Steps

  1. Open the GitLab repository you want to mirror
  2. Under settings->repository there is a “Mirroring Repositories” section
  3. For repository URL, copy and paste the repository URL from Github. Change the URL to have your username. For example, will become https://[email protected]/TheConner/MyMirroredRepo
  4. Under password, put the previously generated personal access token
  5. Click “Mirror Repository” to add your mirroring settings
  6. 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

Force the repository to refresh if you see no Github activity

Done! Now the GitLab repository will automatically sync to GitHub, and all of the commit data will be shown on your GitHub profile.

Written by Conner Bradley

© Conner Bradley 2016-2023