Ubuntu 无法为github和aws生成ssh密钥(非法选项--C)
我一直在尝试使用我的github帐户设置ssh,并遵循指南和运行其中列出的命令:我得到以下错误Ubuntu 无法为github和aws生成ssh密钥(非法选项--C),ubuntu,amazon-web-services,github,ssh,Ubuntu,Amazon Web Services,Github,Ssh,我一直在尝试使用我的github帐户设置ssh,并遵循指南和运行其中列出的命令:我得到以下错误 ssh-keygen -t rsa -b 4096 -C "your_email@example.com" illegal option -- C Usage: ssh-keygen [options] [key1 key2 ...] Where `options` are: -b nnn Specify key strength in bits (e.g. 1024) -t d
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
illegal option -- C
Usage: ssh-keygen [options] [key1 key2 ...]
Where `options` are:
-b nnn Specify key strength in bits (e.g. 1024)
-t dsa | rsa Choose the key type.
-c comment Provide the comment.
-e file Edit the comment/passphrase of the key.
-p passphrase Provide passphrase.
-P Assume empty passphrase.
-?
-h Print this help text.
-q Suppress the progress indicator.
-1 Convert a SSH 1.x key.
-i file Load and display information on `file'.
-D file Derive the public key from the private key 'file'.
-B number The number base for displaying key information (default 10).
-V Print ssh-keygen version number.
-r file Stir data from file to random pool.
-F file Dump fingerprint of file.
我正在运行Ubuntu14.04,根据您命令的输出,我推测您应该将
-C
替换为-C
(小写)。因此,请使用-c
重试:
ssh-keygen -t rsa -b 4096 -c "your_email@example.com"
从文档中,-C
应该提供新的注释:
-C
注释
提供新的注释
因此,由于您的输出显示提供注释,我想它应该与-c
一起使用
或者,您可以尝试使用
ssh-keygen-t rsa
原来
ssh-keygen
实际上被覆盖了:
我发现,出于某种原因,我在/usr/local/bin中有另一个ssh-keygen二进制文件,所以当我使用它时,我使用的是这个二进制文件,而不是/usr/bin中ubuntu附带的二进制文件,删除多余的二进制文件,然后重新安装Openssh服务器,openssl修复了所有问题。谢谢
这样做会生成一个与github不兼容的ssh2密钥。另外,对于aws,它会自动运行此命令,因此在我使用ssh设置项目的过程中失败。@AdityaBalwani使用
-C
在我的Ubuntu 15.04和我兄弟的Ubuntu 14.04上运行良好。我不知道这里有什么,除了你可以在另一台机器上生成并复制到你的原始机器上。@AdityaBalwani尝试使用ssh-keygen-t rsa
——看看这是否有助于执行ssh-keygen-t rsa
也生成一个ssh2密钥。@AdityaBalwani我刚刚测试过,它对我来说工作正常。我把它添加到GitHub中没有问题。如果对你不起作用,你可以试试。