Clone private repositories in Bitbucket using SSH.

Author
By Darío Rivera
Posted On in 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.

Acerca de Darío Rivera

Author

Application Architect at Elentra Corp . Quality developer and passionate learner with 10+ years of experience in web technologies. Creator of EasyHttp , an standard way to consume HTTP Clients.

LinkedIn Twitter Instagram

Sólo aquellos que han alcanzado el éxito saben que siempre estuvo a un paso del momento en que pensaron renunciar.