DEV Community

Matthew Odle
Matthew Odle

Posted on

Mirroring My Canvas Games Between GitLab and GitHub

I migrated my private projects to GitLab about 2 years ago when we started using it at work. I have nothing against GitHub, but I really like GitLab's interface. The problem is GitHub is THE place to host your stuff if you want others to have easy access to it. This meant I had to maintain two different remotes for every project.

Today, I fixed that.

GitLab's mirror push interface is really easy to use. You can access it via Settings > Repository > Push to a remote repository.


Usage:

  • Add the GitHub project's URL with the proper credentials to the 'Git repository URL' field
  • Click 'Update Now'
  • GitLab will show:
  • GitHub will show:

Woo.

Sources:

Top comments (3)

Collapse
 
lcavalli profile image
lcavalli

Aren't you storing your GitHub password in clear in GitLab options this way?

Collapse
 
matthewodle profile image
Matthew Odle

You are. Use at your own risk. Alternately you can set up a GitHub token and use that instead.

Ideally this would be done using ssh and post-receive hooks on your hosted GitLab, but with the goal being to automate my hobby workflow, spinning up my own GitLab seemed excessive.

If you have an alternative for automatically mirroring to GitHub, I would absolutely love to hear it.

Other options I've used are:

  • dual remotes on each project; manually pushing updates (less than ideal, one more step to forget)
  • custom bash script to push to both remotes for you (less than ideal, I switch workspaces often)
Collapse
 
derchrisuk profile image
Christian Gerbrandt

This is not available with the Gitlab CE version.