我的 GitHub SSH 密钥应该是什么?
我刚开始使用 GitHub,但我不知道自己在做什么。
什么是 SSH 密钥?我应该将什么设置为我的密钥?我弥补吗?
编辑:
我在 OSX 上
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
回答您的第一个问题:
为此,请将 SSH 视为一种使用加密技术的安全通信方法。
对于大多数加密算法,您和 GitHub 需要分别就密钥达成一致,这通常是不切实际的。因此,SSH 使用一类称为“公钥”或“非对称”的加密算法。
这个想法是,你有两个密钥,这样一个密钥加密的内容就会被另一个密钥解密,并且从另一个密钥计算一个密钥在计算上是不可行的。我上次查看时,确实没有那么多有效的算法,但它们确实存在。
因此,您必须随机生成密钥,并将一把称为您的公钥,一把称为您的私人密钥。您将公钥发送给 GitHub 或任何需要它的人。 (如果有合适的软件,其中大部分都是自动处理的。)然后 GitHub 可以通过使用您的公钥加密来秘密向您发送信息,并且只有您可以解密它。同样,GitHub 会向您发送公钥,以便您可以发送秘密消息。
实际上,这些密码效率低下,因此您来回发送的内容是高效加密算法的密钥。
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.
如果您使用的是 Linux(或 msysGit 或 Cygwin...):
~/.ssh
id_rsa.pub
ssh-keygen -C " [电子邮件受保护]" -t rsa
cat id_rsa.pub
),然后复制并粘贴到 GitHub。就是这样。
If you have Linux (or msysGit or Cygwin...):
~/.ssh
id_rsa.pub
ssh-keygen -C "[email protected]" -t rsa
cat id_rsa.pub
) and just copy and paste to GitHub.That is it.
使用 ssh-keygen 的 Linux 技巧绝对适用于 OSX 命令行。如此看来,阿德里亚诺的方法应该行得通。请记住粘贴公钥而不是其他密钥。
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.