问题:如何使用命令行生成 ssh 私钥和公钥(用于 GitHub/GitLab)。
下面的命令会产生错误
sh.exe": syntax error near unexpected token '('
我使用的是 Windows XP。
$ ssh-keygen -t rsa -C "xxxx@gmail.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/xxxx/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/xxxx/.ssh/id_rsa.
Your public key has been saved in /c/Users/xxxx/.ssh/id_rsa.pub.
The key fingerprint is:
01:0f:f4:3b:ca:85:d6:17:a1:7d:f0:68:9d:f0:a2:db xxxx@gmail.com
最佳答案
运行的命令只有
ssh-keygen -t rsa -C "you@example.com"
脚本第 2 行开始的所有其余部分是 ssh-keygen 的输出。
并将 you@example.com 替换为您的电子邮件地址。
看看 manual for ssh-keygen
寻找其他选项。您可能应该通过将 -b 4096
添加到选项列表来使用更长的 key 。
关于git - 如何生成 ssh key (对于 github),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3828823/