Git基本配置
git config --global user.name "你的名字"
git config --global.email "你的邮箱"
# 设置的邮箱和Gitee中的邮箱一致
# 查看配置的信息
git config --list
生成OpenSSH的公钥对(SSH)
在Windows PowerShell
中输入如下命令
ssh-keygen -t ed25519 -C "Gitee SSH Key"
# 连续按三次回车
Generating public/private ed25519 key pair.
Enter file in which to save the key (C:\Users\nancy/.ssh/id_ed25519):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in C:\Users\nancy/.ssh/id_ed25519.
Your public key has been saved in C:\Users\nancy/.ssh/id_ed25519.pub.
The key fingerprint is:
SHA256:oHTjxfjsW7CbRsSsNJO+P5P0bQgURfBFb4e36sRuDK0 Gitee SSH Key
The key's randomart image is:
+--[ED25519 256]--+
| .+o.o |
| o.. . . . |
| . =+o.. + o|
| . +=*= . o.|
| .o.*S . . |
| o.+o .... |
| +o+.o++ |
| . ==oE*o |
| o=o ..o |
+----[SHA256]-----+
2.到用户文件夹中查看生成的文件%UserName%\.ssh
cat ~/.ssh/id_ed25519.pub
3.添加到gitee中
用户可以通过主页右上角 「个人设置」->「安全设置」->「SSH 公钥」->「添加公钥」 ,添加生成的 public key 添加到当前账户中。
需要注意: 添加公钥需要验证用户密码
4.在power shell或者cmd或者vscode终端中进行测试
$ ssh -T git@gitee.com
PPK公钥和私钥对生成
(后续添加)
Windows下的PPK转为OpenSSH
参考(https://www.jianshu.com/p/7818b3ad1d72)
Windows下的OpenSSH转为PPK