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

zab*_*mba 299 git ssh bitbucket ssh-keys

成功克隆了来自heroku的repo并添加了另一个遥控器

1/ git clone git@heroku.com:[APP].git
2/ git remote add bitbucket ssh://git@bitbucket.org/[ACCOUNT]/[REPO].git
3/ git push bitbucket master
Run Code Online (Sandbox Code Playgroud)

运行第(3)行或使用SourceTree后,我仍然收到此错误

conq: repository access denied. access via a deployment key is read-only.
Run Code Online (Sandbox Code Playgroud)

首先,我不明白这个消息在实践中意味着什么.这太可惜了.

我确实创建了ssh密钥对并添加到heroku:

ssh-keygen -t rsa 
heroku keys:add ./id_rsa.pub 
Run Code Online (Sandbox Code Playgroud)

我还在BitBucket中的部署密钥部分添加了我的密钥.但我必须遗漏一些东西.这个问题并非出于懒惰,我一直在阅读各种文档,包括BitBuckets指南.但它仍然无法解决这个问题.

这篇文章与我可以将我的heroku git repo导入bitbuket有关吗?如何?

其他事实:

ssh -T hg@bitbucket.org
conq: authenticated via a deploy key.

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


$ ssh -v git@bitbucket.org
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 no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: Sending environment.
debug1: Sending env LC_CTYPE = UTF-8
PTY allocation request failed on channel 0
Run Code Online (Sandbox Code Playgroud)

看起来一切都很好.

zab*_*mba 716

我身边的第一个困惑是关于在BitBucket中设置SSH密钥的确切位置.

我是BitBucket的新手,我正在设置一个仅提供读访问权限部署密钥.

因此,请确保您rsa pub keyBitBucket帐户设置中进行设置.

单击您的BitBucket头像并选择Bitbucket设置(管理帐户).在那里,您将能够设置SSH密钥.

我只是删除了部署密钥,我现在不需要.它奏效了

在此输入图像描述

  • 谢谢你的回答.这与我错过的完全相同.我添加了部署密钥而不是SSH密钥. (47认同)
  • 是! 谢谢您的回答.Atlassian应该在他们的文档中更清楚. (26认同)
  • 是的,ssh键菜单很好地隐藏在Bitbucket中! (14认同)
  • 在找到你的答案之前挣扎了30分钟,非常感谢你 (6认同)
  • 很好的帮助!Mercy Joelmaranhao! (3认同)

Sat*_*ish 64

现在,SSH选项位于安全设置下

单击您的头像 - > Bitbucket设置 - > SSH密钥 - >添加密钥

粘贴您的公钥

  • 谢谢.我只想描述一下我的情况.我在存储库设置中添加了我的公钥,而不是在我的Bitbucket帐户密钥中.所以我删除了存储库中的密钥并将其添加到我的配置文件设置中以使其正常工作. (10认同)

Tom*_*mer 17

您需要将密钥添加到您的配置文件而不是特定的存储库.请遵循:https: //community.atlassian.com/t5/Bitbucket-questions/How-do-I-add-an-SSH-key-as-opposed-to-a-deployment-keys/qaq-p/413373


小智 13

部署密钥是只读的.要启用写访问权限,您需要:

  • 从存储库设置中删除此部署密钥.无论如何,您将无法使用此密钥写入此回购.

  • 转到"头像 - >设置 - > SSH密钥"并添加相同的密钥

  • 现在尝试推送删除分支

您之前可以写入存储库,但这是BitBucket中的更改,您无法再使用deploy键进行编写.


Jer*_*ony 10

"部署密钥"仅适用于只读访问.以下是一个很好的方法来解决这个问题.

  • 创建和SSH密钥并将其添加到bitbucket(用户头像 - > Bitbucket设置 - > SSH密钥)
  • 的〜/ .ssh/known_hosts中
  • ssh-add -D(删除加载到SSH代理的密钥)
  • ssh-add~/.ssh/your_private_key_for_bitbucket
  • ssh git@bitbucket.org -Tv(确认您的密钥已用于连接到bitbucket)
  • git push'remote name''分支名称'


小智 9

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

  • 删除部署密钥给了我"有人已将此注册为部署密钥." (3认同)
  • 请注意,您应该在BITBUCKET SETTINGS下添加shh公钥(如完整的BB帐户所示)NOT并且我在单个Repo Settings下重复NOT.如果您在repo设置下添加了一个键,这就是您收到这些错误的原因. (3认同)

Tju*_*kie 8

TLDR:ssh-add~/.ssh/yourkey

我刚刚解决了这个问题.

其他答案都没有帮助.

我确实有一个./ssh/config与所有正确的东西,也是一个早期的存储库工作正常(相同的bitbucket帐户,相同的密钥).然后我生成了一个deploy_key,然后创建了一个新的存储库.

之后无法克隆新的回购.

我希望我知道如何/为什么ssh代理正在弄乱这个,但添加密钥解决了它.我的意思是在我的本地Ubuntu中添加密钥,而不是在bitbucket admin中.命令就是

    ~/.ssh$ ssh-add myregualrkey
Run Code Online (Sandbox Code Playgroud)

希望这有助于某人.

  • 我不明白你做了什么. (3认同)

sar*_*ink 5

当我尝试使用部署密钥时,我发生了这种情况,因为这正是我想要的.

我可以连接通过ssh -T git@bitbucket.org,它会告诉我,我有权访问我想要的存储库,但git clone会失败.

清除~/.ssh/known_hosts,生成一个新密钥ssh-keygen,将新密钥添加到bitbucket,然后重试为我修复它.