git 存储库访问被拒绝。通过部署密钥访问是只读的
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13306435/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Repository access denied. access via a deployment key is read-only
提问by zabumba
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. 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.
我还在 BitBucket 的部署密钥部分添加了我的密钥。但我一定错过了一些东西。这个问题并非出于懒惰,我一直在阅读各种文档,包括 BitBuckets 指南。但它仍然没有解决这个问题。
This post is related to Can I import my heroku git repo into bitbuket? and how?
这篇文章与我可以将我的 heroku git repo 导入到 bitbuket 中吗?如何?
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.
看起来一切都很好。
回答by zabumba
First confusion on my side was about where exactly to set SSH Keysin BitBucket.
我的第一个困惑是关于在 BitBucket 中设置SSH 密钥的确切位置。
I am new to BitBucket and I was setting a Deployment Keywhich gives read-accessonly.
我是 BitBucket 的新手,我正在设置一个仅提供读取访问权限的部署密钥。
So make sure you are setting your rsa pub key
in your BitBucket Account Settings.
因此,请确保您rsa pub key
在BitBucket 帐户设置中进行设置。
Click your BitBucket avatar and select Bitbucket Settings(Manage account). There you'll be able to set SSH Keys.
单击您的 BitBucket 头像并选择Bitbucket 设置(管理帐户)。在那里您将能够设置SSH Keys。
I simply deleted the Deployment Key, I don't need any for now. And it worked
我只是删除了Deployment Key,我现在不需要任何。它起作用了
回答by Sathish
Now the SSH option is under the security settings
现在 SSH 选项位于安全设置下
Click Your Avatar --> Bitbucket Settings --> SSH Key --> Add Key
单击您的头像 --> Bitbucket 设置 --> SSH 密钥 --> 添加密钥
Paste your public key
粘贴您的公钥
回答by Tomer
you need to add your key to your profile and NOTto 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
您需要将您的密钥添加到您的个人资料中,而不是添加到特定的存储库中。按照这个:https: //community.atlassian.com/t5/Bitbucket-questions/How-do-I-add-an-SSH-key-as-opposed-to-a-deployment-keys/qaq-p/413373
回答by timhysniu
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
从您的存储库设置中删除此部署密钥。无论如何,您将无法使用此密钥写入此存储库。
转到“头像 -> 设置 -> SSH 密钥”并添加相同的密钥
现在尝试推送删除分支
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.
您之前可以写入存储库,但这是 BitBucket 中的一项更改,您无法再使用部署密钥进行写入。
回答by Jerome Anthony
'Deployment Key' is only for Read Only access. Following is a good way to work through this.
“部署密钥”仅用于只读访问。以下是解决此问题的好方法。
- Create and SSH key and add it to bitbucket (User Avatar -> Bitbucket Setting-> SSH keys)
- ~/.ssh/known_hosts
- ssh-add -D (Remove keys loaded to SSH agent)
- ssh-add ~/.ssh/your_private_key_for_bitbucket
- ssh [email protected] -Tv (Verify that your key is getting used to connect to bitbucket)
- git push 'remote name' 'branch name'
- 创建和 SSH 密钥并将其添加到 bitbucket(用户头像 -> Bitbucket 设置 -> SSH 密钥)
- ~/.ssh/known_hosts
- ssh-add -D(删除加载到 SSH 代理的密钥)
- ssh 添加 ~/.ssh/your_private_key_for_bitbucket
- ssh [email protected] -Tv(验证您的密钥是否已用于连接到 bitbucket)
- git push '远程名称' '分支名称'
回答by sent.ror
You have to delete the deployment key first if you are going to add the same key under Manage Account SSH Key.
如果您要在管理帐户 SSH 密钥下添加相同的密钥,则必须先删除部署密钥。
回答by Tjunkie
TLDR: ssh-add ~/.ssh/yourkey
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.
我确实有一个包含所有正确内容的 ./ssh/config,还有一个工作正常的早期存储库(相同的 bitbucket 帐户,相同的密钥)。然后我生成了一个 deploy_key,然后创建了一个新的存储库。
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 代理如何/为什么会搞砸这个,但添加密钥解决了它。我的意思是在我的本地 Ubuntu 中添加密钥,而不是在 bitbucket 管理员中。命令只是
~/.ssh$ ssh-add myregualrkey
Hope this helps someone.
希望这可以帮助某人。
回答by sarink
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,然后重试为我修复它。
回答by David Liu
I would like to re-emphasize the following:
我想再次强调以下几点:
- You might have added the SSH key to your repository(e.g. ExampleRepo), but this is NOT where the SSH key goes.
- It is meant to go into YOUR PROFILE. This is the small avatar on the bottom left corner of the screen.Here, you'll find a differentplace to put your SSH Keys (under Security) > then you add the key here instead.
- If you accidentally put your SSH key into the repository (as opposed to your account), then delete the one in the repository.
- 您可能已将 SSH 密钥添加到您的存储库(例如 ExampleRepo),但这不是 SSH 密钥所在的位置。
- 它旨在进入您的个人资料。这是屏幕左下角的小头像。在这里,您会找到一个不同的位置来放置 SSH 密钥(在安全性下)> 然后在此处添加密钥。
- 如果您不小心将 SSH 密钥放入存储库(而不是您的帐户),请删除存储库中的密钥。
Took me ages to realise, somehow even after reading the answers here it didn't click.
我花了很长时间才意识到,不知何故,即使在阅读了这里的答案之后,它也没有点击。
回答by Yoones Mehdian
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:
您可以拥有两种 SSH 密钥:
- For your entire accountwhich will work for all repositories
- Per repository SSH keywhich can only be used for that specific repository.
- 适用于您的整个帐户,适用于所有存储库
- 每个存储库的 SSH 密钥只能用于该特定存储库。
I simply removed my repository SSH key and added a new SSH key to my account and it worked well.
我只是删除了我的存储库 SSH 密钥,并在我的帐户中添加了一个新的 SSH 密钥,它运行良好。
I hope it helps someone. Cheers
我希望它可以帮助某人。干杯