[ubuntu 13.04]为什么我的git使用不同的密钥文件?

时间:2013-09-16 07:27:10

标签: git ubuntu ssh

我想通过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命令应检索默认的ssh密钥文件 它应该存储在/root/.ssh/ 为什么ssh得到其他文件?它在哪里?

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

1 个答案:

答案 0 :(得分:1)

  

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

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

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

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

简单的ssh -T git@git.cloudbees.com会触发相同的消息(至少在您接受该主机之前) (或you can use ssh-keyscan