代码拉取完成,页面将自动刷新
ssh-keygen
是否有安装,Mac系统自带,然后查看其帮助命令。ssh help:usage: ssh-keygen [-q] [-b bits] [-t dsa | ecdsa | ed25519 | rsa]
[-N new_passphrase] [-C comment] [-f output_keyfile]
ssh-keygen -p [-P old_passphrase] [-N new_passphrase] [-f keyfile]
ssh-keygen -i [-m key_format] [-f input_keyfile]
ssh-keygen -e [-m key_format] [-f input_keyfile]
ssh-keygen -y [-f input_keyfile]
ssh-keygen -c [-P passphrase] [-C comment] [-f keyfile]
ssh-keygen -l [-v] [-E fingerprint_hash] [-f input_keyfile]
ssh-keygen -B [-f input_keyfile]
ssh-keygen -D pkcs11
ssh-keygen -F hostname [-f known_hosts_file] [-l]
ssh-keygen -H [-f known_hosts_file]
ssh-keygen -R hostname [-f known_hosts_file]
ssh-keygen -r hostname [-f input_keyfile] [-g]
ssh-keygen -G output_file [-v] [-b bits] [-M memory] [-S start_point]
ssh-keygen -T output_file -f input_file [-v] [-a rounds] [-J num_lines]
[-j start_line] [-K checkpt] [-W generator]
ssh-keygen -s ca_key -I certificate_identity [-h] [-U]
[-D pkcs11_provider] [-n principals] [-O option]
[-V validity_interval] [-z serial_number] file ...
ssh-keygen -L [-f input_keyfile]
ssh-keygen -A
ssh-keygen -k -f krl_file [-u] [-s ca_public] [-z version_number]
file ...
ssh-keygen -Q -f krl_file file ...
-t
指定ssh的密钥类型,一般选rsa(非对称加密)-C
对密钥加上自己的备注-f
指定known_hosts_file
.ssh-keygen -t rsa -f ~/.ssh/id_rsa.github -C "zhangkui305@163.com"
ssh-keygen -t rsa -f ~/.ssh/id_rsa.gitlab -C "zhangkui305@163.com"
public key
和private key
的生成目录fingerprint
指纹签名-b
参数指定,为1024的倍数。Generating public/private rsa key pair.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /Users/longxiang/.ssh/id_rsa.github.
Your public key has been saved in /Users/longxiang/.ssh/id_rsa.github.pub.
The key fingerprint is:
SHA256:ocviE32+0q4aDMpT7BV+Lbog02K0Xm7WVBjj2IkhBrE zhangkui305@163.com
The key's randomart image is:
+---[RSA 2048]----+
|+. |
| + . o |
|E . *.= . |
| .o.=.o.. |
| ..o +ooS. |
|o.=ooo+.o |
|.O =*oo+ |
|o B+o+o o |
| .o.o+.+o. |
+----[SHA256]-----+
./ssh/
目录可以看到我们刚才创建的2个密钥:├── id_rsa.github
├── id_rsa.github.pub
├── id_rsa.gitlab
├── id_rsa.gitlab.pub
#github
Host github
Hostname github.com
user user@github.com
IdentityFile ~/.ssh/id_rsa.github
#gitlab
Host gitlab
Hostname gitlab.com
user user@gitlab.com
IdentityFile ~/.ssh/id_rsa.gitlab
#gitee
Host gitee
Hostname gitee.com
user user@gitee.com
IdentityFile ~/.ssh/id_rsa.gitee
ssh-add ~/.ssh/id_rsa.github
git账号仓库的sshkeys中
,激活ssh密钥ssh -T git@gitee.com
The authenticity of host 'gitee.com (212.64.62.174)' can't be established.
ECDSA key fingerprint is SHA256:FQGC9Kn/eye1W8icdBgrQp+KkGYoFgbVr17bmjey0Wc.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'gitee.com,212.64.62.174' (ECDSA) to the list of known hosts.
Hi 逐风! You've successfully authenticated, but GITEE.COM does not provide shell access.
.ssh
目录下面也会生成一个known_hosts
它记录远程domain的链接信息。git clone git@gitee.com:jiodg45/mutli_ssh_test.git
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。