2

I'm looking for a way to automatically mirror my Gitlab repos to Github, on push. I use Gitlab repos as my main repos, and would rather have to push to only one remote. But, I want my code to be browsable on Github also.

I found similar questions on StackOverflow, such as this one.

But the answers are always the same: one should add a custom post-receive git hook to the gitlab repo. This requires a shell access to the server running Gitlab. As I'm hosting a community edition Gitlab for many users, and not only me, they can't have easy access to a shell (and this isn't the most user-friendly way to do this), so it does not fit my needs.

I thought about two ways to implement it:

  • Either a MirrorOnPush project service, implementing such a git hook in Ruby, as the EmailOnPush project service currently do.

  • Or use a custom server to clone and push the repo, using a webhook.

The first one seems to be the cleaner to me, but I can't find any doc about Gitlab project service and code structure… On the other hand, the second is a bad and ugly hack, but is almost straightforward.

I'd rather implement a project service to handle it. Do you have any doc or leads on how to write a project service for Gitlab (without having to read all the Gitlab source code, as there seems to be no dev doc…) ?

Thanks !

helloflash
  • 2,457
  • 2
  • 15
  • 19
Phyks
  • 281
  • 1
  • 2
  • 11
  • possible duplicate of [Gitlab repository mirroring](http://stackoverflow.com/questions/14288288/gitlab-repository-mirroring) While this is a slightly more restricted, all possible answers are mentioned there, and are likely to be so in the future. – Ciro Santilli OurBigBook.com Dec 28 '14 at 09:17
  • The other question is more single-user centric, I think. But yes, the answers are there… This post was also about finding doc for services, but this does not seem to exist. – Phyks Dec 28 '14 at 16:27

1 Answers1

2

one should add a custom post-receive git hook to the gitlab repo.

Actually, that was the best solution, up until 7.x GitLab, as I detailed in "Gitlab repository mirroring";

A true project service for repo mirroring is requested, but not voted up enough: suggestion: suggestion 4614663.
The main documentations remains:

This isn't much, as the OP noted before.

Since it That leaves you with the hack approach.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250