每次我使用 git 与远程交互时,例如 pull 或推时,都会显示以下消息:
Warning: Permanently added '...' (RSA) to the list of known hosts.
如何防止显示这条烦人的消息?这只是一个烦恼——一切正常。
最佳答案
创建一个 ~/.ssh/config
文件并插入以下行:
UserKnownHostsFile ~/.ssh/known_hosts
您将在下次访问 Github 时看到该消息,但之后您将不会再看到它,因为主机已添加到 known_hosts
文件中。这解决了问题,而不仅仅是 stash 日志消息。
这个问题困扰了我一段时间。出现此问题是因为为 Windows 编译的 OpenSSH 客户端不检查 ~/.ssh/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.
关于Git 说 "Warning: Permanently added to the list of known hosts",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9299651/