Clone private repositories in Bitbucket using SSH.

When managing private repositories in Bitbucket, there is a need to clone those repositories onto your machine, server, or other client in order to have updated code and be able to set up your application or develop new features. The safest option to do this is through an SSH key that ensures a protected connection between the client machine and the Bitbucket host. Today we will see how to make this possible.
Generate your RSA key
The first step is to check if you already have an RSA key to download your repo via SSH. If not, you can follow our tutorial on What is an RSA key, how to create it, and how to use it.
Add your RSA key to Bitbucket
You should enter Bitbucket with your account and go to Personal Settings.

Once there, you must click on the SSH Keys option, and finally click on Add Key.

Clone your repository
After you have set up your key, you can download your repository without any problems.
git clone git@bitbucket.org:project/repo-name.git
If everything is fine and your RSA key has a password, it will be requested immediately.
Cloning into 'repo-name'...
Enter passphrase for key '/Users/my-user/.ssh/id_rsa':
Receiving objects: 100% (89056/89056), 101.15 MiB | 7.29 MiB/s, done.
Resolving deltas: 100% (69138/69138), done.