目录
- 生成SSH公钥
- 通过 ssh-keygen 程序创建
- 找到SSH公钥
- 在gitee中添加公钥
生成SSH公钥
通过 ssh-keygen 程序创建
shell> ssh-keygen -t rsa -C "xxx@xxx.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): <回车,使用默认值>
Enter passphrase (empty for no passphrase): <回车,使用默认值>
Enter same passphrase again: <回车,使用默认值>
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:rIvG714PNMRALOP+HWKY2hiVdA9SxvsKiG1KCeaPLem xxx@xxx.com
The key's randomart image is:
+---[RSA 3072]----+
| oooo |
|+.+++ |
|=*.=o+ |
|.=*.o .. |
|o+* oo .S |
|o* * ooo |
|o++.+ + . |
|+ ..o+ o |
|.E ..+= |
+----[SHA256]-----+
找到SSH公钥
shell> cd ~/.ssh
shell> ls
authorized_keys id_rsa id_rsa.pub known_hosts
id_rsa.pub
是公钥id_rsa
是私钥
在gitee中添加公钥
详细参考:https://gitee.com/help/articles/4191#article-header0
用户可以通过主页右上角 「个人设置」->「安全设置」->「SSH公钥」->「添加公钥」 ,添加生成的 public key 添加到当前账户中。
需要注意: 添加公钥需要验证gitee的用户密码