Git 说“警告:永久添加到已知主机列表中"; [英] Git says "Warning: Permanently added to the list of known hosts"
问题描述
每次使用 git 与遥控器交互时,例如拉或推时,都会显示以下消息:
Every time I use git to interact with a remote, such as when pulling or pushing, I am shown the following message:
警告:已将..."(RSA)永久添加到已知主机列表中.
Warning: Permanently added '...' (RSA) to the list of known hosts.
如何防止显示这条烦人的消息?这只是一个烦恼 - 一切正常.
How can I prevent this annoying message from displaying? It is only an annoyance—everything functions properly.
推荐答案
解决方案:创建一个~/.ssh/config
文件并插入一行:
Solution: create a ~/.ssh/config
file and insert the line:
UserKnownHostsFile ~/.ssh/known_hosts
您将在下次访问 Github 时看到该消息,但之后您将看不到它,因为主机已添加到 known_hosts
文件中.这解决了问题,而不仅仅是隐藏日志消息.
You will then see the message the next time you access Github, but after that you'll not see it anymore because the host is added to the known_hosts
file. This fixes the issue, rather than just hiding the log message.
这个问题困扰了我很长时间.出现问题是因为为 Windows 编译的 OpenSSH 客户端没有检查 ~/.ssh/known_hosts
This problem was bugging me for quite some time. The problem occurs because the OpenSSH client compiled for Windows doesn't check the known_hosts file in ~/.ssh/known_hosts
ssh -vvvvvvvvvvvvvvvvvvv git@github.com
ssh -vvvvvvvvvvvvvvvvvvv 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.
这篇关于Git 说“警告:永久添加到已知主机列表中";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!