I've never cloned a private GitHub repository. So I followed GitHub's guide but it's still rejecting me. I have a Red Hat linux server on AWS. I did the following:
ssh-keygen -t rsa -b 4096 -C "< my github email address >"
. eval "$(ssh-agent -s)"
.ssh-add ~/.ssh/id_rsa
.cat ~/.ssh/id_rsa.pub
(to get the value of the key). Ran ssh -T git@github.com
and it outputted this:
Hi AskYous! You've successfully authenticated, but GitHub does not provide shell access.
Ran sudo git clone git@github.com:AskYous/google-code-challange.git
(a private repository I own). This is when I got the following error:
Cloning into 'google-code-challange'... Permission denied (publickey). 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. 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
-rw-r--r--. 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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.