存储库访问被拒绝。通过部署密钥进行访问是只读的

本文翻译自:Repository access denied. access via a deployment key is read-only

After successfully cloning my repo from heroku and added another remote 成功克隆了来自heroku的repo并添加了另一个遥控器

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 运行第(3)行或使用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密钥对并添加到heroku:

ssh-keygen -t rsa 
heroku keys:add ./id_rsa.pub 

I also added my key in deployment keys section in BitBucket. 我还在BitBucket中的部署密钥部分添加了我的密钥。 But I must be missing something. 但我必须遗漏一些东西。 This question is not out of laziness, I have been reading various docs including BitBuckets guides. 这个问题并非出于懒惰,我一直在阅读各种文档,包括BitBuckets指南。 But it still don't get around this issue. 但它仍然无法解决这个问题。

This post is related to Can I import my heroku git repo into bitbuket? 这篇文章与我可以将我的heroku git repo导入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. 看起来一切都很好。


#1楼

参考:https://stackoom.com/question/tpbv/存储库访问被拒绝-通过部署密钥进行访问是只读的


#2楼

First confusion on my side was about where exactly to set SSH Keys in BitBucket. 我身边的第一个困惑是关于在BitBucket中设置SSH密钥的确切位置。

I am new to BitBucket and I was setting a Deployment Key which gives read-access only. 我是BitBucket的新手,我正在设置一个仅提供读访问权限部署密钥

So make sure you are setting your rsa pub key in your BitBucket Account Settings . 因此,请确保在BitBucket帐户设置中设置rsa pub key

Click your BitBucket avatar and select Bitbucket Settings ( 单击您的BitBucket头像并选择Bitbucket设置 Manage account 管理帐户 ). )。 There you'll be able to set SSH Keys . 在那里,您将能够设置SSH密钥

I simply deleted the Deployment Key , I don't need any for now. 我只是删除了部署密钥 ,我现在不需要。 And it worked 它奏效了


#3楼

如果要在“管理帐户SSH密钥”下添加相同的密钥,则必须先删除部署密钥。


#4楼

All you need - add another key and use it. 所需的一切 - 添加另一个密钥并使用它。

As i've found first key - always Deployment Key. 因为我找到了第一个密钥 - 总是部署密钥。


#5楼

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. 我可以通过ssh -T [email protected]连接,它会告诉我我有权读取我想要的存储库,但是git clone会失败。

Clearing out ~/.ssh/known_hosts , generating a new key via ssh-keygen , adding that new key to bitbucket, and retrying fixed it for me. 清除~/.ssh/known_hosts ,通过ssh-keygen生成一个新密钥,将新密钥添加到bitbucket,然后重试为我修复它。


#6楼

I had the same issue Kabir Sarin had. 我有同样的问题Kabir Sarin。 The solution was to clone the repo via SSH, instead of using the https URL. 解决方案是通过SSH克隆repo,而不是使用https URL。 so this is what helped me, and hopefully others: 所以这对我有所帮助,希望其他人:

    git clone [email protected]:{accountName}/{repoName}.git

你可能感兴趣的:(存储库访问被拒绝。通过部署密钥进行访问是只读的)