SSH:
1.通过命令 ssh-keygen
生成 SSH Key:
ssh-keygen -t ed25519 -C "Gitee SSH Key"
- 中间通过三次回车键确定
- 输出如下:
2.查看生成的 SSH 公钥和私钥:
ls ~/.ssh/
输出:
id_ed25519 id_ed25519.pub
私钥文件 id_ed25519
公钥文件 id_ed25519.pub
3.读取公钥文件 :
~/.ssh/id_ed25519.pub
输出:如
ssh-ed25519 AAAA***5B Gitee SSH Key
复制终端输出的公钥。
4.添加部署公钥
5.测试
$ ssh -T git@gitee.com
输出:
Hi Anonymous! You've successfully authenticated, but GITEE.COM does not provide shell access.
添加成功后,就可以使用 SSH 协议对仓库进行拉取。