Git push提交时报错Permission denied(publickey)...Please make sure you have the correct access rights and the repository exists.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
可能:
可能没联网
可能没配置好.git/conf文件
可能是与github上的账号没建立密钥对
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
以下可参考这篇博客
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?