DEV Community 👩‍💻👨‍💻

Cover image for Adding SSH login to bitbucket
Visakh Vijayan
Visakh Vijayan

Posted on

Adding SSH login to bitbucket

Recently I noticed an easier way to login to bitbucket via SSH. Here is how to go about it. I use a Linux environment so the post is in accordance with that.

Open a terminal and type -

Enter fullscreen mode Exit fullscreen mode

This will create a private and public rsa key on your system. Just keep pressing enter to whatever question it throws you and in the end you will be able to see two files id_rsa and The .pub means it's your public SSH key. This can be distributed. The other one you guard it with your life.

Now open bitbucket and go to Settings -> Security -> SSH Keys. Click on Add Key and give a title - (I usually give my machine's name) and paste your contents into the key textbox and Save.

Use this to open the public key file

cat ~/.ssh/
Enter fullscreen mode Exit fullscreen mode

Go to your repository source tab on bitbucket and click on Clone and select the SSH option. Copy the part that starts with ...

Once done go to your code and open .git/config. You will be able to find a property -

[remote "origin"]
    url=<substiture the copied url here>
Enter fullscreen mode Exit fullscreen mode

You should be done. Try git pull, push or any other fancy commands you feel like and enjoy.

Happy coding!

Top comments (0)

Let's team up together 🤝

We're Hiring

We're hiring for a Senior Full Stack Engineer to join the DEV team. Want the deets? Head here to learn more about who we're looking for.