Git 推送权限被拒绝(公钥)但已成功通过身份验证 [英] Git push permission denied (publickey) but successfully authenticated
问题描述
我想用 ssh 将我的提交推送到 github.我明白了
<块引用>您已成功通过身份验证
运行 ssh -T git@github.com
命令后的消息,但是当我想推送我的提交时,我收到此错误:
权限被拒绝(公钥).致命:无法从远程读取存储库.
请确保您拥有正确的访问权限和存储库存在.
我运行 ssh-add -l
命令然后我得到
我运行 我阅读了这篇文章.它与我的问题非常相似,但 我也运行 权限被拒绝(公钥). 我还阅读了权限被拒绝(公钥).致命:远程端意外挂断了 git pull,但我的公钥在 .ssh 文件夹中,这不是我的情况 我阅读了此页面:错误:权限被拒绝(公钥) 并检查所有.我错过了什么吗? 我该怎么办? MacOS:Sierra git 版本 2.13.5 (Apple Git-94) 作为 此链接 描述,我将 给它. 首先检查 需要明确的是,您需要先在 GitHub 上创建远程存储库:推送到不存在的存储库会产生该错误. 通常,ssh url 不起作用意味着该 URL 没有按照 ssh 期望的方式编写. 我使用 您没有使用 sudi 运行 I want to push my commits to github with ssh. I get You've successfully authenticated message after run Permission denied (publickey).
fatal: Could not read from remote
repository. Please make sure you have the correct access rights and the repository
exists. I run I run I read this post. Its very similar to my issue but I also run Permission denied (publickey). I also read Permission denied (publickey). fatal: The remote end hung up unexpectedly for git pull but my public key is in .ssh folder and thats not my case I read this page: Error: Permission denied (publickey) and check all. Did I miss something? What should I do? MacOS: Sierra git version 2.13.5 (Apple Git-94) As this link describe,I add to it. Check first what Just to be clear, you need to create the remote repo first on GitHub: pushing to a non-existing repo would generate that error. Typically, an ssh url not working means said URL is not written the way ssh expects it. I run commands with You did not run your 这篇关于Git 推送权限被拒绝(公钥)但已成功通过身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!4096 SHA256:SREQ0/2G0mT+UxUmpLWmkMramBcFxnl+onFyXgwFENk ~/.ssh/work2_rsa (RSA) 4096 SHA256:gKPZ1Hxzc6eZ/NsgnoPaXVaJs/NsgnoPaXVaJs/NsgnoPaXVaYsTydm.sgwFENk~/.ssh/work2_rsa
git remote -v
然后我得到 p>origin git@github.com:H-Ghadirian/UdacitySillySong.git (fetch)origin git@github.com:H-Ghadirian/UdacitySillySong.git(推送)傻宋 git@github.com:H-Ghadirian/UdacitySillySong.git (获取)SillySong git@github.com:H-Ghadirian/UdacitySillySong.git(推送)
sudo
没有解决我的问题.git push -u origin master
并得到同样的错误:config
文件添加到我的.ssh
文件夹并添加主机 *AddKeysToAgent 是使用钥匙串 是身份文件 ~/.ssh/work2_rsa
git remote -v
返回的内容:git@github.com:<you>/<yourRepo.git>
(而不是 https 一个就像你昨天的问题)
由于 ~/.ssh/config
中的 ssh config
文件,ssh 可能需要不同的 URL.sudo
运行命令并多次检查 repo.ssh git@github.com
,这意味着您的推送命令也不需要 sudo
.
ssh -T git@github.com
command but when I want to push my commits I get this error:
ssh-add -l
command and I get4096 SHA256:SREQ0/2G0mT+UxUmpLWmkMramBcFxnl+onFyXgwFENk ~/.ssh/work2_rsa (RSA) 4096 SHA256:gKPZ1Hxzc6eZ/NsgnoPaJsGbdWgQV54bYAXaTym3PfY ~/.ssh/work3_rsa (RSA)
git remote -v
and I get origin git@github.com:H-Ghadirian/UdacitySillySong.git (fetch)
origin git@github.com:H-Ghadirian/UdacitySillySong.git (push)
sillySong git@github.com:H-Ghadirian/UdacitySillySong.git (fetch)
sillySong git@github.com:H-Ghadirian/UdacitySillySong.git (push)
sudo
didn't solve my problem.git push -u origin master
and get the same error :
config
file to my .ssh
folder and add Host *
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/work2_rsa
git remote -v
does return:
git@github.com:<you>/<yourRepo.git>
(And not an https one like in your question yesterday)
And ssh might expect a different URL because of an ssh config
file in ~/.ssh/config
.
sudo
and check repo multiple times.ssh git@github.com
with sudi, which means you also don't need sudo
for your push commands.