1、全局设置username和email
git config --global user.name "name"
git config --global user.email "email"
2、本地生成新的ssh
命令行输入: ssh-keygen -t rsa -C “你的github或gitee绑定的邮箱”
如果本地已经含有ssh文件,则会提示already exists 你可以选择是否覆盖
我这里选择的覆盖,输入y,接下来直接回车 回车,即可生成ssh。
3、将本地ssh配置到github 或 gitee ,添加公钥即可
此时本地就可以实现 git clone 、等操作了
4、为什么需要重新配置ssh?
因为本地设置的username或者邮箱发生变化,
又或者开发者更换了电脑设备等,都会引发git 报ssh错误,重新生成ssh,重新配置github公钥,就可以解决问题了。