git - 如何生成 ssh key (对于 github)

标签 git ssh github ssh-keys

问题:如何使用命令行生成 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/

相关文章:

git - 意外删除bin文件夹后恢复Gitlab

linux - Git 从部分存储库中提取?

java - 如何使用 Java 驱动程序连接到 EC2 上的 MongoDB

git - 在 Jenkins for Git 中管理 SSH key

shell - 批量导出多个mysql数据库

git - 无法访问 - Push Git

github - Mr.Doob 在 github 的 examples 文件夹中给出的 ColladaLoader.js 和 ColladaLoader2.js 有什么区别?

git - 有没有办法在GIT中锁定一个分支

android - github上传apk : something went really wrong

git - .gitignore 路径匹配语法中的前导星号 "**/"是否多余?