【发布时间】:2021-02-15 21:33:09
【问题描述】:
我按照https://help.github.com/articles/generating-ssh-keys 的说明进行操作 并输入
ssh -T git@github.com
我收到消息
Hi username! You've successfully authenticated, but GitHub does not
# provide shell access.
当我尝试使用 ssh 克隆存储库时
git clone ssh://github.com/username/repository.git
我明白了
Permission denied (publickey).
fatal: The remote end hung up unexpectedly
如果我输入
ssh-add -l
我看到 3 个密钥,一个附有我的电子邮件地址 (k1),另外 2 个附在 ~/.ssh/id_rsa (RSA) 内(k2 和 k3)。
密钥 k3 与 k1 相同
如果我输入
ssh -vT git@github.com
一切都很好......唯一让我思考的是
debug1: Remote protocol version 2.0, remote software version libssh-0.6.0
debug1: no match: libssh-0.6.0
【问题讨论】:
-
这非常有用,因为 git 错误只是说“权限被拒绝”。当我确认 ssh 设置工作正常时,我意识到问题是由于权限问题,git 无法在当前文件夹中创建目录。
-
就我而言,我只需要先
cd ~/.ssh/和ssh-add <name-of-key>,然后就可以克隆了。