I am using Amazon EC2 instance as dev server and I am trying to git clone my repository from bitbucket to amazon EC2 instance. What i like to do is to add post hook commit to bitbucket, so all changes committed to the repository automatically to reflect to my dev server.
I am connecting trough ssh to my Amazon EC2 instance, but when i try to git clone the repository i am getting following error:
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
I found many solutions about this problem but none of them seems to work!
Here is what i have tried so far:
-created elastic ip and associate with my instance
-modified the security group to allow inbound network traffic
-download the generated pem key from amazon and generate private and public key using puttygen
-uploaded the public key (id_rsa.pub) and pem key to my .ssh folder and changed the permissions to 600
-added the public key to bitbucket deployment keys
-added the public key to the authorized_keys file on amazon
-created a config file inside .ssh folder and added following lines inside:
Host bitbucket.org
Hostname bitbucket.org
User ubuntu
IdentityFile ~/.ssh/amzon_key.pem
-tried to git clone the repository as root user
I'm using putty on windows.
Solution by OP.
What I did to make it work:
-deleted the config file from .ssh folder
-created new private and public keys using puttygen (dsa - 1024)
-added the public key to the bitbucket deployment keys
-added the public key to the amazon authorized_keys file in the .ssh folder
-uploaded the keys to the .ssh folder and set permissions to 600
-added bitbucket.org to the list of known_hosts file in the .ssh folder
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