If you host your main repository elsewhere and would like to use e.g. GitLab-CI for testing, you would wish to have an option to mirror your repository easily with your GitLab-instance. Unfortunately, the mirroring feature is only integrated natively in the Enterprise Edition of GitLab so far. One of the ways of setting up automated mirroring also in the Community Edition is using GitLab-CI for it.
- Create a new SSH key pair without a passphrase (Example: https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/)
- Add the public key to your main repository hosting service as well as to GitLab.
- Add the private key as a Secret Variable to your project in GitLab.
- Add
.gitlab-ci.yml
to your project. Use the one you can find in this repository as an example. - Create your project in GitLab and mirror it once manually:
# Clone your repository
git clone --mirror [email protected]:<user>/<repository>
cd <path_to_your_repo>
# Push it to your GitLab instance
git push --mirror [email protected]:<user>/<repository>
- Set up a scheduled build, which runs e.g. every night.
Also have a look here https://docs.gitlab.com/ce/ci/ssh_keys/README.html for information about how to use SSH keys in GitLab-CI.
You can also use GitHub as an external issue tracker.