如何找到自己的公钥

来源:互联网 发布:java程序员周末班 编辑:程序博客网 时间:2024/05/19 18:41

1、在终端输入命令行:

ssh-keygen -t rsa -C"xxxxx@xxxxx.com"

2、找到SSH公钥默认储存在账户的主目录下的~/.ssh目录

看有没有id_rsa和id_rsa.pub,  有.pub后缀的文件是公钥,另一个id_rsa文件则是秘钥。

3、把公钥文件拖到Xcode里面,就会查看到公钥了

注:

假如没有这些文件,甚至连 .ssh 目录都没有,可以用 ssh-keygen 来创建。该程序在 Linux/Mac 系统上由 SSH 包提供,而在 Windows 上则包含在 MSysGit 包里:

$ ssh-keygen -t rsa -C "your_email@youremail.com"Creates a new ssh key using the provided email # Generating public/private rsa key pair.Enter file in which to save the key (/home/you/.ssh/id_rsa):

直接按Enter就行。然后,会提示你输入密码,如下(建议输一个,安全一点,当然不输也行,应该不会有人闲的无聊冒充你去修改你的代码):

Enter same passphrase again: [Type passphrase again]

完了之后,大概是这样:

Your public key has been saved in /home/you/.ssh/id_rsa.pub.The key fingerprint is: # 01:0f:f4:3b:ca:85:d6:17:a1:7d:f0:68:9d:f0:a2:db your_email@youremail.com

到此为止,你本地的密钥对就生成了。

详情细节参见:

https://git-scm.com/book/zh/v1/%E6%9C%8D%E5%8A%A1%E5%99%A8%E4%B8%8A%E7%9A%84-Git-%E7%94%9F%E6%88%90-SSH-%E5%85%AC%E9%92%A5

http://www.cnblogs.com/superGG1990/p/6844952.html

原创粉丝点击