August 21, 2015

Git

ssh keys

bash-3.2$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/iorch/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/iorch/.ssh/id_rsa.
Your public key has been saved in /home/iorch/.ssh/id_rsa.pub.
The key fingerprint is:
ec:00:00:00:00:00:00:00:00:00:00:00:00:00:00:0f iorch@ubuntosa
The key's randomart image is:
+--[ RSA 2048]----+
| ........        |
|     ...+..      |
|      ...B . ..  |
|   ..  o=.B   E  |
| o o    S= o . o |
|   +  o.  o =   .|
|   +  . oo +     |
|     ...... .    |
|         ...     |
+-----------------+

Esto genera un archivo id_rsa.pub en ~/.ssh/

id_ra.pub public keys

El archivo id_rsa.pub es el que deben compartir al servidor al que quieran tener acceso.

gitlab profile settings

SSH Keys

Add SSH Keys

Add SSH Keys

Github o Bitbucket

  • Existen otros servicios de repositorios remotos de git.
  • Las isntrucciones para tener acceso por ssh son similares en los tres.
  • Github es el más usado, les recomiendo abrir una cuenta ahí, además de la que usaremos aqui en gitlab

¿Ahora qué?

  1. clonar/crear repo git clone <repo URL>
  2. crear branch git checkout -b <my-new-branch-#issue>
  3. editar archivos vi/emacs/nano/atom/Xcode hello.py
  4. añadir archivos git add <hello.py>
  5. dar comit a los archivos git commit -m "This script says hi."
  6. empujar los cambios git push
  7. pedir pull request git request-pull master <repo URL> master:<my-new-branch-#issue>
  8. resolver conflictos
  9. jalar repo git pull
  10. crear branch git checkout -b <my-other-new-branch-#issue>
  11. ….

1.bis git init
1.bis.bis git remote set-url origin <my remote repo URL>