3

I want to work on my repo in private using GitLab but keep a public copy of the master branch on GitHub for visibility and accessibility purposes. Is it possible to 'automate' the mirroring of the master branch of both the GitHub and GitLab remotes, but retain the commit history in the GitLab whilst squashing commits down to a single commit with the GitHub one (without having to remember to manually do this each time)?

This might be a bit of a far-fetched request, but git continues to amaze me with how powerful and flexible it is!

Jefferson
  • 421
  • 5
  • 17

1 Answers1

2

Unless you are talking about a GitLab instance you are managing, you would still need a webhook that you run on your own server, and which is called by GitLab.com on every push.

See for example lowzj/gitlab-mirror-webhook (to be adapted in order to do what you want: a git merge --squash into a dedicated branch, and a git push to GitHub)

For a simple mirror (meaning without the squash step), GitLab proposes a mirror feature setting. This is easier than setting up a webhook... but less flexible.

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