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. Dende a versión 8.0, Gitlab CI está integrado en Gitlab. Para comezar a usalo, basta con crear un arquivo chamado .gitlab-ci.yml seguindo a guía de Gitlab CI.

Gitlab Pages

As páxinas de Gitlab Pages sérvense nun subdominio de pages.citius.usc.es (cun alias en citiususc.io), e créanse a partir dun traballo de Gitlab CI. Tes unha guía básica sobre o uso de Gitlab Pages en https://pages.citius.usc.es/ e máis información na páxina de Aloxamento con Gitlab Pages

Creación de proxectos en grupos

Os proxectos de GitLab poden crearse dentro dun usuario ou dentro dun grupo. Se o proxecto vai a ser en colaboración con outras persoas, ou é susceptible de ser traspasado a outra persoa unha vez remates o traballo nel, é preferible que cres o proxecto dentro dun grupo. Para facelo, pulsa no botón Create a group dentro da páxina de Groups.

Arquivos grandes (git lfs)

Os arquivos maiores de 100MB non deben subirse ó repositorio git da forma habitual, senon usando git-lfs. O procedemento é o seguinte:

  1. Instalar o cliente de git-lfs, dispoñible no paquete git-lfs na Ubuntu 14.04 do centro ou nesta páxina para outras distribucións.
  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