查看本机ssh 公钥
windows端

如果没有公钥的话,需要生成
$ ssh-keygen -t rsa -C "邮箱地址"
Mac端
cd ~/.ssh/
没有的话,需要生成
ssh-keygen -t rsa -C "邮箱地址"
cat id_rsa.pub
github 添加 deploy key
如果是新建的仓库的话,需要生成新的key,
然后把 id_rsa.pub 生成的key粘贴进去,就可以用了
如果工作和github都需要的话,当然先保证工作,github提交代码时会出现
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
这个错误,具体解决办法就是新建一个 github_id_rsa, 然后执行这个命令
$ ssh-add ~/.ssh/id_rsa
记得添加 user.name 和 user.email
git config --global user.name "bbb324"
git config --global user.email "johnigzie@gmail.com"
浙公网安备 33010602011771号