我已将github.com
SSH密钥添加到/etc/ssh/ssh_known_hosts
。但是当我跑步时
git clone [email protected]:me/repo
我仍然得到
Cloning into 'repo'...
The authenticity of host 'github.com (XXX.XXX.XXX.XXX)' can't be established.
RSA key fingerprint is SHA256:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.
Are you sure you want to continue connecting (yes/no)?
~/.ssh/known_hosts
它按预期方式工作,则无提示。/etc/ssh/ssh_known_hosts
因为有多个用户。'yes'
,因为它正在运行puppet
。StrictHostKeyChecking = no
。~/.ssh/config
文件。sshd
自修改以来,我也已重新启动/etc/ssh/ssh_known_hosts
。如何强制git使用/etc/ssh/ssh_known_hosts
?
编辑1:
这是文件/etc/ssh/ssh_config
(并且~/.ssh/config
不存在):
# This is the ssh client system-wide configuration file. See
# ssh_config(5) for more information. This file provides defaults for
# users, and the values can be changed in per-user configuration files
# or on the command line.
# Configuration data is parsed as follows:
# 1. command line options
# 2. user-specific file
# 3. system-wide file
# Any configuration value is only changed the first time it is set.
# Thus, host-specific definitions should be at the beginning of the
# configuration file, and defaults at the end.
# Site-wide defaults for some commonly used options. For a comprehensive
# list of available options, their meanings and defaults, please see the
# ssh_config(5) man page.
Host *
# ForwardAgent no
# ForwardX11 no
# ForwardX11Trusted yes
# RhostsRSAAuthentication no
# RSAAuthentication yes
# PasswordAuthentication yes
# HostbasedAuthentication no
# GSSAPIAuthentication no
# GSSAPIDelegateCredentials no
# GSSAPIKeyExchange no
# GSSAPITrustDNS no
# BatchMode no
# CheckHostIP yes
# AddressFamily any
# ConnectTimeout 0
# StrictHostKeyChecking ask
# IdentityFile ~/.ssh/identity
# IdentityFile ~/.ssh/id_rsa
# IdentityFile ~/.ssh/id_dsa
# IdentityFile ~/.ssh/id_ecdsa
# IdentityFile ~/.ssh/id_ed25519
# Port 22
# Protocol 2
# Cipher 3des
# Ciphers aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc
# MACs hmac-md5,hmac-sha1,[email protected],hmac-ripemd160
# EscapeChar ~
# Tunnel no
# TunnelDevice any:any
# PermitLocalCommand no
# VisualHostKey no
# ProxyCommand ssh -q -W %h:%p gateway.example.com
# RekeyLimit 1G 1h
SendEnv LANG LC_*
HashKnownHosts yes
GSSAPIAuthentication yes
这是我的/etc/ssh/ssh_known_hosts
:
# HEADER: This file was autogenerated at 2020-12-31 10:33:06 +0000
# HEADER: by puppet. While it can still be managed manually, it
# HEADER: is definitely not recommended.
gerrit.wikimedia.org ssh-rsa AAAAB3Nz[...]
github ssh-rsa AAAAB3NzAAAAB3Nz[...]
编辑2:
所有人都具有以下权限/etc/ssh/ssh_known_hosts
:
vagrant@vagrant:~$ ls -la /etc/ssh/ssh_known_hosts
-rw-r--r-- 1 root root 795 Dec 31 10:33 /etc/ssh/ssh_known_hosts
您的已知主机文件格式错误。每行的第一个条目是您要连接的系统的名称。在这种情况下,这必须github.com
不是普通的github
。这是OpenSSH用于查找适当密钥的技术。
您可以使用找到正确的格式ssh-keyscan github.com
。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句