通过 SSH 协议的 Github Gist 不起作用

kag*_*kij 4 ssh gist github

我正在使用双因素身份验证,这就是为什么 HTTPS 不是使用 GitHub 存储库和要点的便捷方式的原因。

我的~/.ssh目录中有正确的配置github_pr_key文件。

我能够克隆我所有的个人和公共存储库。

但是我无法通过 SSH 克隆我的任何私人或公共要点,我有这个错误:

~/Desktop >> git clone git@gist.github.com:d1b8041051e62aa34f337b3dabc77d9a.git                                                                                                                                
Cloning into 'd1b8041051e62aa34f337b3dabc77d9a'...
The authenticity of host 'gist.github.com (192.30.253.118)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl22E1IGOCspRomTxdCARLviKw6E5SY8.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'gist.github.com,192.30.253.118' (RSA) to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Run Code Online (Sandbox Code Playgroud)

如何修复?

Von*_*onC 5

首先检查“错误:权限被拒绝(公钥) ”中提到的原因。
仔细检查 , 的输出ssh -Tv git@github.com以确认您的公钥已在您的 GitHub 帐户中注册。

但是不要忘记您仍然可以将 https 与 2FA 一起使用
创建 PAT(个人访问令牌),并将其用作密码。
这应该足以让您克隆任何东西,包括您的私人 Gist。

最后,尝试通过 ssh 进行克隆git@github.com,而不是git@gist.github.com(如2013 年所见,即使git@gist.github.com应该可行):

git clone git@github.com:d1b8041051e62aa34f337b3dabc77d9a.git <=== does work 
NOT
git clone git@gist.github.com:d1b8041051e62aa34f337b3dabc77d9a.git  
Run Code Online (Sandbox Code Playgroud)

仅用于测试,也请尝试:

git clone ssh://git@gist.github.com/d1b8041051e62aa34f337b3dabc77d9a.git  
Run Code Online (Sandbox Code Playgroud)

(这次是git@gist.github.com