WHY?: repository access denied. access via a deployment key is read-only.


I am trying to commit my new application to the repository for the first time.   Thought I followed the directions to a tee however I am getting the error in the subject line no matter what I try.

What is the trick to getting the first commit though?   Did I not set up my key properly?   It seems to tell me that keys are for read only access only but how does one commit with only read access?


1 answer

Deployment keys are to deploy. You need to install an ssh key, or push via HTTP.

I was looking for a place I could do that but was finding it not too obvious.   "Access Keys" was the only setting I could find.

that link is broken

Like 1 person likes this

oops.  it was broken when i clicked on it for some reason but a copy and paste found it

Hmm weird, trying again https://confluence.atlassian.com/bitbucket/set-up-ssh-for-git-728138079.html If it doesn't work, try copy pasting it in

that got it!   i just didn't see the other place to add keys before.  it's going now.   thanks!

Here is what I was struggling with and the answer I discovered.

I was trying to run pipeline in one repo 'A', and then in the last step have it git clone repo 'B' which has another pipeline, make a change to a file in repo 'B', commit that change and push up to repo 'B', and then trigger the pipeline in repo 'B' to run a custom step.

I had the code in place to trigger the run of pipeline in 'B' using a call to curl. That call looks like this:

 curl -X POST -is -u <username-goes-here>:<app-password-goes-here> \
-H 'Content-Type: application/json' \
https://api.bitbucket.org/2.0/repositories/<repo-project-name-goes-here>/<repo-b-name-goes-here>/pipelines/ \
-d '
"target": {
"ref_type": "branch",
"type": "pipeline_ref_target",
"ref_name": "master",
"selector": {

The app-password is a key point here. You need to get this from a settings page under your profile.


The point that I struggled with is getting the git commit and git push to work.

The answer: I found that I had to add a ssh key under my profile:

Then importantly... when I did the git clone I had to use https instead of ssh. So the clone looks like this:

git clone https://<username-goes-here>:<app-password-here>@bitbucket.org/<repo-project-name-goes-here>/<repo-b-name-goes-here>.git

Add that did the trick. Wee... Hopes this helps other.

Ps. The reason I do this git clone, commit and push is to pass arg values to the triggered pipeline. Which BTW seems to be the only way I could find to be able to run a pipeline with args. 

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Mar 14, 2019 in Bitbucket Pipelines

Building a Bitbucket Pipe as a casual coder

...ipe.sh :  #!/bin/bash source "$(dirname "$0")/common.sh" enable_debug extra_args="" if [[ "${DEBUG}" == "true" ]]; then extra_args="--verbose" fi # mandatory variables R...

267 views 0 12
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you