2015-10-05 141 views
0

我一直在试图设置ssh和我的github帐户,并遵循https://help.github.com/articles/generating-ssh-keys/上的指南并运行列出的命令:我得到以下错误无法为github和aws(非法选项-c)生成ssh密钥

ssh-keygen -t rsa -b 4096 -C "[email protected]" 
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. 

我运行Ubuntu 14.04

回答

0

从你的命令的输出,我猜测你应该更换-C-c(小写)。因此,与-c再试一次:

ssh-keygen -t rsa -b 4096 -c "[email protected]" 

从文档,-C应该提供一个新评论:

-C评论

提供了新的注释。

所以,既然你说的输出提供评论,我想这应该-c工作。


作为替代方案,您可以尝试使用ssh-keygen -t rsa


事实证明,在ssh-keygen实际上覆盖:

我想通了,由于某种原因,我有另外的ssh-凯基二进制在我的/ usr/local/bin目录,所以当我使用它在/ usr/bin中使用那个而不是ubuntu中的那个删除额外的二进制文件,然后重新安装Openssh-server和openssl修复了一切。谢谢!

+0

这样做会生成一个ssh2键,它不会与github一起使用。 另外,在aws的情况下,它自动运行这个命令,因此它在我通过ssh设置项目的过程中失败。 –

+0

@AdityaBalwani在我的Ubuntu 15.04和我兄弟的Ubuntu 14.04上使用'-C'可以很好地工作。这里不知道,除非你可以在另一台机器上生成它并将它复制到你的原始机器上。 –

+0

@AdityaBalwani尝试使用'ssh-keygen -t rsa' - 看看是否有帮助 –