You are here: start » en » centro » servizos » gitlab

Gitlab - GIT repository and continuous integration

This is an old revision of the document!


Gitlab - GIT repository and continuous integration

Service description

GitLab server, a tool to manage GIT repositories easily, very similar to GitHub.

It has GitLab CI activated with a Docker runner (and the possibility to add more runners) and Gitlab Pages.

Activation

All CITIUS users can use this service automatically.

User manual

GitLab access and first steps

Go to https://gitlab.citius.usc.es/ and use your CITIUS credentials in the LDAP tab.

Once logged in create a new project. Then the steps needed to initialize the repository will be displayed.

Remember that if you choose SSH as the access method (default option), you'll only be capable of doing so from inside the CITIUS network or using the VPN and you'll need to upload a public key in the preferences section. Adding the public key is a simple task and GitLab instructs you on the procedure. This is the recommended choice when working inside the building.

HTTPS access on the other hand works from everywhere and only a valid username and password are needed.

Clicking the dropdown menu the HTTPS address is shown.

GitLab CI

From version 8.0 onwards Gitlab CI is integrated with Gitlab. To start it is enough to create a file named .gitlab-ci.yml following the Gitlab CI guide.

Gitlab Pages

Pages in Gitlab Pages are served from a pages.citius.usc.es subdomain (with an alias in citiususc.io), and are created by a Gitlab CI job. There is a basic guide about Gitlab Pages in https://pages.citius.usc.es/ and more information available in Gitlab Pages hosting

Project creation by groups

Gitlab projects can be created by a user or by a group. If the project implies collaboration with other users or if it may be transferred to other user at some point then it is advisable to create the project in a group. To do so push the Create a group button inside the Groups page.

Big files (git lfs)

Files bigger than 100MB shouldn't be uploaded to the git repository the same way as the others but using git-lfs:

  1. Install the git-lfs client, available in the git-lfs package in the CITIUS Ubuntu 14.04 or here for other distros.
  2. No directorio do repositorio, iniciar o LFS: git lfs install
  3. Indicar os arquivos que serán manexados co LFS (poden usarse comodíns): git lfs add "*.ova"
  4. Engadir os arquivos a commits, da forma habitual: git add file.ova; git commit -m “Added big file”
  5. O LFS só funciona a través de HTTPS, non de SSH. Se estás a utilizar o remote por SSH, tes que engadir tamén o de HTTPS con outro nome antes de facer push, por exemplo: git remote add origin-https https://gitlab.citius.usc.es/grupo/proxecto.git
  6. Por último, fai un push ó remote HTTPS: git push origin-https master

Para clonar o repositorio, tamén hai que facer pasos adicionais:

  1. Facer o clone da maneira habitual por HTTPS: git clone https://gitlab.citius.usc.es/grupo/proxecto.git
  2. Cambiar ó directorio do repositorio e obter os arquivos do LFS: git lfs fetch

Problemas e preguntas frecuentes

Ó facer un push, recibo o seguinte erro: "error: RPC failed; result=22, HTTP code = 411"

Se recibes o HTTP code = 411, precisas configurar o comando git para aumentar o tamaño do buffer HTTP:

git config --global http.postBuffer 524288000 # permite ata 500MB

Se recibes o HTTP code = 413, é porque o push é demasiado grande. O servidor acepta push de ata 70MB por HTTP e calquera push maior dará ese erro. Se precisas facer pushes maiores, tes que usar SSH cun par de chaves en vez de HTTP.

Ó clonar o repositorio, recibo o seguinte erro: "Agent admitted failure to sign using the key."

Se tes a chave SSH correctamente configurada no servidor, acabas de creala e nunca a probaches, debes executar no teu equipo o seguinte comando para engadila ó axente de autenticación local:

ssh-add