Github: 新的 SSH 密钥

Github: New SSH key

我对 SSH 等知之甚少。我试图在 Github 上添加新的 SSH 密钥。为此,我遵循了以下程序:

在终端上

work@Nirvair:~$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/work/.ssh/id_rsa): 
Created directory '/home/work/.ssh'.
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/work/.ssh/id_rsa.
Your public key has been saved in /home/work/.ssh/id_rsa.pub.

然后是钥匙指纹钥匙的随机艺术图像

在浏览器上

我打开了:

Github >> Settings >> SSH and GPG keys >> New SSH key

它要求 标题密钥。我给了一些标题,然后我在那里复制了我的密钥 id_rsa.pub。它给出了一个错误:

Key is invalid. It must begin with 'ssh-ed25519', 'ssh-rsa', 'ssh-dss', 'ecdsa-sha2-nistp256', 'ecdsa-sha2-nistp384', or 'ecdsa-sha2-nistp521'. Check that you're copying the public half of the key

我不知道如何进行下一步。请告诉我我哪里错了或指导我一个好的教程。

OS 详情:Ubuntu 14.04.5

谢谢!

PS:我试图通过互联网阅读有关 "key fingerprint" 和 "key's randomart image" 的内容,但一切都超出了我的理解范围

您确定您完全复制了您的 public 密钥吗?

执行

cat /home/work/.ssh/id_rsa.pub

并将所有内容复制到剪贴板。

你也可以用xclip试试:

xclip -sel clip < /home/work/.ssh/id_rsa.pub