sshkey访问github
1.生成git的对称密钥对
ssh-keygen -t rsa -C "xxx@gamil.com"
~/.ssh 下生成的文件为:
github
github.pub
2.配置密钥
将github.pub公钥配置到github
https://github.com/settings/keys
3.配置本地私钥路径
>> cd ~/.ssh
新建config文件
```
Host github.com
HostName github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/github
如果配置了gitee,则添加:
Host gitee.com
HostName gitee.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/gitee
```
4:检查配置是否成功
ssh -T git@github.com
可能要输入生成密钥对时设置的密码
Enter passphrase for key '~/.ssh/github':