ssh-keygen -t rsa -C "email" Generating public/private rsa key pair. Enter file in which to save the key (~/.ssh/id_rsa):<不要直接回车,填写自己定义的名字> Enter passphrase(empty for on passphrase):<不要直接回车,填写自己定义的密码>2. 上传公钥到仓库网站
读取*.pub的内容,粘贴到服务网站上。记住对应的用户名。
3. .ssh/config 配置要点在于Host与HostName的区别:- HostName:是填写真实的服务地址。
- Host:是填写别名,后面会用上。
- IdentityFile:填写的是证书的所在位置,你也可以把证书保存在任何地方。
# github Host github.com HostName github.com PreferredAuthentications publickey IdentityFile ~/.ssh/id_rsa_github # oschina Host gitee.com HostName gitee.com PreferredAuthentications publickey IdentityFile ~/.ssh/id_rsa_gitee



