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 !

2
  • possible duplicate of 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. Commented Dec 28, 2014 at 9: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. Commented Dec 28, 2014 at 16:27

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.