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

ID : 10260

viewed : 24

Tags : gitsshbitbucketssh-keysgit

Top 5 Answer for git - Repository access denied. access via a deployment key is read-only

vote vote

95

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

vote vote

88

Now the SSH option is under the security settings

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

Paste your public key

vote vote

73

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

vote vote

69

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.

vote vote

56

'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 git@bitbucket.org -Tv (Verify that your key is getting used to connect to bitbucket)
  • git push 'remote name' 'branch name'

Top 3 video Explaining git - Repository access denied. access via a deployment key is read-only

Related QUESTION?