配置 Gerrit ssh 克隆代码时,要加入 ssh keys。
1.产生 ssh kyes.
$ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/xiaozhi/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/xiaozhi/.ssh/id_rsa
Your public key has been saved in /home/xiaozhi/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:CqF8MWeoxitNk+jBA6Y7S5K4cWDlYHBQYQ52fd4Yxr4 xiaozhi@ac
The key's randomart image is:
+---[RSA 3072]----+
|++=o. . |
|o=. o = |
|.+..= B + |
|*+++ * + . |
|+=X.o S |
|+Bo+ . E |
|Oo+ . |
|oB |
|o |
+----[SHA256]-----+
ssh-keygen -t rsa
-t选项指定生成的密钥类型,默认为RSA算法。
生成密钥对后,系统会在指定位置(默认目录 ~/.ssh )生成两个文件:id_rsa(私钥)和id_rsa.pub(公钥)。
2.查看 ssh kyes.
#cd ~/.ssh
#ls
id_rsa id_rsa.pub known_hosts
3.提取公钥
公钥(id_rsa.pub)可以分享给其他人或服务器,用于身份认证。
4.把公钥文件中的数据手动复制到Gerrit setting 相应位置.
使用ssh密钥进行身份认证更加安全和方便,无需输入密码即可猎取Gerrit远程服务器上的代码。
2687

被折叠的 条评论
为什么被折叠?



