How to sync gitlab with github

It's only in the enterprise edition and on GitLab.com, but GitLab has introduced this feature directly, without any workarounds.

They've documented pulling/pushing from/to a remote repository in GitLab Docs → User Docs → Projects → Repositories → Mirroring.

It's in the same section of configuration that you can push, too:

  1. From within a project use the gear icon to select Mirror Repository
  2. Scroll down to Push to a remote repository
  3. Checkmark Remote mirror repository: Automatically update the remote mirror's branches, tags, and commits from this repository every hour.
  4. Enter the repository you want to update; for GitHub you can include your username and password in the URL, like so: https://yourgithubusername:[email protected]/agaric/guts_discuss_resource.git

Note that I haven't tried it, but you should be able to push to and pull from the same repository. It's working great for me pulling from a remote repository (drupal.org), and pushing to a different remote repository (gitlab.com).


For syncing from GitHub to GitLab you could use the Webhooks to send a notification to your site and possibly manage this somehow (although I don't know if GitLab supports this out of the box).

And with a bit more implementation you could (theoretically) use the GitHub API.

I also found a small script named "simple (and dirty) sync between redmine issues and gitlab issues" which should do at least this.


The answers of rugk and mlncn are outdated.

The correct procedure is now described in GitLab Docs → User Docs → Projects → Repositories → Mirroring.

Tags:

Git

Github

Gitlab