Mac 下source tree 与 gogs 添加 ssh 密钥 免密提交

懒得废话,直接上重点
配置方法:
1 在普通用户 进入 .ssh 文件.(.ssh 文件生成百度很多) cd .ssh/ 或 cd ~/.ssh
LELEdeMacBook-Pro:~ lele$ cd .ssh/
LELEdeMacBook-Pro:.ssh lele$ ls
known_hosts
LELEdeMacBook-Pro:.ssh lele$ man ssh-add
LELEdeMacBook-Pro:.ssh lele$
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 // 给生成生成私钥命名 输入 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 [email protected]
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$
LELEdeMacBook-Pro:.ssh lele$
LELEdeMacBook-Pro:.ssh lele$
LELEdeMacBook-Pro:.ssh lele$ ls // 查看生成文件
id_rsa id_rsa1id_rsa1.pubknown_hosts
LELEdeMacBook-Pro:.ssh lele$ cat id_rsa1.pub // 打开公钥 复制公钥粘贴到 gogs


ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDIRPiN+aEeJ4ZAYshiKdDSv9tHovvmKCIai8uUc8RqxYo5BPJwN5NLH5FVKgIO12uj4PZl4q/QpXh9oaPVKJLZWTGh7aZc2lBmqS8CDLnFAniFnhYb5CABg+gQyFv71857UeV4QaO6sPas6jYFyeMgguEylzFUVz2dxsjonoGnPxA14YxG0k1bvkuQT1MEuwcyN17vOZYPOyh5xBfTJMYrqp3V875ju508SUgE+oFYXoJF/bMoUXPH+9D7YSTTqbocv55Su7z95/LMhp5RNX4MwMxJF9LdcLwTWvXuPucB6RbsRLqf9hy53/boLyphgc0UKpHNgPZTnCYRKJ8+hwrL [email protected]
LELEdeMacBook-Pro:.ssh lele$
LELEdeMacBook-Pro:.ssh lele$
LELEdeMacBook-Pro:.ssh lele$
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:
Identity added: id_rsa1 (id_rsa1)
LELEdeMacBook-Pro:.ssh lele$

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

你可能感兴趣的:(Mac 下source tree 与 gogs 添加 ssh 密钥 免密提交)