Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What should my GitHub SSH key be?

I'm gettings started with GitHub and I have no clue what I'm doing.

What is an SSH key? What should I be setting as my key? Do I make it up?

EDIT:

I'm on OSX

like image 739
Moshe Avatar asked Aug 01 '26 16:08

Moshe


2 Answers

To answer your first question:

For this purpose, think of SSH as a method of secure communication, using cryptography.

For most cryptographic algorithms, it would be necessary for you and GitHub to agree on a key separately, which is in generally impractical. Therefore, SSH uses a class of cryptographic algorithms called "public key" or "asymmetric".

The idea is that you have two keys, such that what is encrypted by one is decrypted by the other, and it isn't computationally feasible to calculate one from the other. There really weren't that many algorithms that worked, last I looked, but they existed.

Therefore, you have to generate the keys, randomly, and you call one your public key and one your private. You send your public key to GitHub, or anybody else that wants it. (Much of this is all handled automatically, given the right software.) Then GitHub can send you information secretly by encrypting it with your public key, and only you can decrypt it. GitHub will, similarly, send you a public key so you can send secret messages.

In practice, these ciphers are inefficient, so what you send back and forth is keys for efficient cryptographic algorithms.

like image 101
David Thornley Avatar answered Aug 04 '26 06:08

David Thornley


If you have Linux (or msysGit or Cygwin...):

  1. Go to directory ~/.ssh
  2. Check if you already have this file: id_rsa.pub
    • If not, create it using this command: ssh-keygen -C "[email protected]" -t rsa
  3. Get the content of this file (cat id_rsa.pub) and just copy and paste to GitHub.

That is it.

like image 38
Adriano P Avatar answered Aug 04 '26 06:08

Adriano P



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!