Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I access my SSH public key?

Tags:

git

ssh

rsa

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 access my SSH public key?

like image 632
sscirrus Avatar asked Sep 30 '10 06:09

sscirrus


People also ask

How do I find my public key Linux?

pub from the file name (in any instance). Remember id_rsa is the private key and id_rsa. pub is the public key. And that's all there is to viewing your SSH public and private keys on Linux, macOS, and Windows.


4 Answers

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

like image 194
Mitch Dempsey Avatar answered Oct 04 '22 22:10

Mitch Dempsey


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 paste it wherever you need.

More details on the process, check: Generating SSH Keys.

like image 45
DD_ Avatar answered Oct 04 '22 22:10

DD_


Mac, Ubuntu, Linux compatible machines, use this command to print public key, then copy it:

$ cat ~/.ssh/id_rsa.pub
like image 40
Tellisense Avatar answered Oct 05 '22 00:10

Tellisense


If you're using windows, the command is:

type %userprofile%\.ssh\id_rsa.pub

it should print the key (if you have one). You should copy the entire result. If none is present, then do:

ssh-keygen -t rsa -C "[email protected]" -b 4096
like image 29
Jghayes525 Avatar answered Oct 04 '22 23:10

Jghayes525