【问题标题】:Already generated ssh key on another machine已经在另一台机器上生成了 ssh 密钥
【发布时间】:2019-05-14 19:31:01
【问题描述】:

我已经在我以前的机器 (Ubuntu) 上生成了 SSH 密钥,但现在我要转移到另一台笔记本电脑上,我想要这个确切的 SSH 密钥随身携带。我已将 config id_rsa id_rsa.pub known_hosts 文件复制到 ~/.ssh 文件夹并尝试从GitLab 和错误发生:

权限被拒绝(公钥)。致命:无法从远程读取 存储库。

有什么想法吗?在这台笔记本电脑上,用户和笔记本电脑本身有不同的用户名。

【问题讨论】:

    标签: git ubuntu ssh


    【解决方案1】:

    SSH 对私钥文件的权限很挑剔。执行以下操作以确保文件权限正确:

    chmod 0600 ~/.ssh/id_rsa
    

    【讨论】:

      【解决方案2】:

      我相信answers你的问题。

      在 ~/.ssh/config 中,添加:

      # GitLab.com
      Host gitlab.com
        Preferredauthentications publickey
        IdentityFile ~/.ssh/gitlab_com_rsa
      

      然后请务必发送ssh -T git@gitlab.com 以确保一切正常。

      【讨论】:

        猜你喜欢
        • 2021-08-26
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2019-04-13
        • 1970-01-01
        • 1970-01-01
        • 2013-03-17
        • 2015-01-16
        相关资源
        最近更新 更多