For some time I developed a project with a partner on local machines using Homested, it’s time to put the project on a real server. The repository is on bitbucket. I put it on the git server, generated the public key, added the key to the "Deployment keys" section on bitbucket. When executing the git clone command, my repository writes.

Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. 

Tell me what the error is.

  • and server linuksovy? do you clone ssh url or https? - Umed
  • @Umed yes Ubuntu there 16 by ssh try - Shadow33
  • and url on which you clone ssh or https? - Umed
  • @Umed ssh git clone git@bitbucket.org:<repo> - Shadow33
  • you must first authenticate and create an entry about what key will be used for bitbucket, you need to run such a command ssh -Tv git@bitbucket.org - Umed

1 answer 1

You need to check if your private key has been added to ssh-agent:

 ssh-add -l 

If it is not, you need to add it with the following command:

 ssh-add <путь_к_приватному_ключу> 

If it turns out that ssh-agent is not running, then you need to start it:

 ssh-agent /bin/bash 

Next, we verify with bitbucket:

 ssh -Tv git@bitbucket.org 

and you can clone your repository :)