Generate a key with your own email or label:
ssh-keygen -t ed25519 -C "you@example.com"Keep the private key on your computer. Add the contents of the public key to GitHub under Settings > SSH and GPG keys:
cat ~/.ssh/id_ed25519.pubOn macOS, copy the public key directly:
pbcopy < ~/.ssh/id_ed25519.pubTest authentication and inspect the repository remote:
ssh -T git@github.com
git remote -vTo use SSH for a repository, replace OWNER and REPO:
git remote set-url origin git@github.com:OWNER/REPO.gitGitHub verifies signatures made with your private key against the public key registered to your account. The private key stays on your machine. If the key has a passphrase, an SSH agent can remember it for convenience.
See GitHub's guides to testing SSH and adding a key to ssh-agent.