I\'ve just generated my RSA key pair, and I wanted to add that key to GitHub.
I tried cd id_rsa.pub
and id_rsa.pub
, but no luck. How can I acce
On terminal cat ~/.ssh/id_rsa.pub
explanation
The following command will save the SSH key on the clipboard. You only need to paste at the desired location.
cat ~/.ssh/id_rsa.pub | pbcopy
On a Mac, you can do this to copy it to your clipboard (like cmd + c
shortcut)
cat ~/Desktop/ded.html | pbcopy
pbcopy < ~/.ssh/id_rsa.pub
and to paste
pbpaste > ~Documents/id_rsa.txt
or, use cmd + v
shorcut
to paste it somewhere else.
~/.ssh
is the same path as /Users/macbook-username/.ssh
You can use Print work directory: pwd
command on terminal to get the path to your current directory.
On Mac/unix and Windows:
ssh-keygen
then follow the prompts. It will ask you for a name to the file (say you call it pubkey, for example).
Right away, you should have your key fingerprint and your key's randomart image visible to you.
Then just use your favourite text editor and enter command vim pubkey.pub
and it (your ssh-rsa key) should be there.
Replace vim with emacs or whatever other editor you have/prefer.
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 ssh-keygen
first.
cat ~/.ssh/id_rsa.pub
or cat ~/.ssh/id_dsa.pub
You can list all the public keys you have by doing:
$ ls ~/.ssh/*.pub