github上传项目的时候报出[email protected]: Permission denied (publickey). fatal: Could not read from remote

出现问题原因:
经过翻译可以得知我是在上传过程中没有权限所以被拒绝了,经过了对git的一番了解以后得知我好像做少了其中一个比较重要的一步,就是设置一个SSH KEY,即是**,(出于安全考虑,Github 服务器和我们本地的通讯要求使用 SSH Key 来验证)。这个时候只需设置一个**就行了。

解决方法
从github主页点击设置进入SSH and GPG keys
github上传项目的时候报出[email protected]: Permission denied (publickey). fatal: Could not read from remote
随后点击创建一个新的**"New SSH key",
github上传项目的时候报出[email protected]: Permission denied (publickey). fatal: Could not read from remote
随即显示出一个输入key的框。
github上传项目的时候报出[email protected]: Permission denied (publickey). fatal: Could not read from remote
但是没有Key呀,要从哪里找呢?找到需要上传的项目文件夹的根目录,右键Git Base Here,如图所示。
github上传项目的时候报出[email protected]: Permission denied (publickey). fatal: Could not read from remote

输入命令:ssh-****** -t rsa -C “[email protected]
然后便一直猛击回车,有y/n的时候尽可能去翻译一下句子,而我下面这个y/n就是已经创有文件项目是否覆盖的意思。
接下来经过回车敲击后可以看到一个代码小图片,那就说明成功了。
接下来输入命令:cat ~/.ssh/id_rsa.pub
这个时候他便会弹出你的**。这个时候直接复制粘贴到刚刚那个GitHub设置**SSH的key上面然后保存即可。
github上传项目的时候报出[email protected]: Permission denied (publickey). fatal: Could not read from remote
Github上面的key创建完成后就可以执行git push --set-upstream origin master这条指令了。
github上传项目的时候报出[email protected]: Permission denied (publickey). fatal: Could not read from remote
#为什么要用git push#
git push -u origin master 上面命令将本地的master分支推送到origin主机,同时指定origin为默认主机,后面就可以不加任何参数使用git push了。

git push,默认只推送当前分支,这叫做simple方式。此外,还有一种matching方式,会推送所有有对应的远程分支的本地分支。Git 2.0版本之前,默认采用matching方法,现在改为默认采用simple方式。

大功告成!最后便可以把本地的项目上传到Github上面去了。
github上传项目的时候报出[email protected]: Permission denied (publickey). fatal: Could not read from remote