原创

使用ssh RSA加密方式授权git

温馨提示:
本文最后更新于 2021年05月07日,已超过 1,056 天没有更新。若文章内的图片失效(无法正常加载),请留言反馈或直接联系我

生成本地ssh key

ssh-keygen -t rsa -C "账户名"

一路回车下去:

[root@VM-0-6-centos ~]# ssh-keygen -t rsa -C "tioncico"
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:tUjAVTyqastk8IrdbWfJxGoYAKy94Tjr0BIOsFaH7cw tioncico
The key's randomart image is:
+---[RSA 2048]----+
|.    ....o.      |
|..  o ..  o      |
|oo o o  ....     |
|o.= =  ..o .     |
|++.+ A oS .      |
|*ooo. . o        |
|o+. ++ + .       |
|o+ *+.+ =        |
|o.o.++.o         |
+----[SHA256]-----+

启动ssh-agent 秘钥管理工具

eval \`ssh-agent\` 或者 ssh-agent bash

添加秘钥到 ssh-agent

ssh-add ~/.ssh/id_rsa #之前生成秘钥的路径

查看秘钥

仙士可博客

git 配置公钥

未配置gitclone 情况

仙士可博客

在git服务器后台,新增公钥

仙士可博客

仙士可博客

新增成功后,clone成功

仙士可博客

正文到此结束
本文目录