DEV Community

Cover image for How to set up SSH keys for Bitbucket and Atlassian Repositories
Ayush Kumar
Ayush Kumar

Posted on

2 1

How to set up SSH keys for Bitbucket and Atlassian Repositories

To securely interact with Atlassian tools and repositories, you need to generate and add SSH keys to your account.

Step 1: Ensure Git is Installed
Before proceeding, make sure Git is installed on your system. You can verify this by running:

git --version
Enter fullscreen mode Exit fullscreen mode

If Git is not installed, you can install it using the following commands based on your operating system

For Ubuntu/Debian:

sudo apt update
sudo apt install git
Enter fullscreen mode Exit fullscreen mode

For macOS (using Homebrew):

brew install git
Enter fullscreen mode Exit fullscreen mode

For Windows:

  1. Download the Git installer from git-scm.com.
  2. Run the installer and follow the setup instructions, using the default options unless you have specific preferences.
  3. After installation, open Git Bash from the start menu and verify the installation by running:
git --version
Enter fullscreen mode Exit fullscreen mode

Step 2: Configure your username and email (If not set)

Ensure your system has your Git username and email configured. Run the following commands in your terminal:

git config --global user.name "Your Name"
git config --global user.email "your_email@example.com"
Enter fullscreen mode Exit fullscreen mode

Replace your name and your_email@example.com with your actual name and email address.

Step 3: Generate an SSH key
Open a terminal and run the following command to generate a new SSH key pair:

ssh-keygen -t rsa
Enter fullscreen mode Exit fullscreen mode

Press enter to accept the default file location, and set a passphrase if desired.

Step 4: View the SSH public key
Once the key is generated, display the public key by running:

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

This will output your public key, which typically starts with ssh-rsa and ends with your email address.

Step 5: Add the SSH key to your Atlassian account

  1. Copy the entire contents of the displayed public key.
  2. Log in to your Atlassian account.
  3. Navigate to the SSH Keys section in your account settings.
  4. Click on the add SSH key and paste the copied key into the provided field.
  5. Save the key.

To open settings and add your SSH key, click here. 👉

Heroku

Simplify your DevOps and maximize your time.

Since 2007, Heroku has been the go-to platform for developers as it monitors uptime, performance, and infrastructure concerns, allowing you to focus on writing code.

Learn More

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs