Missed Team ’24? Catch up on announcements here.

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

SSH access with deploy keys

moledet
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 9, 2017

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

0 votes
BuildIt
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 4, 2020

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.

0 votes
BuildIt
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 4, 2020

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 

0 votes
DeadEyeDog
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 16, 2019

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

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events