多git账号配置后报错Bad configuration option

来源:互联网 发布:西班牙海鲜饭 知乎 编辑:程序博客网 时间:2024/06/13 06:32

这里写图片描述
在config里配了两个host对应的账号,结果使用其中一个账号时控制台报如图所示的错

问题原因

~/.ssh/config文件缩进有问题

解决方案

检查该配置文件,把每一行配置前的空格都去掉

需要注意的是,如果config文件中只配置一个host对应的账号的话,缩进是无所谓的,都可以正常使用。但是有多个配置的话,配在后面的账号就会受影响。所以都修改一下,不要有空格。

附~/.ssh/config文件例子

# userName1(email1@xxx.com)Host host1HostName host1PreferredAuthentications publickeyIdentityFile ~/.ssh/id_rsa_userName1User userName1# userName2(email2@xxx.com)Host host2HostName host2PreferredAuthentications publickeyIdentityFile ~/.ssh/id_rsa_userName2User userName2
原创粉丝点击