Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

SSH access with deploy keys

Iam try to pull/clone git project from bitbucket with user www-data. The Deployment keys was created and added to Access keys of bitbucket. The server response that I have read access but when I try pull or clone - access denied.

 

www-data@server:~$ git clone git@bitbucket.org:project/repo.git
Cloning into 'repo'...
repository access denied. deployment key is not associated with the requested repository.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
www-data@server:~$ ssh -T  git@bitbucket.org
authenticated via a deploy key.


You can use git or hg to connect to Bitbucket. Shell access is disabled.

This deploy key has read access to the following repositories:

project/repo: wwwdata2 -- www-data@server

 

3 answers

Mistake. I thought this would leave a comment rather than an answer.

I have the same issue... I followed the ssh guidance page here:  https://confluence.atlassian.com/bitbucket/set-up-an-ssh-key-728138079.html

 

and I get this back from Git Bash when I try and git push :

...

authenticated via a deploy key.

You can use git or hg to connect to Bitbucket. Shell access is disabled.

This deploy key has read access to the following repositories:

...

 

So I have read access, am able to git pull... but not able to git push or merge.  What use is a "deploy" key if I can't push?  So I am a little confused as to what is going on.

I wasn't given the opportunity to indicate that the SSH Key I wanted to create should be permissioned as Read/Write.  And I don't see anything anywhere in the settings, or user or Team management setting,., When I look at the management and user settings for the project we're dealing with, it shows me that my user has WRITE access... but I don't seem to have write access...

very confusing 

Just solved this... after several hours yday and today... 

Bitbucket seems to default to using HTTPS for git push/pull interaction. 

There is facility to enable parties to CLONE a repository.  This means you only need READ_ONLY access if all this does is enable pulling ... this is what the Access Keys section is under General Settings is for.  Bitbucket has done a poor job of clarifying that this Access Keys section is not relevant to git pull or merge.

But many of us who have done it as part of projects and never as the Admin, think we should be adding keys for this, so we see Access Keys and Team Management in the Repository Settings....  So... we set up the SSH key using the guide Bitbucket provided:  https://confluence.atlassian.com/bitbucket/set-up-an-ssh-key-728138079.html  without realizing that it is NOT a guide for setting up secure transmission of code back to the remote (origin) server.

to get to the bottom of things:

$ git remote -v

this will show you what SSH Keys you have set up, and the aliases you have for the urls to the remote server. 

see if you have a set of aliases for both SSH and HTTPS;  if you do, and you're getting the read-only authentication it's likely that the SSH aliases were set up using a process that was only ever Read_Only (eg the issue is that the setup instructions in the confluence page above are only for setting up the remote server to enable Cloning, not push/merge).  Not obvious at all that this is the case...   

If you have aliases there for HTTPS then try using the one for push rather than trying to use the SSH process to push:

$ git push <HTTPS remote server alias> <remote branch name> 

This worked for me.  Hopefully others find it helpful.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket

Powering DevOps with Bitbucket Server & Data Center

Hi everyone, The Cloud team recently announced 12 new DevOps features that help developers ship better code, faster   ! While we’re all excited about the new improvements to Bitbucket ...

1,849 views 0 7
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you