SSH keys let you authenticate to GitHub without typing your password each time. You'll create a keypair on your computer, add the public key to GitHub, and then verify the connection.
Open your terminal (or Git Bash on Windows) and run:
ssh-keygen -t rsa
Press Enter to accept the default save location. When prompted for a passphrase, you may leave it empty and press Enter.
This creates two files in ~/.ssh:
id_rsa (your private key — never share it) and id_rsa.pub (your public key — this is safe to share).
Print the public key and copy the entire line that begins with ssh-rsa:
cat ~/.ssh/id_rsa.pub
Back in your terminal, test authentication:
ssh -T git@github.com
A successful message looks like: "Hi <username>! You've successfully authenticated, but GitHub does not provide shell access."
~/.ssh/id_rsa (private) and ~/.ssh/id_rsa.pub (public).ssh-keygen -t ed25519.id_rsa.