If you receive this message when attempting to clone a repository.

git@github.com: Permission denied (publickey)

This article assumes you are running a Unix-based system like Linux, macOS, or Windows Subsystem for Linux.

Try the following:

# Should return: Agent pid [process pid]
eval "$(ssh-agent -s)"

# Add your ~/.ssh/id_rsa.pub file to your GitHub keys if it's not already there

# Should return "Identity Added"
ssh-add ~/.ssh/id_rsa