← Todas las guías
Git + SSH key authentication setup
Install Git and generate an SSH key pair for authenticating with GitHub/GitLab/Bitbucket without typing a password on every push.
Esta guía se elaboró a partir de la documentación oficial de Git + SSH key authentication setup, enlazada arriba — verifica siempre ahí los nombres exactos de paquetes/versiones antes de ejecutar estos comandos en un servidor de producción, ya que las versiones de la distribución y del proyecto cambian con el tiempo.
1Install Git
# Windows winget install --id Git.Git -e# MacOS brew install git# Ubuntu/Debian sudo apt install git2Set your name and email
These appear on every commit you make -- use the same email as your GitHub/GitLab account so commits link to your profile.
git config --global user.name "Your Name"git config --global user.email "[email protected]"3Generate an SSH key pair
ssh-keygen -t ed25519 -C "[email protected]"Press Enter to accept the default file location. Ed25519 is the modern, recommended key type -- use `-t rsa -b 4096` only if a specific service requires RSA.
4Add the key to the SSH agent
eval "$(ssh-agent -s)"ssh-add ~/.ssh/id_ed255195Copy the public key and add it to your Git host
Paste the copied key into GitHub/GitLab/Bitbucket's SSH keys settings page, then verify:
# MacOS pbcopy < ~/.ssh/id_ed25519.pub# Windows (PowerShell) Get-Content ~/.ssh/id_ed25519.pub | Set-Clipboard# Linux cat ~/.ssh/id_ed25519.pub6Test the connection
ssh -T [email protected]