我在 Ubuntu 12.04 上设置了一个本地 git 服务器。可以在服务器上本地克隆存储库,但我无法从另一台服务器克隆存储库。我可以使用相同的配置 ssh 到服务器。
~/.ssh/config(客户端)
Host i-git
HostName myhost
User git
IdentityFile %d/.ssh/i_git_id_rsa
#LogLevel DEBUG3
跑步:
ssh i-git
效果很好。
跑步:
git clone i-git:/home/git/test.git
好像只是挂了。
调试输出(取消注释日志级别在〜/ .ssh / config中):
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug3: check_host_in_hostfile: filename ***<localuser>***/.ssh/known_hosts
debug2: key_type_from_name: unknown key type 'ecdsa-sha2-nistp256'
debug3: key_read: missing keytype
debug3: check_host_in_hostfile: filename /etc/ssh/ssh_known_hosts
debug3: check_host_in_hostfile: filename ***<localuser>***/.ssh/known_hosts
debug3: check_host_in_hostfile: filename /etc/ssh/ssh_known_hosts
debug2: no key of type 0 for host ***myhost***
debug3: check_host_in_hostfile: filename <localuser>/.ssh/known_hosts2
debug3: check_host_in_hostfile: filename /etc/ssh/ssh_known_hosts2
debug3: check_host_in_hostfile: filename ***<localuser>***/.ssh/known_hosts
debug2: key_type_from_name: unknown key type 'ecdsa-sha2-nistp256'
debug3: key_read: missing keytype
debug3: check_host_in_hostfile: filename /etc/ssh/ssh_known_hosts
debug2: no key of type 2 for host ***myhost***
答案1
Ubuntu 似乎支持 3 种不同类型的主机密钥值。在服务器上,我看到:
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
如果我将其更改为:
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
#HostKey /etc/ssh/ssh_host_ecdsa_key
然后删除客户端上主机的条目(在 ~/.ssh/known_hosts 中),它现在将使用 dsa 密钥。尝试 ssh:
ssh i-git
将重新验证服务器,然后 git 命令将正常工作。出于某种原因,git 似乎无法识别ecdsa_key
希望这对某人有帮助...