1. 设置Git的user name和email:
$ git config --global user.name "xuhaiyan"
$ git config --global user.email "haiyan.xu.vip@gmail.com"
2. 查看是否已经有了ssh密钥:cd ~/.ssh
3. 生成密钥
$ ssh-keygen -t rsa -C “haiyan.xu.vip@gmail.com”
按3个回车,密码为空。
Your identification has been saved in /home/tekkub/.ssh/id_rsa.
Your public key has been saved in /home/tekkub/.ssh/id_rsa.pub.
The key fingerprint is:
………………
最后得到了两个文件:id_rsa和id_rsa.pub
4.
$ eval ssh-agent
(是~键上的那个`)
5. 添加密钥到ssh
ssh-add 文件名
网友评论