SSH Config for Bitbucket
Set up SSH configuration for Atlassian Bitbucket. Covers the Host entry, key setup, and the difference between Bitbucket Cloud and Bitbucket Server.
Detailed Explanation
SSH Config for Bitbucket
Bitbucket supports SSH for Git operations on both its Cloud and Data Center (Server) editions. A proper SSH config entry avoids repeated credential prompts and ensures the correct key is used.
Bitbucket Cloud Config
Host bitbucket.org
HostName bitbucket.org
User git
IdentityFile ~/.ssh/id_ed25519_bitbucket
IdentitiesOnly yes
AddKeysToAgent yes
Bitbucket Data Center / Server
Host bitbucket-server
HostName bitbucket.mycompany.com
User git
Port 7999
IdentityFile ~/.ssh/id_ed25519_work
IdentitiesOnly yes
Bitbucket-Specific Notes
Bitbucket Data Center typically uses port 7999 for SSH, which is different from the standard port 22. This is a common source of confusion when setting up SSH access for the first time.
Verifying the Connection
After setting up your config, test the connection:
ssh -T bitbucket.org
# Should output: "logged in as yourusername"
Key Algorithms
Bitbucket Cloud supports ed25519 and RSA keys. Bitbucket Data Center support varies by version, but recent versions support ed25519. Check your server's documentation if you encounter issues.
Multiple Bitbucket Accounts
If you have both a personal and work Bitbucket account, create separate Host aliases (e.g., bitbucket-personal and bitbucket-work) with different IdentityFile paths, similar to the multiple GitHub accounts pattern.
Use Case
Developers working with Atlassian Bitbucket for source control, particularly teams migrating from HTTPS to SSH authentication or setting up Bitbucket Data Center access.