1

我想通过 git 将一些源代码克隆到我的服务器,所以:

root@wemet:~# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
79:ff:5d:07:9f:64:a7:d2:3f:81:0c:4d:ac:54:4e:fe root@wemet
The key's randomart image is:
+--[ RSA 2048]----+
| oo |
| .+o |
| . +o |
| . o .. |
| S . o oE.|
| . . +o=o|
| o o.=|
| o +o|
| . +|
+-----------------+
root@wemet:~# git clone ssh://git@git.cloudbees.com/foretribe/wetest.git
Cloning into 'wetest'...
The authenticity of host 'git.cloudbees.com (54.235.125.211)' can't be establis
ed.
ECDSA key fingerprint is 39:fe:eb:80:cd:56:bb:42:0e:bc:77:85:2c:9b:14:d2.
Are you sure you want to continue connecting (yes/no)? no
Host key verification failed.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
root@wemet:~# 

您可以看到 ssh-keygen 生成带有指纹的文件 79:ff:5d:07:9f:64:a7:d2:3f:81:0c:4d:ac:54:4e:fe 但是当我想申请git命令文件指纹为:39:fe:eb:80:cd:56:bb:42:0e:bc:77:85:2c:9b:14:d2

git 命令应该检索它应该存储在 /root/.ssh/ 的默认 ssh 密钥文件,为什么 ssh 会获取其他文件?在哪儿?

这意味着它们是完全不同的文件!!!

4

1 回答 1

1

您确定要继续连接(是/否)?不

您应该回答“是”(这会将主机添加到您的~/.ssh/known_hosts文件中)。
这与您的 ssh 公钥无关。

这不是您的“使用不同文件的 git”。

这是您的 ssh 会话,要求您确认您了解此远程主机。
然后 ssh 将使用您的公钥。

一个简单的ssh -T git@git.cloudbees.com将触发相同的消息(至少在您接受该主机之前)。
(或者你可以使用ssh-keyscan

于 2013-09-16T07:42:07.383 回答