Mis "Tips" de Git

2 mins

Configurar la seguridad

Fuente

1. Generate an SSH key

Linux/Mac

cd ~                 #Your home directory
ssh-keygen -t rsa    #Press enter for all values

For Windows

(Only works if the commit program is capable of using certificates/private & public ssh keys)

Use Putty Gen to generate a key Export the key as an open SSH key Here is a walkthrough on putty gen for the above steps

2. Associate the SSH key with the remote repository

This step varies, depending on how your remote is set up.

If it is a GitHub repository and you have administrative privileges, go to settings and click ‘add SSH key’. Copy the contents of your ~/.ssh/id_rsa.pub into the field labeled ‘Key’. If your repository is administered by somebody else, give the administrator your id_rsa.pub.

3. Set your remote URL to a form that supports SSH 1

If you have done the steps above and are still getting the password prompt, make sure your repo URL is in the form

git+ssh://git@github.com/username/reponame.git

as opposed to

https://github.com/username/reponame.git

To see your repo URL, run:

git remote show origin

You can change the URL with:

git remote set-url origin git@github.com/username/reponame.git

4. Configuración básica de un repositorio en github.com

  1. Crear repositorio nuevo en github.com
  2. Usar https:, seguramente es mejor ssh: pero me resulto más simple y cómodo por ahora el primero
  3. Clonar el directorio remoto, por ejemplo: git clone https://github.com/pmoracho/code.snippets.git
  4. Configurar datos básicos por repositorio:
     git config user.email "zandanga@gmail.com"
     git config user.name "Patricio Moracho"
    
  5. Configurar la url del remoto
     git remote add origin https://github.com/pmoracho/code.snippets.git
     git push --set-upstream origin master
    
  6. Configurar el guardado temporal de las credenciales
     git config --global credential.helper cache
     git config --global credential.helper "cache --timeout=3600"
    

Recursos escenciales


Si te gustó o te resulto útil lo que has leído y tienes las ganas de colaborar con el autor, puedes hacerlo a través:

@pmoracho QR code
https://pmoracho.github.io/blog/2017/01/13/Mis-Tips-de-Git/
13-Jan-17
BY-NC-SA 4.0 https://pmoracho.github.io/disclosure
https://pmoracho.github.io/blog/2017/01/13/Mis-Tips-de-Git/