如何解决git创建密匙时报错Too many arguments

如题:git创建密匙时报错Too many arguments。

前几天我遇见了一个问题,git需要重新创建密匙,运行命令ssh-keygen -t rsa -b 4096 -C " your_email@ample.com "时报错。

 Too many arguments.
usage: ssh-keygen [-q] [-b bits] [-t dsa | ecdsa | ed25519 | rsa | rsa1]
[-N new_passphrase] [-C comment] [-f output_keyfile]
ssh-keygen -p [-P old_passphrase] [-N new_passphrase] [-f keyfile]
ssh-keygen -i [-m key_format] [-f input_keyfile]
ssh-keygen -e [-m key_format] [-f input_keyfile]
ssh-keygen -y [-f input_keyfile]
ssh-keygen -c [-P passphrase] [-C comment] [-f keyfile]
ssh-keygen -l [-v] [-E fingerprint_hash] [-f input_keyfile]
ssh-keygen -B [-f input_keyfile]
ssh-keygen -D pkcs11
ssh-keygen -F hostname [-f known_hosts_file] [-l]
ssh-keygen -H [-f known_hosts_file]
ssh-keygen -R hostname [-f known_hosts_file]
ssh-keygen -r hostname [-f input_keyfile] [-g]
ssh-keygen -G output_file [-v] [-b bits] [-M memory] [-S start_point]
ssh-keygen -T output_file -f input_file [-v] [-a rounds] [-J num_lines]
[-j start_line] [-K checkpt] [-W generator]
ssh-keygen -s ca_key -I certificate_identity [-h] [-n principals]
[-O option] [-V validity_interval] [-z serial_number] file ...
ssh-keygen -L [-f input_keyfile]
ssh-keygen -A
ssh-keygen -k -f krl_file [-u] [-s ca_public] [-z version_number]
file ...
ssh-keygen -Q -f krl_file file ...

当然我第一时间就去网上查了,网上有人有说加引号包装,我也是醉了,虽然是解决了问题但根本没有说到点上。

 
如何解决git创建密匙时报错Too many arguments
 

问题的解决方式和原因应该是这样的。

首先你会看到官方提示要你替换成你的电子邮件地址,但是如果你只是粘贴覆的话,你就错了

 
如何解决git创建密匙时报错Too many arguments
 

Github给的粘贴文本中有空格,如果你不小心很容易被坑到,解决方案就是:

1.你眼尖点动动手把里面的空格删除
2.在你的邮箱地址外加一层引号,目的是隔绝空格影响~

上一篇:Tinker热修复


下一篇:Idea开发Java WEB 应用入门教程