Home > database >  AWS EC2 git clone permission denied
AWS EC2 git clone permission denied

Time:09-17

I have an Ubuntu instance in AWS EC2. In .ssh folder in the authorized_keys file I see that I have the key_name which was generated in AWS. I took this public key and added it on gitlab & github accounts under SSH preferences. When I try to clone my repo with ssh I still get permission denied.

git clone [email protected]:[username]/[project].git

What else am I missing?

CodePudding user response:

GitHub now has a new form of account authentication, and when performing Git Clone of private projects, you will need to pass the SSH key previously registered in your account's PASSWORD, instead of your own password.

In the link below you can understand better and also learn how to register your SSH key for authentication: https://docs.github.com/en/[email protected]/github/authenticating-to-github/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account

CodePudding user response:

I will try to explain better what my problem was and how I fixed it. I created a Linux instance in AWS EC2 and also generated my private key_name with which I could ssh into the instance. Inside the instance, in the .ssh folder, there is a file name authorized_keys which holds the public key. I thought I could take this key and add it to my gitlab/github accounts, but this didn't work. (perhaps I still lack some basic understanding of ssh...) What worked was generating a new key pair inside the EC2 Linux instance and place that public key in gitlab/github. Thanks.

  • Related