当我在 git 中输入 ssh-keygen -t rsa -C "[email protected]" 时,它给出了 "Too many arguments" 错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7317863/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
When I enter ssh-keygen -t rsa -C "[email protected]" in git it gives "Too many arguments" error
提问by Jitendra Vyas
When I enter ssh-keygen -t rsa -C "[email protected]"
in git it gives a "Too many arguments" error. How do you solve this issue?
当我输入ssh-keygen -t rsa -C "[email protected]"
git 时,它给出了“参数太多”的错误。你如何解决这个问题?
Screenshot
截屏
回答by
I also encountered a "Too many arguments" error using this command, but the cause and solution were a little different. I copy and pasted the following command (from an Outlook 2010 email) into the command line:
我在使用此命令时也遇到了“参数过多”错误,但原因和解决方案略有不同。我将以下命令(来自 Outlook 2010 电子邮件)复制并粘贴到命令行中:
ssh-keygen –t rsa
and got the error. A coworker suggested just typing the command instead of copy and pasting it. I tried that and it worked, so I must have copy and pasted extra characters by accident (maybe some whitespace or null characters).
并得到错误。一位同事建议只输入命令而不是复制和粘贴它。我试过了,它奏效了,所以我必须不小心复制并粘贴了额外的字符(可能是一些空格或空字符)。
回答by eckes
It's a typo. You typed -c
but wanted (and used in your question) -C
这是一个错字。您输入-c
但想要(并在您的问题中使用)-C
To use -c
, the keys have to be already present. Excerpt of man ssh-keygen
:
要使用-c
,密钥必须已经存在。摘录man ssh-keygen
:
Requests changing the comment in the private and public key files. This operation is only supported for RSA1 keys. The program will prompt for the file containing the private keys, for the passphrase if the key has one, and for the new comment.
请求更改私钥和公钥文件中的注释。此操作仅支持 RSA1 密钥。程序将提示输入包含私钥的文件、密码(如果密钥有)以及新注释。
回答by wallismark
For me I was running it in Powershell, the issue was setting the passphrase, I had
对我来说,我在 Powershell 中运行它,问题是设置密码,我有
ssh-keygen.exe -t rsa -b 4096 -N ""
But needed
但需要
ssh-keygen.exe -t rsa -b 4096 -N '""'
note: the issue existed with or without -C
注意:该问题存在或不存在 -C
I found my fix on this question.
我找到了我对这个问题的解决方法。