赞
踩
ssh-keygen -t rsa -C "your_email@example.com"
代码参数含义:
-t 指定密钥类型,默认是 rsa ,可以省略。
-C 设置注释文字,比如邮箱。
-f 指定密钥文件存储文件名。
回车确认,会要求你输入保存密钥的位置以及使用密钥的口令,保持默认(回车)即可
Generating public/private rsa key pair.
Enter file in which to save the key (C:\Users\focus\.ssh\id_rsa):
Created directory 'C:\Users\focus\.ssh.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in C:\Users\focus\.ssh\id_rsa.
Your public key has been saved in C:\Users\focus\.ssh\id_rsa.pub.
The key fingerprint is:
d0:82:24:8e:d7:f1:bb:9b:33:53:96:93:49:da:9b:e3 your_email@example.com
如果有多个账户的话,可再次执行该操作,不过生成时候的文件名有所不同
ssh-keygen -t rsa -C "your_email2@example.com"
Generating public/private rsa key pair.
Enter file in which to save the key (C:\Users\focus\.ssh\id_rsa):C:\Users\focus\.ssh\id_github_rsa
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in C:\Users\focus\.ssh\id_github_rsa.
Your public key has been saved in C:\Users\focus\.ssh\id_github_rsa.pub.
The key fingerprint is:
d0:82:24:8e:d7:f1:bb:9b:33:53:96:93:49:da:9b:e3 your_email2@example.com
可同时看到两个文件
ssh-add ~/.ssh/id_rsa
ssh-add ~/.ssh/id_github_rsa
ssh-add -l
#gitlab Host github.app.cn HostName github.app.cn PreferredAuthentications publickey IdentityFile ~/.ssh/id_rsa_hd Port 10080 #github Host github.com HostName github.com PreferredAuthentications publickey IdentityFile ~/.ssh/id_rsa_github # 配置文件参数 # Host : Host可以看作是一个你要识别的模式,对识别的模式,进行配置对应的的主机名和ssh文件 # HostName : 要登录主机的主机名 # User : 登录名 # IdentityFile : 指明上面User对应的identityFile路径
Hi username! You've successfully authenticated, but GitHub does not
provide shell access.
恭喜你,配置完成,尽情使用吧!
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。