rsa public key No such file or directory?

Use ssh-keygen to create a default ssh key pair, for now without passphrase:

ssh-keygen -t rsa -C "MyEmailAddress" -f ~/.ssh/id_rsa -P ""

Then any ssh command will use by default that key.


First, check for existing SSH Key using the following command:

ls -al ~/.ssh

Check the directory listing to see if you already have a public SSH key. By default, the filenames of the public keys are one of the following: id_xxxx.pub (ex: id_rsa.pub). If you don't have an existing public and private key pair, create one using this command:

ssh-keygen -t rsa -b 4096 -C "[email protected]"

This creates a new ssh key, using the provided email as a label. When you're prompted to "Enter a file in which to save the key," press Enter. This accepts the default file location. At the prompt, type a secure passphrase.

If you see an existing public and private key pair listed that you would like to use to connect to GitHub, or once you are done with the above key generation step, you can add your SSH key to the ssh-agent with the following commands:

eval "$(ssh-agent -s)"

ssh-add ~/.ssh/id_rsa (Add -K option, if on MAC OS, as it will add the passphrase in your keychain when you add an ssh key to the ssh-agent.)

Source: https://docs.github.com/