[英]Git: Permission denied (publickey). fatal: Could not read from remote repository
I've never cloned a private GitHub repository.我从未克隆过私有 GitHub 存储库。 So I followed GitHub's guide but it's still rejecting me.所以我遵循了 GitHub 的指南,但它仍然拒绝我。 I have a Red Hat linux server on AWS.我在 AWS 上有一个 Red Hat linux 服务器。 I did the following:我做了以下事情:
ssh-keygen -t rsa -b 4096 -C "< my github email address >"
. Ran ssh-keygen -t rsa -b 4096 -C "< my github email address >"
。eval "$(ssh-agent -s)"
.运行eval "$(ssh-agent -s)"
。ssh-add ~/.ssh/id_rsa
.跑ssh-add ~/.ssh/id_rsa
。cat ~/.ssh/id_rsa.pub
(to get the value of the key). Ran cat ~/.ssh/id_rsa.pub
(获取密钥的值)。 Ran ssh -T git@github.com
and it outputted this: Ran ssh -T git@github.com
它输出了这个:
Hi AskYous!问好! You've successfully authenticated, but GitHub does not provide shell access.您已成功通过身份验证,但 GitHub 不提供 shell 访问。
Ran sudo git clone git@github.com:AskYous/google-code-challange.git
(a private repository I own). Ran sudo git clone git@github.com:AskYous/google-code-challange.git
(我拥有的私人存储库)。 This is when I got the following error:这是我收到以下错误时:
Cloning into 'google-code-challange'... Permission denied (publickey).克隆到 'google-code-challange'... 权限被拒绝(公钥)。 fatal: Could not read from remote repository.致命:无法从远程存储库读取。
Please make sure you have the correct access rights and the repository exists.请确保您拥有正确的访问权限并且存储库存在。
The problem was, and I don't know how this happened, is that the private key changed so this new key was not stored on GitHub.问题是,我不知道这是怎么发生的,是私钥发生了变化,所以这个新密钥没有存储在 GitHub 上。 It changed somehow.它以某种方式改变了。 Perhaps I ran the generation process twice.也许我运行了两次生成过程。
Just want to help anyone who's experiencing this issue as I spent a while trying to resolve.只是想帮助遇到此问题的任何人,因为我花了一段时间试图解决。 Make sure the key pairs ownership owned by buildkite-agent确保 buildkite-agent 拥有的密钥对所有权
-rw-r--r--. -rw-r--r--。 1 buildkite-agent buildkite-agent 749 Jul 27 13:34 id_rsa.pub -rw-------. 1 buildkite-agent buildkite-agent 749 Jul 27 13:34 id_rsa.pub -rw-------。 1 buildkite-agent buildkite-agent 3243 Jul 27 13:34 id_rsa 1 buildkite-agent buildkite-agent 3243 Jul 27 13:34 id_rsa
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.