我的 GitHub SSH 密钥应该是什么?

发布于 2024-10-08 20:29:49 字数 119 浏览 2 评论 0原文

我刚开始使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

铜锣湾横着走 2024-10-15 20:29:49

回答您的第一个问题:

为此,请将 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.

万水千山粽是情ミ 2024-10-15 20:29:49

如果您使用的是 Linux(或 msysGit 或 Cygwin...):

  1. 转到目录 ~/.ssh
  2. 检查您是否已有此文件:id_rsa.pub
  3. 获取此文件的内容 (cat id_rsa.pub),然后复制并粘贴到 GitHub。

就是这样。

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

  1. Go to directory ~/.ssh
  2. Check if you already have this file: id_rsa.pub
  3. Get the content of this file (cat id_rsa.pub) and just copy and paste to GitHub.

That is it.

无法言说的痛 2024-10-15 20:29:49

使用 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文