使用ssh RSA加密方式授权git
【摘要】 生成本地ssh keyssh-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): ...
生成本地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成功
【版权声明】本文为华为云社区用户原创内容,转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息, 否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
评论(0)