一、 查看是有已生成公钥
任意目录下打开Git Bash
cd ~/.ssh
若命令行提示bash: cd: ~./ssh: No such file or directory则说明还没有配置好 ssh 文件
二、生成ssh 公钥:
1、配置信息:用户名和邮箱
git config --global user.name = “xxx”
git config --global user.email = “xxx@xxxx.com”
2、生成公钥
cd ~
ssh-keygen -t rsa -C “xxxx@xxx.xxx”
Generating public/private rsa key pair.
Enter file in which to save the key (c/User/%USERNAME%/.ssh/id_rsa): //不用修改(默认存储地点)
Enter passphrase (empty for no passphrase): //可以为空
Enter same passphrase again:
查看公钥
cd ~/.ssh //进入. ssh 目录:
cat id_rsa.pub 或者 vim id_rsa.pub