1. If you don’t already have one, generate a public-private key pair using ssh-keygen:
     $ ssh-keygen -t ed25519 -C "your_email@example.com"
    

    Note: ed25519 is just a more secure algo than rsa. -C just adds some meta data to the end of the key (think of it as a comment)

  2. Add your key to the ssh-agent by running the following two lines:
     $ eval "$(ssh-agent -s)"
     $ ssh-add ~/.ssh/<PRIVATE_key_name>
    
  3. Copy the contents of your public key to your clipboard.
  4. Go to github->settings->ssh and gpg keys. Click “new ssh key”. Paste your public key.
  5. Ensure the link to the remote repo in your local repo is in the format: git@github.com:<username>/<repo>.git

You just need to add one key per laptop/vm that you use.