How do I access my SSH public key?
I've just generated my RSA key pair, and I wanted to add that key to GitHub.
cd id_rsa.pub and
id_rsa.pub, but no luck. How can I access my SSH public key?
cat ~/.ssh/id_rsa.pub or
You can list all the public keys you have by doing:
$ ls ~/.ssh/*.pub
Read more... Read less...
Copy the key to your clipboard.
$ pbcopy < ~/.ssh/id_rsa.pub # Copies the contents of the id_rsa.pub file to your clipboard
Warning: it's important to copy the key exactly without adding newlines or whitespace. Thankfully the pbcopy command makes it easy to perform this setup perfectly.
And you can paste it wherever you need.
To get a better idea of the whole process, check this: Generating SSH Keys.
You may try to run the following command to show your RSA fingerprint:
ssh-agent sh -c 'ssh-add; ssh-add -l'
or public key:
ssh-agent sh -c 'ssh-add; ssh-add -L'
If you've the message: 'The agent has no identities.', then you've to generate your RSA key by
If you're on Windows use the following, select all, and copy from a Notepad window:
If you're on OS X, use:
pbcopy < ~/.ssh/id_rsa.pub
Here's how I found mine on OS X:
- Open a terminal
- (You are in the home directory)
cd .ssh(a hidden directory)
- pbcopy < id_rsa.pub (this copies it to the clipboard)
If that doesn't work, do an
ls and see what files are in there with a
After you generate your SSH key you can do:
cat .ssh/id_rsa.pub |pbcopy
which will copy your ssh key into your clipboard.