Mac码云创建公钥

这种事情总是容易忘记步骤,尤其是再入职新公司以后。因为这种操作不是经常会做的

打开终端跟着输入

ssh-keygen -t rsa -C “你的邮箱"

出现

Generating public/private rsa key pair.
Enter file in which to save the key (/Users/你的Mac用户名/.ssh/id_rsa):

直接回车,出现

Created directory '/Users/你的Mac用户名/.ssh'.
Enter passphrase (empty for no passphrase):

输入密码,一般不用输入,直接回车,出现

Your identification has been saved in /Users/你的Mac用户名/.ssh/id_rsa.
Your public key has been saved in /Users/你的Mac用户名/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:+4xdhIVKajdjbF0ZbAKqMxL+Mp372xa86PhVyVqFQVpY “你的邮箱
ssh-keygen -t rsa -C “你的邮箱
The key's randomart image is:
+---[RSA 2048]----+
| ..=+=+. |
|. +.+Fo . |
| o.o.* o |
|+oo++ = . |
|o.==.o os. |
| +o . .. |
| ooo.. .. |
|.= .. + |
|
o=.. .. o |
+----[SHA256]-----+

生成成功了,查看一下

cat ~/.ssh/id_rsa.pub

出现

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCoibHh9t2Vzdfgtjn+GKK4pjpCsuU/qT+G7L2utYvkyHpXwX17WSnmY5GEHiRCM64mGaEklE44K0SQhyVckvhrPA2/bdhgT7RKSkP1aL+rK3nAM2X73argQVR+KKLWtbbk/x7pjDhRq+jr0LIXlzsF38Nt4E1XikgL+/ubU8fGuiJEJacM9Rw9EXjhUw2lchSQ9MmqJRdhXD+e9iKoNmIJyUg1kSt60KTFd5G60kAOjHrQ6zidNmkIhmvamy9eBL4JvBszmjhdDTE3pRgAkgUn5+I41KwDG0AX2DCmAjJMplDJqmmGmleGI6Xd6qI+b6AnPAKwqOTOg29xm2T0XpZp "你的邮箱"

把公钥拷贝到码云后台,一般让你输入码云账号的密码。
添加成功以后在控制台输入

ssh -T [email protected]

出现

The authenticity of host 'git.oschina.net (103.21.119.119)' can't be established.
ECDSA key fingerprint is SHA256:FMNC9Kn/eye1W8i89BgrQp+KkGyhjgbVr17bmjey0Wc.
Are you sure you want to continue connecting (yes/no)?

输入yes

image.png

表示已经成功了

你可能感兴趣的:(Mac码云创建公钥)