In this video, we'll create an account on BitBucket. Then, we'll configure that account to utilize our SSH key to authenticate our local machine with the remote repository.

Creating an Account on BitBucket

Before we can use BitBucket, we need to create an account.

  • Go to the "Sign up" page
  • Fill in your information
  • Select the plan that fits your needs
  • Type the text in the Captcha
  • Click "Sign up"

(At this point, you'll receive an email to verify your email address. Go ahead and click the link in that email to complete your account setup.)

When you confirm your account, you'll be given some options to learn about Bitbucket, Git and SourceTree. Below that, you'll see options to "Create a repository" or "Import an existing repository". We'll walk through both options in just a minute, but before we can use BitBucket from our local machine, we need to setup our SSH key.

If you haven't already created your SSH key, you should do that now. If you've been following this series from the beginning, we did that in an earlier video so you're already set.

Adding Your SSH Key to Your BitBucket Account

Copy your ssh key by typing "less ~/.ssh/" on your local machine, then copying everything from "ssh-rsa" to the end of your email address. When you have it copied, press "q" to quit the less application.

Now that you have it copied, you need to add it to your BitBucket account.

  • In the top right corner of the BitBucket page, click the "user" icon and select "Manage account"
  • Select "SSH keys" from the sidebar.
  • Click "Add key"
  • Label: Brian's MacBook Air (The label is used to differentiate your computers because you can upload SSH keys from multiple computers. ie: Work Computer, Personal Laptop, Live Server etc.)
  • Key: (Paste your key here.)
  • Click "Add key"

Now, you'll see the label of your new Key in the list. You will need to add a new key for each computer that needs to access your repositories. That would include live servers and any dev or staging servers.

Collaborators will have their own BitBucket accounts and add their SSH keys to those accounts. Then, they can join one of your projects on BitBucket and by doing so, all of the computers they have SSH keys for will have access to that project's repository.

Testing Your New SSH Key

Now that you have your SSH key uploaded, it's a good idea to test it to make sure that it's working before you proceed.

The process to do so is actually quite simple.

  • Open a terminal window
  • Type "ssh -T"
  • Press Enter

Now you might see a warning like the following:

The authenticity of host ' (' can't be established.
RSA key fingerprint is 97:8c:1b:f2:6f:14:6b:5c:3b:ec:aa:46:46:74:7c:40.
Are you sure you want to continue connecting (yes/no)?

This is expected.

  • Type "yes"
  • Press Enter

Now you'll see a message like the following:

logged in as ModulesUnraveled.

You can use git or hg to connect to Bitbucket. Shell access is disabled.

If the username is yours, you've successfully setup your SSH key! (Don't worry about the "shell access" statement. You won't need that.)

If you receive an "access denied" message, read the Troubleshoot SSH Issues help page.