Bitbucket Permission Denied (publickey)

Share
Ongoing Mac, Windows, Linux Updated November 13, 2026Based on 4 user reportsHow we research

Quick answer

Bitbucket rejected every SSH key your client offered. Find which key is offered with ssh -vvv, then add that public key to your account or point git at the right key.

Most likely fix: See which keys SSH offers

How to fix it

Try these in order — the most common fix is first.

  1. 1. See which keys SSH offers

    1. Run: ssh -vvv -T git@bitbucket.org
    2. Look for 'Offering public key' and 'Trying private key' lines
    3. A -1 next to an identity file means it is missing or not a key
    4. 'Authentication succeeded (publickey)' means it works; 'Shell access is disabled' afterwards is normal
    Did this fix it?
  2. 2. Add your public key to Bitbucket

    1. Print the key: cat ~/.ssh/id_ed25519.pub
    2. Open Personal settings > SSH keys > Add key
    3. Paste the whole line and save
    4. Retry ssh -T git@bitbucket.org
    Did this fix it?
  3. 3. Force the right key for Bitbucket

    1. Add a Host bitbucket.org block to ~/.ssh/config with IdentityFile ~/.ssh/<your_key> and IdentitiesOnly yes
    2. Start the agent and load it: eval $(ssh-agent) then ssh-add ~/.ssh/<your_key>
    Did this fix it?
  4. 4. Fix 'key already registered'

    1. A key can be linked to only one account; remove it from the other account or generate a new key pair for this one
    Did this fix it?

Symptoms

git clone, pull or push over SSH ends with 'Permission denied (publickey)' and 'Could not read from remote repository'.

Why it happens

  • The public key is not added to your Bitbucket account
  • SSH offers a different key than the one you registered
  • The key is registered on another account (a key can belong to only one)
  • The key file is malformed or the wrong file was added
  • No SSH agent running, so the key is never loaded

This guide also covers

  • bitbucket permission denied publickey
  • bitbucket could not read from remote repository
  • bitbucket ssh key not working

Still not working?

If Bitbucket keeps failing, you're not alone. See every Bitbucket problem users report or the alternatives people switch to.

Have an app idea? Our small team builds any software: web and mobile apps, games, desktop, AI tools. Price agreed together.

Talk to us
Fixed it? Share this guide

Other Bitbucket errors