首先查看本地的.git/config设置的仓库url地址和github使用的链接地址是否一致,如use https,则url需要用https的仓库地址

      cat .git/config查看配置中的URL是否和仓库地址相同

1、检查电脑中是否有id_rsa和id_rsa.pub文件(一般在 /c/Users/用户名/.ssh 或者 ~/.ssh目录下),有则备份删除

2、以下步骤为重新生成**和公钥

      ①:ssh-****** -t rsa -C '[email protected]'
           之后一路回车

          成功运行后,会输出:关于git Permission denied (publickey). fatal: Could not read from remote repository. 的处理
      ②:ssh-add 上一步中输出的私钥文件路径
            如果执行结果,显示为:Could not open a connection to your authentication agent.

            则执行ssh-agent bash命令,然后重新执行ssh-add

      ③:把第①步中生成的id_rsa.pub文件内容,复制到git中,如下所示:

             关于git Permission denied (publickey). fatal: Could not read from remote repository. 的处理

相关文章: