gitHub报错之git@github.com: Permission denied (publickey). fatal: Could not read from remote repository
前言当我们在新的电脑环境,本地上传到自己的github储存仓库就会出现时密钥不匹配,被拒绝上传。第一句 git@github.com: Permission denied (publickey).git@github.com:权限被拒绝(公钥)。从第一句我们可以定位出问题原因所在。github中的SSH问题第二句报错: fatal: Could not read from re...
前言
当我们在新的电脑环境,本地上传到自己的github储存仓库就会出现时密钥不匹配,被拒绝上传。
第一句 git@github.com: Permission denied (publickey). git@github.com:权限被拒绝(公钥)。
从第一句我们可以定位出问题原因所在。github中的SSH问题
第二句报错: fatal: Could not read from remote repository. 致命:无法从远程存储库读取。
解决办法
第一步setting —>SSH and GPG keys
第二
第三
在文件中打开git Bash
输入命令ssh-keygen -t rsa -C
再次输入 cat ~/.ssh/id_rsa.pub
复制粘贴到第二部 New SSH key
填入key中即可
添加成功
再git push -u origin master
最后Github上面的key创建完成后就可以执行git push --set-upstream origin master这条指令了
就没问题了
PS:如果本机host文件中访问gitHub中使用外网ip访问,那么必须得删掉才能正常上传不然会出现
ssh_dispatch_run_fatal: Connection to xxxxxxx port 22: Software caused connection abort问题
快去搞起自己的私人小仓库吧~
更多推荐
所有评论(0)