I am not able to clone my repository to my remote EC2 ubuntu instance using my deployment key. Here are the steps I followed.
~/.ssh/know_hosts following https://stackoverflow.com/a/26520681/808734Here is the output of ssh -T [email protected]
You can use git or hg to connect to Bitbucket. Shell access is disabled.
This deploy key has read access to the following repositories:
username/repository: KEYNAME -- [email protected]
But when I try to clone the repository
sudo git clone [email protected]:username/repository.git I get the following error
Cloning into 'repository'...
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Am I missing something here? Anybody has any advice?
Thanks for reading.
Well this is embarrassing, the problem here was I was running the command as sudo user.
sudo git clone [email protected]:username/repository.git
This probably was attempting to clone repository as root user and causing the error. However cloning as the current user, and providing write permissions to the required directory let me clone the repository successfully.
Also during the process my ssh key seemed to have gotten reset,
so ensure that ssh -T [email protected] works as expected. If not, running
# start the ssh-agent in the background
eval "$(ssh-agent -s)"
# Agent pid 59566
ssh-add ~/.ssh/id_rsa
worked for me. more details
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