Bitbucket 的访问密钥不起作用
Bitbucket's Access Key Not Working
我在 EC2 - Amazon Linux AMI 上。
我希望能够从 EC2 机器上读取(只读)存储库。为此,我在 EC2 机器中创建了一个 SSH 密钥,如下所示
- ssh-keygen(我输入密码)
- ssh-add ~/.ssh/id_rsa
- ssh-add -l(我得到 2048 79:d3:f6...::53 /home/ec2-user/.ssh/id_rsa (RSA)
- cat ~/.ssh/id_rsa.pub(我拿到钥匙了)
然后,我将步骤(4)中的密钥复制粘贴到添加密钥
https://bitbucket.org/[my--account]/[my-repo]/admin/access-keys/
然后,我回到本地机器(全部在 sudo 中)
- mkdir [回购名称] && cd [回购名称]
- git 初始化
- git远程添加源git@bitbucket.org:[my-account]/[my-repo].git
- sudo git 拉
输出为
sudo git pull
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository
exists.
这是怎么回事?
Then, I go back to the local machine (all in sudo)
为什么要用 sudo
来做?您要么在普通用户下创建密钥并使用普通用户克隆,要么从 root
shell (sudo -i
) 开始执行所有操作。使用不同用户的密钥是不可能的。
我在 EC2 - Amazon Linux AMI 上。
我希望能够从 EC2 机器上读取(只读)存储库。为此,我在 EC2 机器中创建了一个 SSH 密钥,如下所示
- ssh-keygen(我输入密码)
- ssh-add ~/.ssh/id_rsa
- ssh-add -l(我得到 2048 79:d3:f6...::53 /home/ec2-user/.ssh/id_rsa (RSA)
- cat ~/.ssh/id_rsa.pub(我拿到钥匙了)
然后,我将步骤(4)中的密钥复制粘贴到添加密钥
https://bitbucket.org/[my--account]/[my-repo]/admin/access-keys/
然后,我回到本地机器(全部在 sudo 中)
- mkdir [回购名称] && cd [回购名称]
- git 初始化
- git远程添加源git@bitbucket.org:[my-account]/[my-repo].git
- sudo git 拉
输出为
sudo git pull
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
这是怎么回事?
Then, I go back to the local machine (all in sudo)
为什么要用 sudo
来做?您要么在普通用户下创建密钥并使用普通用户克隆,要么从 root
shell (sudo -i
) 开始执行所有操作。使用不同用户的密钥是不可能的。