- git config --global user.name “yourname”
- git config --global user.email“xxxxxxxxx.com"
- 除.ssh文件夹(直接搜索该文件夹)下的known_hosts(手动删除即可,不需要git)
- $ ssh-keygen -t rsa -C "[email protected]"(请填你设置的邮箱地址)
- 出现:
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/your_user_directory/.ssh/id_rsa):
- 连续回车
- 然后系统会自动在.ssh文件夹下生成两个文件,id_rsa和id_rsa.pub,打开id_rsa.pub,全部的内容复制
- 打开https://github.com/,添加ssh
- ssh -T [email protected]
- yes
- 关闭窗口,重新操作