ssh/config:第 1 行:错误的配置选项:包括

ssh/config: line 1: Bad configuration option: include

在我的 ~/.ssh/config 中添加了以下内容:

Include /Path/to/ssh.config

它给出了错误:

ssh remoteEc-2
/Users/Me/.ssh/config: line 1: Bad configuration option: include
/Users/Me/.ssh/config: terminating, 1 bad configuration options

ssh -V 给出:

OpenSSH_6.9p1, LibreSSL 2.1.8

我在 OSX El-Capitan

Include 在版本 7.3 之前不是有效选项...

参见:https://www.openssh.com/txt/release-7.3

New Features

[...]

  • ssh(1): Add an Include directive for ssh_config(5) files.

另请参阅 this answer


如果您不能/不想更新,那么您可以使用以下方法整理您的配置文件:

cat ${CONFIG_1} ${CONFIG_2} ${CONFIG_3} > ~/.ssh/config

每次更新任何部分时都需要运行它...

同样的问题,只是我使用的是 7.4

结果是 the Include directive needs to go into /etc/ssh/ssh_config,而不是 /etc/ssh/sshd_config(注意文件名中的 d)。

对我来说不是很明显。希望这能为找到它的人节省一些时间。