代码之家  ›  专栏  ›  技术社区  ›  user504909

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

  •  1
  • user504909  · 技术社区  · 12 年前

    我想通过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密钥生成带有指纹的文件79:ff:5d:07:9f:64:a7:d2:3f:81:c:4d:ac:54:e:fe 但当我想应用于git命令时,文件指纹是: 39:fe:eb:80:cd:56:bb:42:0e:bc:77:85:2c:9b:14:d2

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

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

    1 回复  |  直到 12 年前
        1
  •  1
  •   Community Mohan Dere    9 年前

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

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

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

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

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