I'm trying to clone a private Github repo to a new Amazon EC2 (Ubuntu) instance.
The EC2 Instance fails to git clone <PATH>
due to
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Here's my steps:
ssh-keygen
on local machine~/.ssh/id_rsa.pub
) into GitHub 'SSH Keys' sectionyum
and yum install git
etcgit clone <PATH>
but get permission error. Works fine on local machine...I'm not fully understanding how EC2 is using my Key Pair... why doesn't GitHub recognize the EC2 instance?
"Also import that public key into the EC2 'Key Pairs' dashboard"
That only allows you to use that key pair for SSH into EC2 instances. And only instances that you create after you add that key pair to AWS. That key pair management dashboard has nothing to do with the git
command you are running on the EC2 server.
You need to copy your local ~/.ssh/id_rsa
private key file to that same location on the EC2 server.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With