我在尝试递归克隆git存储库时遇到了一个奇怪的问题:
# git clone --recursive git@github.com:eteran/edb-debugger.git
Initialized empty Git repository in /edb-debugger/.git/
The authenticity of host 'github.com (192.30.253.113)' can't be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,192.30.253.113' (RSA) to the list of known hosts.
Permission denied (publickey).
fatal: The remote end hung up unexpectedly
尝试在另一台机器上返回不同的结果:
$ git clone --recursive git@github.com:eteran/edb-debugger.git
Cloning into 'edb-debugger'...
Warning: Permanently added the RSA host key for IP address '192.30.253.112' 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.
我不确定是什么导致了不一致的错误,或者为什么在不久之前它完全正常工作时突然发生这种情况。有两个(单独的)其他问题(¹ ₂)提及每个错误,但是,这将两个错误封装在一个不相关的问题中。
有任何疑问可能是什么问题?
答案 0 :(得分:2)
另一个简单的解决方案,而不是弄乱键...
git config --global url."https://github.com/".insteadOf git@github.com:
git config --global url."https://".insteadOf git://
git config --global url."git@github.com:".insteadOf https://github.com/
git config --global url."git://".insteadOf https://
答案 1 :(得分:1)
您可以通过两种方式解决此问题:
创建ssh-key并在github帐户中添加两台计算机的公钥。之后,此命令将起作用
git clone --recursive git@github.com:eteran/edb-debugger.git
或者,使用https进行克隆。这将提示凭据输入凭据并将其克隆
git clone --recursive https://github.com/eteran/edb-debugger.git
如果您遇到已创建的ssh密钥问题,请使用此命令查看您的ssh密钥是否已正确加载,并且您的公钥是否已正确添加到您的github帐户中。要查看加载的密钥:
ssh-add -l
它应该列出你的密钥:
2048 SHA256:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX /Users/<username>/.ssh/id_rsa (RSA)