Deploy Key | Clone Error

I want to clone a repository on a testing server, which belongs to a private group. I am a member of that private group and have permissions of Master.
I created a pair of ssh key on the server and add the public key in the Deploy Keys of the repository. Now, when I try to clone the repo on the server it gives me error like:

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?

I was my mistake after all.
The directory in which I was trying to clone the repo didn’t have the right permissions.
If someone else, also faced this problem try owing the directory using

chown -R username directory_name