Gitlab Master FAQ: Difference between revisions

From pCT
No edit summary
(Adding instructions how to mirror a repository)
Line 4: Line 4:


Please '''edit''' this page and '''add''' your question, or send email to pCT@uib.no
Please '''edit''' this page and '''add''' your question, or send email to pCT@uib.no
=== Mirror a repository ===
GitLab supports mirroring of a repository, the GitLab version provided by UiB supports mirroring by ''push''. That means, repository content is pushed to another repository.
The set this up
# Create a R/W repository access token in the target repository
# In the source repository choose '''Settings''' -> '''Repository''' and expand '''Mirroring repositories'''
#: '''Git repository URL''': https://oauth2@git.app.uib.no/group/project
#: '''Mirror direction''': Push (this is fixed in the current version of GitLab)
#: '''Authentication method''': Password (this is fixed in the current version of GitLab)
#: '''Password''': the access token
# Choose options, whether to prohibit diverging refs, and which branches to mirror. In most cases the mirroring should not be done for all branches but only the protected ones (which represent the stable development).
# Click <span style="color:white; background:green; border:solid 2px green">'''Mirror repository'''</span>
GitLab takes care of automatically pushing changes to mirror repository. Alternatively, update can be triggered from the Web interface
Example link
    https://oauth2@git.app.uib.no/pct/development/pct-online


=== Importing an external package ===
=== Importing an external package ===

Revision as of 13:52, 4 March 2021

Main Page -> Documentation -> Gitlab Master FAQ

This is a collection of frequently asked Gitlab questions for project maintainers

Please edit this page and add your question, or send email to pCT@uib.no

Mirror a repository

GitLab supports mirroring of a repository, the GitLab version provided by UiB supports mirroring by push. That means, repository content is pushed to another repository.

The set this up

  1. Create a R/W repository access token in the target repository
  2. In the source repository choose Settings -> Repository and expand Mirroring repositories
    Git repository URL: https://oauth2@git.app.uib.no/group/project
    Mirror direction: Push (this is fixed in the current version of GitLab)
    Authentication method: Password (this is fixed in the current version of GitLab)
    Password: the access token
  3. Choose options, whether to prohibit diverging refs, and which branches to mirror. In most cases the mirroring should not be done for all branches but only the protected ones (which represent the stable development).
  4. Click Mirror repository

GitLab takes care of automatically pushing changes to mirror repository. Alternatively, update can be triggered from the Web interface

Example link

   https://oauth2@git.app.uib.no/pct/development/pct-online

Importing an external package

The project will use a couple of external packages which are hosted in a different master repository. Copies of such external packages can be added to the gitlab server under our project group to provide a consistent package.

Here is a proposed workflow for importing a package which is already hosted in git.

  1. Create new repository in the pCT group or ask for creation, lets call it newPackage
  2. Fork the repository to your user space
  3. Clone the package you want to import
     git clone <some_external_link> newPackage # we give it the new name
     cd newPackage
  4. Redirect upstream URL to the fork in your gitlab user space
     git remote set-url origin https://user@gitlab.uib.no/user/newPackage.git
  5. Now make a forced push (option -f) to import the repository to your fork
     git push -f origin
  6. Create merge request to branch import (if not existing, master or any other appropriate branch) by following the instructions Pull/Merge request