Ubuntu LAMP Git clone Permission denied (publickey)

November 18, 2015 4.7k views
LAMP Stack DigitalOcean Git

I have set up a LAMP application on my droplet

I have used my set DO ssh key which is the same used for my mac and my bitbucket account.

I install git and create a folder at the /var/www level.

CD into the folder and run my git clone command but get the following error

Warning: Permanently added the RSA host key for IP address ‘’ to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Any ideas how to fix this?
*ssh keys not my strong point

1 Answer


Have you checked the documentation over on GitHub (see the link below)?


This is actually a pretty common error and the above link should help you resolve the issue :-).

  • I had a look a that before (with BitBucket) but didn’t see to work.

    I ended up creating an ssh on the droplet itself and then linking it to BitBucket.
    That works fine for some reason.

Have another answer? Share your knowledge.