Setting up SSH with BitBucket
Setting up your project using a remote repository over SSH can become a painful task for new and even the most seasoned developers. In this article we cover how to set up BitBucket SSH.
Repositories not found, incorrect permissions and issues when using your SSH key can all occur, and become very stressful. Below are some steps that should help you along your way. This starts right at the beginning, so some of these steps may now be relevant for you.
The first step is to download GIT, follow this link to do so. To check GIT has been installed successfully, open Terminal and type:
Download SourceTree (We recommend this)
SourceTree is a brilliant piece of software that helps to make using GIT much easier, and preventing you from diving into the terminal to do the simplest tasks.
Connect SourceTree with BitBucket SSH
Once you have SourceTree installed, the next step is to connect to your BitBucket account, and SourceTree provides BitBucket as an option you can simply select.
Follow the steps displayed on screen. You will also be asked to create a Pass Phrase, be sure use something you will remember, as you will need this later on.
Generating your SSH key
Open Terminal and type the following:
You will then be show where the key will be stored, so just hit enter here.
Next you will need to copy the generated key to your clipboard, and to do this write the following into Terminal:
cat ~/.ssh/id_rsa.pub | pbcopy
Now you have your SSH key, its time to paste it into BitBucket, so select your account, head to your profile, then settings. Under security will be a link labeled SSH Keys. Follow this link and hit the Add Key button. Give your key a name, and past your SSH key into the provided textarea.
Now that’s all set up, open terminal again and CD into the directory your wish your project to be downloaded in to.
Now clone your repository:
git clone //your-repo-url
You will be prompted to enter your Pass Phrase now, so do that.
That’s it! For mor tutorials, check out our Web Development category.