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
Open your id_dsa.pub or some_name.pub file with gedit and copy-paste the contents!
Just use:
~/.ssh$ gedit some_name.pub
Here's how I found mine on OS X:
cd .ssh
(a hidden directory)If that doesn't work, do an ls
and see what files are in there with a .pub
extension.
It can be found on this path (default path):
/Users/john/.ssh
john
is your Mac username.
Use:
# sudo su
# cd /home/user/.ssh
.ssh# gedit id_rsa.pub
Then copy the entire file without any spaces. Click your icon at the top right of the GitHub page, go to settings, and add ssh.
Paste the copy into the space. It may prompt for your GitHub password. Enter it. Save.
I use Git Bash for my Windows.
$ eval $(ssh-agent -s) //activates the connection
$ ssh-add ~/.ssh/id_rsa //adds the identity
$ clip < ~/.ssh/id_rsa.pub //THIS IS THE IMPORTANT ONE. This adds your key to your clipboard. Go back to GitHub and just paste it in, and voilá! You should be good to go.
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 "your.email@example.com" -b 4096