【问题标题】:Using git over ssh won't pick up private key在 ssh 上使用 git 不会获取私钥
【发布时间】:2014-12-26 21:21:43
【问题描述】:

我的主要开发机器使用 Linux Mint。 当我在电脑前时,我可以毫无问题地执行 git fetch 之类的远程操作。

我登录的用户是“jonbri”。

> whoami
jonbri

在 ~/.ssh (/home/jonbri/.ssh) 中是我的私钥 (/home/jonbri/.ssh/jonbri) 和公钥 (/home/jonbri/.ssh/jonbri.pub)。

但是当我在另一台计算机上时,例如另一台 Linux Mint 计算机,在命令行上我打开一个 ssh 远程 shell 到我的主计算机,当我尝试 git fetch 等操作时,它看起来像~/.ssh 没有被拾取。

这是我看到的(pwd 是 git repo 的根):

> git fetch
Password:

然后,无论我输入哪个密码,它都不起作用。

为了能够打开远程 ssh shell,我使用 apt-get 安装了 open-ssh-server 和 open-ssh-client。

知道为什么我的密钥在远程 ssh shell 中没有被拾取。

【问题讨论】:

    标签: linux git shell ssh


    【解决方案1】:

    SSH 可能需要标准名称 id_dsa 用于您的私钥,id_dsa.pub 用于您的公钥。

    来自github documentation

    检查目录列表以查看您是否已经拥有公共 SSH 密钥。 默认的公钥文件名是:

    • id_dsa.pub

    • id_ecdsa.pub

    • id_ed25519.pub

    • id_rsa.pub

    【讨论】:

    猜你喜欢
    • 2023-03-24
    • 2019-05-16
    • 1970-01-01
    • 1970-01-01
    • 2010-12-06
    • 2023-01-05
    • 2015-07-11
    • 1970-01-01
    • 2017-06-06
    相关资源
    最近更新 更多