Skip to content
All writing

Fix Bitbucket SSH: Permission Denied & ssh.bitbucket.org Migration

Fix git@bitbucket.org: Permission denied (publickey) and connection refused errors during Bitbucket's mandatory migration to ssh.bitbucket.org.

#snippetsgitbitbucketdevops

Bitbucket Cloud is splitting traffic: bitbucket.org now strictly serves HTTPS web and API traffic, while all Git SSH operations (clone, pull, push) must target ssh.bitbucket.org.

During scheduled brownouts (starting November 12, 2026) and after the December 10, 2026 cutoff, connections to the old host fail:

git@bitbucket.org: Permission denied (publickey).
fatal: Could not read from remote repository.

Or ssh: connect to host bitbucket.org port 22: Connection refused.

Here is how to fix it across macOS, Linux, WSL, and Windows without rewriting every repository.

Add this block to your ~/.ssh/config (or C:\Users\<you>\.ssh\config on Windows). It forces legacy bitbucket.org Git SSH calls to route to ssh.bitbucket.org automatically:

Host bitbucket.org ssh.bitbucket.org
    HostName ssh.bitbucket.org
    User git
    IdentityFile ~/.ssh/your_bitbucket_key

Fix 2: Global Git URL rewrite

If you do not use ~/.ssh/config, tell Git to rewrite the hostname globally:

git config --global url."git@ssh.bitbucket.org:".insteadOf "git@bitbucket.org:"

Fix 3: Update a single remote

git remote set-url origin git@ssh.bitbucket.org:workspace/repo.git

Verify

ssh -Tv git@ssh.bitbucket.org

Get new posts by email

New writing in your inbox. Unsubscribe anytime.