My organization has a dedicated machine for our GitLab install. I regularly work with other public projects (Drupal.org and Github). I would like to have a repo on our GitLab with a branch that would track the remote Drupal or Github project, in addition to having our own development and production branches.
Want this to be on the GitLab server (machine) so a developer is not responsible for tracking and updating from the public remote.
Essentially, fork public repo tracked on 'master', with internal branches 'devel' and 'prod'; developers only cloning internal devel branch. Then have the ability to pull from remote to master, then merge to other internal branches as desired. Can that be accomplished via the web interface or with hooks? or ...
Following the answer to Create a fork of public git repo for github it would seem that it would need to be a script to pull from public remote to local, then push to GitLab master, with the script set as a cron job. Yeah?
Any public Git repository can be forked or cloned. A fork creates a completely independent copy of Git repository. In contrast to a fork, a Git clone creates a linked copy that will continue to synchronize with the target repository.
If you need to fork a GitHub or GitLab repo, it's as simple as navigating to the landing page of the repository in your web browser and clicking on the Fork button on the repository's home page. A forked copy of that Git repository will be added to your personal GitHub or GitLab repo. That's it.
You can fork a project in GitLab by going to the project and clicking on the Fork button. This will create a copy of the project in your own namespace. You're allowed to do whatever you want with this copy as it's is your own.
There are three main ideas that need to be understood:
Therefore, if you insist that some branch(es) should be kept up to date on your server with the branches on remote (git:// or http(s)://) you can add new remote to your real git repository (usually located at /home/git/repositories, check your gitlab.yml) and set-up a cron to pull changes from such remote.
BUT, a lot of things may go wrong if the pull won't be a fast-forward and merge would be needed.
A solution to that would be to fetch the remote and reset instead, but this time all your changes would be lost.
If only possible, a much better solution would be to dedicate a bit of time and pull the changes by hand, check for consistencies and push to your local copy.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With