【问题标题】:Use ssh key in /var directory on Ubuntu在 Ubuntu 上的 /var 目录中使用 ssh 密钥
【发布时间】:2020-12-03 16:09:12
【问题描述】:

我在我的主目录/vincent 中为 github 设置了一个 ssh 密钥。我想将存储库克隆到我的/var/www/html 目录中。看来,密钥在我的主目录之外是未知的。我要怎么做,才能连接到/var目录下的github?

编辑:

使用 ssh 克隆时,我从 github 收到以下错误

git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

【问题讨论】:

  • 你是如何配置 git 和/或 ssh 来使用这个密钥文件的?当您尝试使用 ssh 或 git 时会发生什么?您收到任何错误消息吗?他们说什么?
  • 我收到一条错误消息,提示我没有正确的访问权限:git@github.com: Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.
  • 你在使用sudo吗?你到底在运行什么命令来克隆?

标签: ubuntu github ssh ubuntu-18.04


【解决方案1】:

你可以输入

export GIT_SSH_COMMAND='ssh -Tv'
git clone ...

然后您将看到 在哪里 ssh 正在寻找您的密钥。
所述密钥应在~/.ssh/id_rsa 中,~ 通常为/home/vincent(不仅仅是/vincent

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-10-13
    • 2014-07-08
    • 1970-01-01
    • 2022-10-07
    • 2016-05-29
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多