Create a public and private key:
ssh-keygen -t ed25519
I’d suggest renaming the files: e.g. github.private.key, github.public.key
Add your public key to your GitHub account.
Create “config” in your user’s .ssh directory:
Host github.com
User <your github username here without brackets>
Hostname github.com
PreferredAuthentications publickey
IdentityFile /path/to/your/.ssh/private/key
See this GitHub article.