无法将EC2实例的SSH密钥添加到Bitbucket帐户 [英] Unable to add ssh-key of EC2 instance to bitbucket account
问题描述
我想将存储库克隆到我正在使用的EC2实例中.我使用"ssh-keygen"生成了ssh密钥对.
I want to clone a repository to an EC2 instance I'm using. I generated ssh key pair using "ssh-keygen".
Your public key has been saved in /home/ubuntu/.ssh/id_rsa2.pub.
id_rsa2.pub类似于:
the id_rsa2.pub looks something like:
ssh-rsa a_very_long_sequence ubuntu@ip-a-b-c-d
我将密钥原样粘贴到与我的位存储桶帐户关联的密钥上.但系统提示我
I pasted the key as it is to the keys associated with my bit bucket account. But I'm being prompted
Invalid SSH key (ssh-keygen).
推荐答案
所以可能出现的问题是,您将SSH密钥添加为 ubuntu
用户,但是您 git clone
带有 sudo
的存储库.
So what might be a problem is that you add your SSH-key as the ubuntu
user, but you git clone
the repository with sudo
.
所以您需要做的是,如果使用 sudo git clone git@bitbucket.org:username/repo.git
,则需要获取 id_rsa.pub
来自root用户,并将其添加到Bitbucket(或Git?):
So what you need to do, if you use sudo git clone git@bitbucket.org:username/repo.git
, you need to get the id_rsa.pub
from the root user and add it to Bitbucket (or Git?):
sudo su - root # switch to root user
cat ~/.ssh/id_rsa.pub # create if not already existing
sudo su - ubuntu # switch back to normal user
现在,无需密码验证即可从存储库中提取/克隆.
Now I can pull/clone from my repository without password authentication.
这篇关于无法将EC2实例的SSH密钥添加到Bitbucket帐户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!