gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-02 06:53:09 35 4
gpt4 key购买 nike

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

我的 ~/.ssh 目录中有正确的 configgithub_pr_key 文件。

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

但是我无法通过 SSH 克隆我的任何私有(private)或公共(public)要点,我遇到此错误:

~/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.

如何解决?

最佳答案

首先检查“Error: Permission denied (publickey)”中提到的原因。 仔细检查 ssh -Tv git@github.com 的输出,以确认您的公钥已在您的 GitHub 帐户上注册。

但不要忘记,您仍然可以 use https with 2FA .
Create a PAT (Personnal Access Token) ,并将其用作密码。
这应该足以让您克隆任何东西,包括您的私有(private)要点。

最后,尝试通过 ssh 使用 git@github.com 克隆,而不是 git@gist.github.com (如 in 2013 所示,尽管 git@gist.github.com 应该可以):

git clone git@github.com:d1b8041051e62aa34f337b3dabc77d9a.git <=== does work 
NOT
git clone git@gist.github.com:d1b8041051e62aa34f337b3dabc77d9a.git

仅供测试,也请尝试:

git clone ssh://git@gist.github.com/d1b8041051e62aa34f337b3dabc77d9a.git  

(这次是 git@gist.github.com)

<小时/>

正如 Jacktose 所指出的在 the comments :

If ssh -Tv git@github.com works, try ssh -Tv git@gist.github.com and compare.

In my case, the latter was using the wrong public key because .ssh/config specified IdentityFile under Host github.com.
I changed that to Host github.com *.github.com and problems solved.

关于通过 SSH 协议(protocol)的 Github Gist 不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44267593/

35 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com