idea中git使用ssh的url后push报错
开发环境:Mac11.0、idea2019.2、 git 2.24.3 (Apple Git-128)
1.报错代码
Please make sure you have the correct access rights
and the repository exists.
sunyun@sunyundeMBP ch009-springboot-ems % git remote add origin git@gitee.com:fejxc/spring-boot-page-help.git
fatal: remote origin already exists.
sunyun@sunyundeMBP ch009-springboot-ems % git push -u origin master
git@gitee.com: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
sunyun@sunyundeMBP ch009-springboot-ems % git status
On branch master
nothing to commit, working tree clean
2.解决办法,在git上或者gitee上添加SSH公钥
1)输入代码生成ssh公匙
ssh-keygen -t rsa -C "输入你的github或者gitee的用户名"
2)ssh公匙会在你的计算机用户名文件下
3)用文本编辑打开id_rsa.pub,复制里面的内容
4)在github或者gitee上点自己头像设置,然后找到安全设置里的ssh公匙,添加刚刚生成的肤质的内容