10000 GitHub - UdaiNegi/ssh-Docs
[go: up one dir, main page]

Skip to content

UdaiNegi/ssh-Docs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 

Repository files navigation

πŸ” SSH Key Setup Guide for Bitbucket

This guide walks you through configuring an SSH key for Bitbucket so you can authenticate securely without entering your username and password each time.


🧰 Prerequisites

  • Git installed (git --version)
  • Bitbucket account
  • Terminal access (macOS/Linux/Windows with Git Bash)

βš™οΈ Step-by-Step Instructions

βœ… Step 1: Check if SSH Agent is Running

The SSH agent is a background process that manages your private keys for SSH authentication.

ps -ax | grep ssh-agent
  • If you see a line with /usr/bin/ssh-agent, it’s already running.
  • If not, proceed to the next step to start it.

βœ… Step 2: Start the SSH Agent

Start the agent if it’s not already running:

  • macOS / Linux:

    eval "$(ssh-agent -s)"
  • Windows (Git Bash):

    eval $(ssh-agent -s)

You should see something like:

Agent pid 59566

βœ… Step 3: Generate a New SSH Key

Create a new SSH key pair specifically for Bitbucket:

ssh-keygen -t rsa -b 4096 -C "your.email@example.com" -f ~/.ssh/bitbucket_work
  • This creates a 4096-bit RSA key.
  • Press Enter when prompted to accept the default path.
  • Optionally enter a passphrase for added security.

πŸ“ This generates two files:

  • ~/.ssh/bitbucket_work β†’ Private key
  • ~/.ssh/bitbucket_work.pub β†’ Public key

βœ… Step 4: Add the SSH Key to the SSH Agent

We now add the private key to the agent so it can be used automatically.

cat ~/.ssh/bitbucket_work | pbcopy

🧠 This command loads your key into clipboard

If you get:

Could not open a connection to your authentication agent

Go back to Step 2 and ensure the agent is running.


βœ… Step 5: Add the Public Key to Bitbucket

  1. Copy your public key:
    cat ~/.ssh/bitbucket_work.pub
  2. Log in to Bitbucket
  3. Go to Personal Settings β†’ SSH Keys
  4. Click Add Key
  5. Paste the key and give it a label (e.g., Work MacBook)
  6. Save

βœ… Step 6: Test Your SSH Connection

Run the following to check if everything works:

ssh -T git@bitbucket.org

🟒 If it’s working, you’ll see:

logged in as your-username

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

πŸ”΄ If you see an error like:

  • Permission denied (publickey)
  • Host key verification failed

Check:

  • Your public key is added to Bitbucket
  • The private key is loaded (ssh-add -l)
  • You’re using the correct remote URL format

βœ… You're Done!

You can now clone repositories over SSH:

git clone git@bitbucket.org:your-team/your-repo.git

Happy coding!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0