Git创建秘钥时提示:too many arguments解决

Git创建秘钥时提示:too many arguments解决

        • 创建创建秘钥时,出现如下错误
        • 分析:
        • 解决:
        • 验证代码:

创建创建秘钥时,出现如下错误

Too many arguments.
usage: ssh-keygen [-q] [-b bits] [-C comment] [-f output_keyfile] [-m format]
                  [-t dsa | ecdsa | ecdsa-sk | ed25519 | ed25519-sk | rsa]
                  [-N new_passphrase] [-O option] [-w provider]
       ssh-keygen -p [-f keyfile] [-m format] [-N new_passphrase]
                   [-P old_passphrase]
       ssh-keygen -i [-f input_keyfile] [-m key_format]
       ssh-keygen -e [-f input_keyfile] [-m key_format]
       ssh-keygen -y [-f input_keyfile]
       ssh-keygen -c [-C comment] [-f keyfile] [-P passphrase]
       ssh-keygen -l [-v] [-E fingerprint_hash] [-f input_keyfile]
       ssh-keygen -B [-f input_keyfile]
       ssh-keygen -D pkcs11
       ssh-keygen -F hostname [-lv] [-f known_hosts_file]
       ssh-keygen -H [-f known_hosts_file]
       ssh-keygen -K [-w provider]
       ssh-keygen -R hostname [-f known_hosts_file]
       ssh-keygen -r hostname [-g] [-f input_keyfile]
       ssh-keygen -M generate [-O option] output_file
       ssh-keygen -M screen [-f input_file] [-O option] output_file
       ssh-keygen -I certificate_identity -s ca_key [-hU] [-D pkcs11_provider]
                  [-n principals] [-O option] [-V validity_interval]
                  [-z serial_number] file ...
       ssh-keygen -L [-f input_keyfile]
       ssh-keygen -A [-f prefix_path]
       ssh-keygen -k -f krl_file [-u] [-s ca_public] [-z version_number]
                  file ...
       ssh-keygen -Q [-l] -f krl_file [file ...]
       ssh-keygen -Y find-principals -s signature_file -f allowed_signers_file
       ssh-keygen -Y check-novalidate -n namespace -s signature_file
       ssh-keygen -Y sign -f key_file -n namespace file ...
       ssh-keygen -Y verify -f allowed_signers_file -I signer_identity
                -n namespace -s signature_file [-r revocation_file]

分析:

查了资料还是创建时使用的命令(后面标注的红色下划线部门)输入有问题:$ ssh-keygen -t rsa-c “[email protected]

解决:

下面给出正确的命令(红色部分)格式:

 <font color = 'green'>  `ssh-keygen -t rsa -C` </font>"  [email protected]"

注: 注意命令中大小写和空格, myeail换为自己的邮箱

问题得以解决后代码如下:

Administrator@USER-20180802ED MINGW64 ~
$ ssh-keygen -t rsa -C "[email protected]"
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/Administrator/.ssh/id_rsa):

Git创建秘钥时提示:too many arguments解决_第1张图片
在三个黄色箭头位置时: 按回车; 第一个红色方框为创建SSH Key的命令, 第二个红色方框为密匙存储的位置

验证代码:

cd ~/.ssh

注:必须创建SSH Key后才能使用此命令
Git创建秘钥时提示:too many arguments解决_第2张图片

创建完成后,在用户主目录里找到.ssh目录,里面有id_rsa和id_rsa.pub两个文件,这两个就是SSH Key的秘钥对,id_rsa是私钥,不能泄露出去,id_rsa.pub是公钥,可以放心地告诉任何人

Git创建秘钥时提示:too many arguments解决_第3张图片

你可能感兴趣的:(github)