SOCIB RAMADDA Data Repository
Click to show menu
InformationAdd/View CommentsAdd to Cart
Manual de usuario

El manual está enfocado a las aplicaciones desarrolladas en SOCIB, exponiendo como ejemplo la aplicación de instrumentación y de procesado.

Ubicación de los repositorios

Todos los repositorios GIT están el ubicados en el home de gituser
/home/gituser/repositories/.

Para crear un clone de los respositories, se accede a través del servidor portal.socib.es, con el usuario gituser
git clone gituser@portal.socib.es:repositories/

Configuración del repositorio

Primero instalar el GIT, tanto en el servidor como en los clientes.
sudo aptitude install git-core

Preparar la autentificación
Crear las clave públicas y privada (id_rsa.pub y id_rsa) para los usuarios clientes.
ssh-keygen -t rsa

El contenido del fichero id_rsa.pub se tiene que añadir al fichero /home/gituser/.ssh/authorized_keys. De este modo al realizar el clone a través de ssh con el usuario gituser no nos pedirá contraseña.

Configuración inicial de los usuario clientes

Es necesario configurar el nombre y email del git, para tener control de quién a realizado los cambios en el repositorio.
git config --global user.name "Nombre Apellido"
git config --global user.email "user@socib.es"

Bajarse el fichero .gitignore_global al home, que contendrá los directorios que no deben ser versionados
git config --global core.excludesfile /home/user/.gitignore_global

Git cheat sheet
Git cheat sheet

Además de los comandos del git cheat sheet, otros que también serán utilizados.

Al realizar el push, tanto para añadir o borrar hay que añadir el subrepositorio origin (el que hay por defecto). Dentro de un mismo repositorio pueden haber subrepositorios, utilizados para cambios de gran envergadura.
git push origin local_branch:remote_branch

Añadir nuevos ficheros y cambios realizados, y eliminar ficheros que han sido borrados localmente.
git add -a

Si se desea configurar un repositorio central (únicamente servirá como repositorio de referencia), es decir, se podrá modificar el repositorio desde sesiones remotas y nunca se podrá modificar el repositorio desde la propia sesión que lo alberga. Para ello se ha de crear el repositorio con el siguiente comando en el directorio en el que se quiera crear el respositorio:
git init --bare

Comandos interesantes

Modificar el mensaje del último commit
git commit --amend -m "Nuevo mensaje"

Cambiar a una branch y crearla a la vez
git checkout -b nombreDeLaBranche

Tips and tricks

  • Show the current branch in the shell prompt. Simply paste the lines of .bashrc_git in your .bashrc. Or better, source the file from there.

  • Renaming and deleting files. When moving (renaming) or removing (deleting) a tracked file (already staged or committed), consider using git mv and git rm respectively, instead of raw mv and rm. This will reflect your changes in the working tree also in the staging area.

Documentation and references

  • ProGit: a very good book and reference site about what Git is and how to use it.
  • A successful branching model: a proposal of branching model based on feature and release branches. A slightly modified version substituting the release branches by a testing branch might be more practical for the SOCIB workflow.
  • Interactive Git cheat sheet: an interactive visual summary of Git commands, annotated and organized according to which areas they involve.
  • Semantic Versioning: a proposal of version numbering scheme for long-term projects, powered by GitHub.
  • Commit message best practices: a note about well formed Git commit messages.
  • Interface a SVN repository: How to use Git to contribute to projects that have not migrated their SVN repositories to Git (yet).

Powered by Geode Systems and RAMADDA