软件相关工具类

Mac sourcetree 配置 ssh 密钥

2020-06-30  本文已影响0人  Yobhel

1 在普通用户 进入 .ssh 文件.(.ssh 文件生成百度很多)

cd .ssh/    或 cd ~/.ssh
LELEdeMacBook-Pro:~ lele$ cd .ssh/
LELEdeMacBook-Pro:.ssh lele$ ls
known_hosts
LELEdeMacBook-Pro:.ssh lele$ ssh-keygen -t rsa -C "your email" // 你的邮箱
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/lele/.ssh/id_rsa): id_rsa1// 给生成生成私钥命名
Enter passphrase (empty for no passphrase): // 设置输入密码
Enter same passphrase again: 
Your identification has been saved in id_rsa1. // 私钥
Your public key has been saved in id_rsa1.pub. // 公钥
The key fingerprint is:
SHA256:IL6L2NjBQDAAuYfD6NzTbR8VIc/fJl1coDUhzL3LYP8 leyu@chargedot.com
The key's randomart image is:
+---[RSA 2048]----+
|B.       . +o.=o.|
|o.        +.o+.o.|
|o+  . .    oo  .o|
|*... . .   .+ + .|
|+o. o . S .. * = |
| = o o o .    *  |
|  o o . . .    . |
| = o .   .      E|
|o + .            |     
+----[SHA256]-----+

LELEdeMacBook-Pro:.ssh lele$ ls// 查看生成文件
id_rsa id_rsa1id_rsa1.pubknown_hosts

LELEdeMacBook-Pro:.ssh lele$ cat id_rsa1.pub // 打开公钥  复制公钥粘贴到 gitlab上设置 sshKey 的地方
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDIRPiN+aEeJ4ZAYshiKdDSv9tHovvmKCIai8uUc8RqxYo5BPJwN5NLH5FVKgIO12uj4PZl4q/QpXh9oaPVKJLZWTGh7aZc2lBmqS8CDLnFAniFnhYb5CABg+gQyFv71857UeV4QaO6sPas6jYFyeMgguEylzFUVz2dxsjonoGnPxA14YxG0k1bvkuQT1MEuwcyN17vOZYPOyh5xBfTJMYrqp3V875ju508SUgE+oFYXoJF/bMoUXPH+9D7YSTTqbocv55Su7z95/LMhp5RNX4MwMxJF9LdcLwTWvXuPucB6RbsRLqf9hy53/boLyphgc0UKpHNgPZTnCYRKJ8+hwrL leyu@chargedot.com

再执行以下操作

LELEdeMacBook-Pro:.ssh lele$ ls
id_rsa id_rsa1id_rsa1.pubknown_hosts

LELEdeMacBook-Pro:.ssh lele$ ssh-add id_rsa1// 添加私钥
Enter passphrase for id_rsa1:// 输入密码  此密码为生成密钥的时候设置的密码 123456 方便好记 哈哈
Identity added: id_rsa1 (id_rsa1)

至此 sshKey 配置完成,打开 source tree 克隆代码就 OK 了

上一篇 下一篇

猜你喜欢

热点阅读