← Tutte le guide
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.
Sistema: Windows / MacOS / LinuxDevelopmentVersion ControlSito ufficiale ↗Documentazione ufficiale ↗
Questa guida è redatta a partire dalla documentazione ufficiale di Git + SSH key authentication setup, linkata sopra — verifica sempre lì i nomi esatti di pacchetti/versioni prima di eseguire questi comandi su un server di produzione, poiché le versioni della distribuzione e del progetto cambiano nel tempo.
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]