git bash 密钥登录
检查现有密钥否
windows路径:C:\Users${用户名}.ssh
LInux路径:~/.ssh 或者 /home/${用户名}/.ssh
一般*.pub就是公钥了
没有.pub文件就是没有了
生成密钥
git自带ssh生成命令
ssh-keygen -t rsa -C xxx@xxx.com
添加密钥
- 登录github
- setting
- SSH and GPG keys
- New SSH Key
- Key一栏里面填上*.pub的内容
测试密钥
ssh -T git@github.com
这是我Centos系统成功是输出
ssh -T git@github.com The authenticity of host 'github.com (20.205.243.166)' can't be established. RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'github.com,20.205.243.166' (RSA) to the list of known hosts. Enter passphrase for key '/root/.ssh/id_rsa': Hi ShiverZm! You've successfully authenticated, but GitHub does not provide shell access.
Windows反而没成功
$ ssh -T git@github.com Warning: Permanently added the RSA host key for IP address '13.250.177.223' to the list of known hosts. \302\226git@github.com: Permission denied (publickey).
使用密钥登录
TortoriseGit 密钥登录
https://www.cnblogs.com/zy20160429/p/7493693.html