gpt4 book ai didi

git - Bitbucket 的访问 key 不起作用

转载 作者:行者123 更新时间:2023-12-02 14:19:30 25 4
gpt4 key购买 nike

我在 EC2 - Amazon Linux AMI 上。
我希望能够从 EC2 机器上读取(只读)存储库。为此,我在 EC2 机器内创建了一个 SSH key ,如下所示

  • ssh-keygen (我输入密码)
  • ssh-add ~/.ssh/id_rsa
  • ssh-添加-l (我得到 2048 79:d3:f6...::53/home/ec2-user/.ssh/id_rsa (RSA)
  • 猫 ~/.ssh/id_rsa.pub (我拿到 key )

  • 然后,我将步骤(4)中的 key 复制粘贴到添加 key
    https://bitbucket.org/[my--account]/[my-repo]/admin/access-keys/
    然后,我回到本地机器(全部在 sudo 中)
  • mkdir [repo 名称] && cd [repo 名称]
  • git 初始化
  • git remote add origin git@bitbucket.org:[my-account]/[my-repo].git
  • 须藤 git pull

  • 输出是

    sudo git pull

    Permission denied (publickey).

    fatal: Could not read from remote repository.

    Please make sure you have the correct access rights and the repositoryexists.


    到底是怎么回事?

    最佳答案

    Then, I go back to the local machine (all in sudo)



    为什么要使用 sudo ?您可以在普通用户下创建 key 并使用普通用户进行克隆,或者从 root 执行所有操作。外壳( sudo -i)。使用不同用户的 key 是不可能的。

    关于git - Bitbucket 的访问 key 不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43051516/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com