Gitee远程推送报错解决方案: Permission denied (publickey) Please make sure you……

348 阅读1分钟

在提交Gitee仓库中,进行远程推送,执行 git push -u origin "master" 命令后报错,错误如下:

D:\veb\program\project\quyigou-vue2> git push -u origin "master"
git@gitee.com: Permission denied (publickey).

Please make sure you have the correct access rights
and the repository exists

最后判定是在本地(或服务器上)没有生成SSH公钥,解决方案如下:

image.png

第一步:终端执行如下代码,重新生成ssh。

ssh-keygen -t rsa -C  "这里是你自己注册Gitee的邮箱@xxx.com"

执行后出现

Generating public/private rsa key pair.
Enter file in which to save the key (C:\Users\韩韩/.ssh/id_rsa): ^V

第二步:终端执行如下代码,查看你的public key。

cat ~/.ssh/id_rsa.pub

第三步:将你的public key 复制到码云如下位置

image.png

第四步:终端出入下述代码就完成啦。

ssh -T git@gitee.com