开发者

What should my GitHub SSH key be?

开发者 https://www.devze.com 2023-02-01 04:25 出处:网络
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 m开发者_开发百科y key? Do I make it up?

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 m开发者_开发百科y key? Do I make it up?

EDIT:

I'm on OSX


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.


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 "name@email.com" -t rsa
  3. Get the content of this file (cat id_rsa.pub) and just copy and paste to GitHub.

That is it.


The Linux tips with ssh-keygen will most definitely work in OSX on the command line. With that, Adriano's method should work fine. Remember to paste the pub key and not the other.

0

精彩评论

暂无评论...
验证码 换一张
取 消