Reputation: 12412
After successfully cloning my repo from heroku and added another remote
1/ git clone [email protected]:[APP].git
2/ git remote add bitbucket ssh://[email protected]/[ACCOUNT]/[REPO].git
3/ git push bitbucket master
I am still getting this error after running line (3) or using SourceTree
conq: repository access denied. access via a deployment key is read-only.
First I don't understand what this message means in practice. And that's shame.
I did create ssh key pair and added to heroku :
ssh-keygen -t rsa
heroku keys:add ./id_rsa.pub
I also added my key in deployment keys section in BitBucket. But I must be missing something. This question is not out of laziness, I have been reading various docs including BitBuckets guides. But it still don't get around this issue.
This post is related to Can I import my heroku git repo into bitbuket? and how?
ADDITIONAL FACTS:
ssh -T [email protected]
conq: authenticated via a deploy key.
You can use git or hg to connect to Bitbucket. Shell access is disabled.
$ ssh -v [email protected]
OpenSSH_5.6p1, OpenSSL 0.9.8r 8 Feb 2011
debug1: Reading configuration data /Users/joel/.ssh/config
debug1: Applying options for bitbucket.org
debug1: Reading configuration data /etc/ssh_config
debug1: Applying options for *
debug1: Connecting to bitbucket.org [207.223.240.181] port 22.
debug1: Connection established.
debug1: identity file /Users/joel/.ssh/id_rsa type 1
debug1: identity file /Users/joel/.ssh/id_rsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3
debug1: match: OpenSSH_5.3 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.6
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host 'bitbucket.org' is known and matches the RSA host key.
debug1: Found key in /Users/joel/.ssh/known_hosts:5
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /Users/joel/.ssh/id_rsa
debug1: Remote: Forced command: conq deploykey:13907
debug1: Remote: Port forwarding disabled.
debug1: Remote: X11 forwarding disabled.
debug1: Remote: Agent forwarding disabled.
debug1: Remote: Pty allocation disabled.
debug1: Server accepts key: pkalg ssh-rsa blen 279
debug1: read PEM private key done: type RSA
debug1: Remote: Forced command: conq deploykey:13907
debug1: Remote: Port forwarding disabled.
debug1: Remote: X11 forwarding disabled.
debug1: Remote: Agent forwarding disabled.
debug1: Remote: Pty allocation disabled.
debug1: Authentication succeeded (publickey).
Authenticated to bitbucket.org ([207.223.240.181]:22).
debug1: channel 0: new [client-session]
debug1: Requesting [email protected]
debug1: Entering interactive session.
debug1: Sending environment.
debug1: Sending env LC_CTYPE = UTF-8
PTY allocation request failed on channel 0
Looks like all is fine.
Upvotes: 303
Views: 176031
Reputation: 133
Edit ssh config file:
sudo pico ~/.ssh/config
Then add these lines:
Host github.com
IdentityFile /Users/myUser/.ssh/id_rsa
IdentitiesOnly=yes
Upvotes: 0
Reputation: 8021
'Deployment Key' is only for Read Only access. Following is a good way to work through this.
Upvotes: 10
Reputation: 1486
First choose or create the key you want to use for pushing to Bitbucket. Let's say its public key is at ~/.ssh/bitbucket.pub
~/.ssh/config
: Host bitbucket.org
IdentityFile ~/.ssh/bitbucket
Upvotes: 3
Reputation: 12412
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
Upvotes: 726
Reputation: 1108
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
Upvotes: 18
Reputation: 507
I would like to re-emphasize the following:
Took me ages to realise, somehow even after reading the answers here it didn't click.
Upvotes: 4
Reputation: 522
Recently I faced the same issue. I got the following error:
repository access denied. access via a deployment key is read-only.
You can have two kinds of SSH keys:
I simply removed my repository SSH key and added a new SSH key to my account and it worked well.
I hope it helps someone. Cheers
Upvotes: 2
Reputation: 11
Steps:
Create ssh keys on source server
ssh-keygen
Cat and copy id_rsa.pub located under ~./ssh directory
Check if it works by running below command on the source server
git remote show origin
For fetch and push from the source server, if the protocol is 'https' then you have to change it to 'git+ssh' by running below command
git remote set-url origin git+ssh://<bitbucketaccount>@bitbucket.org/<accountname>/repo.git
Check if you can do push to the repo.
Done!
Upvotes: 1
Reputation: 15945
Two step process to be able to push pull
Step1: Generate ssh key(public and private) on mac
Step2: Put private key in mac and public key in git website
below detailed steps are for mac users
Step 1: Generating keys
ssh-keygen
this will prompt you to enter storage location for key, you may type /Users/[machinename]/.ssh/[keyname]
Step2:pushing keys to appropriate locations[mac and remote accounts i.e Github, bitbucket, gitlab etc ]
ssh-add -K ~/.ssh/[keyname]
in terminal to add your private key to the macpbcopy < ~/.ssh/[keyname].pub
to copy public key to clipboardDone, now you can push pull.
Upvotes: 1
Reputation: 1540
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.
Upvotes: 13
Reputation: 3557
Now the SSH option is under the security settings
Click Your Avatar --> Bitbucket Settings --> SSH Key --> Add Key
Paste your public key
Upvotes: 64
Reputation: 1
for this error : conq: repository access denied. access via a deployment key is read-only.
I change the name of my key, example
cd /home/try/.ssh/
mv try id_rsa
mv try.pub id_rsa.pub
I work on my own key on bitbucket
Upvotes: -3
Reputation: 1682
Sometimes it doesn't work because you manually set another key for bitbucket in ~/.ssh/config
.
Upvotes: 0
Reputation: 497
TLDR: ssh-add ~/.ssh/yourkey
I've just worked through this problem.
And none of the other answers helped.
I did have a ./ssh/config with all the right stuff, also an earlier repository working fine (same bitbucket account, same key). Then I generated a deploy_key, and after that created a new repository.
After that could not clone the new repo.
I wish I knew how/why ssh agent was messing this up, but adding the key solved it. I mean adding the key in my local Ubuntu, not in bitbucket admin. The command is just
~/.ssh$ ssh-add myregualrkey
Hope this helps someone.
Upvotes: 9
Reputation: 198
I had the same issue Kabir Sarin had. The solution was to clone the repo via SSH, instead of using the https URL. so this is what helped me, and hopefully others:
git clone [email protected]:{accountName}/{repoName}.git
Upvotes: 1
Reputation: 18526
I had this happen when I was trying to use a deployment key because that is exactly what I wanted.
I could connect via ssh -T [email protected]
and it would tell me I had access to read the repository I wanted, but git clone
would fail.
Clearing out ~/.ssh/known_hosts
, generating a new key via ssh-keygen
, adding that new key to bitbucket, and retrying fixed it for me.
Upvotes: 5
Reputation: 1764
All you need - add another key and use it.
As i've found first key - always Deployment Key.
Upvotes: 0
Reputation: 187
You have to delete the deployment key first if you are going to add the same key under Manage Account SSH Key.
Upvotes: 9