概述
错误信息为:
Permission denied(publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
可能:
可能没联网
可能没配置好.git/conf文件
可能是与github上的账号没建立密钥对
配置文件: 进入你的仓库,下面有个.git目录里面有conf配置文件,直接vim .git/conf
修改成如下:如果不是git提交是https方式,url和pushurl自己改成自己仓库的地址就好
11
12 [remote "origin"]
13
url = git@github.com:s--enten--/--an.git
14
fetch = +refs/heads/*:refs/remotes/origin/*
15
pushurl = git@github.com:s--enten--/--an.git.git
16 [branch "master"]
17
remote = origin
18
merge = refs/heads/master
建立密钥:
ssh-keygen -t rsa -C "youremail@example.com"
注意,上述youremail@example.com是指github账户的注册邮箱
ssh -v git@github.com
上述命令执行后,出现的提示最后两句是
No more authentication methods to try.
Permission denied (publickey).
ssh-agent -s
上述命令执行后,出现的提示最后两句是
SSH_AUTH_SOCK=/tmp/ssh-GTpABX1a05qH/agent.404; export SSH_AUTH_SOCK;
SSH_AGENT_PID=13144; export SSH_AGENT_PID;
echo Agent pid 13144;
ssh-add ~/.ssh/id_rsa
上述命令执行后,出现提示
Identity added: . . . (这里是一些ssh key 文件路径)
Could not open a connection to your authentication agent.
若第4步中出现上述提示,则执行此步骤,否则执行6
eval 'ssh-agent -s'
ssh-add ~/.ssh/id_rsa
vim ~/.ssh/id_rsa.pub
上述命令执行后id_rsa.pub文件内容将输出到终端,复制里面的密钥(内容一般是以ssh-rsa 开头,以github账号的注册邮箱结尾的,全部复制下来)
进入github账号,在settings下,选SSH and GPG keys, 点击new SSH key
以下可参考这篇博客
转载于:https://www.cnblogs.com/shiqi17/p/9446338.html
最后
以上就是野性火车为你收集整理的Git push提交时报错Permission denied(publickey)...Please make sure you have the correct access rights and ...的全部内容,希望文章能够帮你解决Git push提交时报错Permission denied(publickey)...Please make sure you have the correct access rights and ...所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复