Issue
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:
- Ran
ssh-keygen -t rsa -b 4096 -C "< my github email address >"
. - Ran
eval "$(ssh-agent -s)"
. - Ran
ssh-add ~/.ssh/id_rsa
. - Ran
cat ~/.ssh/id_rsa.pub
(to get the value of the key). - Added output of step 4 into here: https://github.com/settings/keys.
Ran
ssh -T [email protected]
and it outputted this:Hi AskYous! You've successfully authenticated, but GitHub does not provide shell access.
Ran
sudo git clone [email protected]: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.
- I checked GitHub and it acknowledges that the key has been used:
Solution
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.
Answered By - AskYous