Repository access denied. access via a deployment key is read-only

First confusion on my side was about where exactly to set SSH Keys in BitBucket.

I am new to BitBucket and I was setting a Deployment Key which gives read-access only.

So make sure you are setting your rsa pub key in your BitBucket Account Settings.

Click your BitBucket avatar and select Bitbucket Settings(Manage account). There you'll be able to set SSH Keys.

I simply deleted the Deployment Key, I don't need any for now. And it worked

enter image description here


Now the SSH option is under the security settings

Click Your Avatar --> Bitbucket Settings --> SSH Key --> Add Key

Paste your public key


you need to add your key to your profile and NOT to a specific repository. follow this: https://community.atlassian.com/t5/Bitbucket-questions/How-do-I-add-an-SSH-key-as-opposed-to-a-deployment-keys/qaq-p/413373


Deployment keys are read only. To enable write access you need to:

  • Remove this deployment key from your repository settings. You won't be able to write to this repo with this key anyway.

  • Go to "Avatar -> Settings -> SSH Keys" and add the same key

  • Now try to push to remove branch

You were able to write to repositories before but this is a change in BitBucket where you're no longer able to write with deploy key.


'Deployment Key' is only for Read Only access. Following is a good way to work through this.

  • Create and SSH key and add it to bitbucket (User Avatar -> Bitbucket Setting-> SSH keys)
  • ~/.ssh/known_hosts
  • ssh-add -D (Remove keys loaded to SSH agent)
  • ssh-add ~/.ssh/your_private_key_for_bitbucket
  • ssh [email protected] -Tv (Verify that your key is getting used to connect to bitbucket)
  • git push 'remote name' 'branch name'