Permission denied (publickey).报错

267 阅读1分钟

刚代码在push到其他托管工具时候遇到以下报错 (clone也是一样)

Permission denied (publickey).
fatal: Could not read from remote repository.

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

其实已经给出答案没有key也就是秘钥被拒绝

  1. 首先打开终端, 以下命令

cd ~/.ssh

ls

  • 你会看到id_rsa.pub,运行以下命令

vim id_rsa.pub

2 .如果出现以下内容, 复制下来

  1. 然后找到你用的托管中的SSH公钥, 粘贴到下面, 就好了