每次我使用git与遥控器交互时,比如拉或推时,我都会看到以下消息:
警告:永久添加'…' (RSA)到已知主机列表。
如何防止显示这个烦人的消息?这只是一个烦恼——一切都很正常。
每次我使用git与遥控器交互时,比如拉或推时,我都会看到以下消息:
警告:永久添加'…' (RSA)到已知主机列表。
如何防止显示这个烦人的消息?这只是一个烦恼——一切都很正常。
当前回答
在~/中设置LogLevel为ERROR(不是QUIET)。Ssh /config文件,以避免看到这些错误:
Host *
StrictHostKeyChecking no
UserKnownHostsFile /dev/null
LogLevel ERROR
其他回答
在ssh配置文件($HOME/.ssh/config)中添加以下行:
LogLevel=quiet
如果从命令行运行ssh,在命令字符串中添加以下选项:
-o LogLevel=quiet
例如,下面打印在machine.example.org上安装的gcc版本(没有警告):
ssh -o UserKnownHostsFile=/dev/null \
-o StrictHostKeyChecking=no \
-o LogLevel=quiet \
-i identity_file \
machine.example.org \
gcc -dumpversion
我有同样的问题,我发现没有一个.ssh文件在我的~。所以我只是在~路径下创建了.ssh目录,问题就解决了。
创建一个~/。Ssh /config文件并插入行:
UserKnownHostsFile ~/.ssh/known_hosts
然后,您将在下次访问Github时看到该消息,但在此之后,您将不再看到它,因为主机已添加到known_hosts文件。这可以修复问题,而不仅仅是隐藏日志消息。
这个问题困扰了我很长时间。出现此问题是因为为Windows编译的OpenSSH客户端没有检查~/.ssh/known_hosts中的known_hosts文件
SSH -vvv git@github.com
debug3: check_host_in_hostfile: filename /dev/null
debug3: check_host_in_hostfile: filename /etc/ssh/ssh_known_hosts
debug3: check_host_in_hostfile: filename /dev/null
debug3: check_host_in_hostfile: filename /etc/ssh/ssh_known_hosts
Warning: Permanently added 'github.com,207.97.227.239' (RSA) to the list of known hosts.
如果你正在使用来自GitHub的存储库,可以考虑使用URL的HTTPS版本,以完全避免这个问题:
如果您从Windows GitHub应用程序中克隆存储库,这就是它用于远程URL的内容。也许他们知道一些我们不知道的事。
在~/中设置LogLevel为ERROR(不是QUIET)。Ssh /config文件,以避免看到这些错误:
Host *
StrictHostKeyChecking no
UserKnownHostsFile /dev/null
LogLevel ERROR