【发布时间】:2020-07-18 05:36:50
【问题描述】:
我目前正在使用带有 Windows 的 Git Bash 来通过 SSH 连接到 Linux 服务器。
正在使用目录中的配置文件:“C:\Users\FirstName LastName.ssh\config”
配置文件如下所示:
Host hub
HostName 192.168.1.151
User root
IdentityFile C:\Users\FirstName LastName\.ssh\hub
如您所见,IdentityFile 中的 Firstname 和 LastName 之间有一个空格字符。这导致 Git Bash 无法读取指定的路径。它打印出这个错误:/c/Users/FirstName LastName/.ssh/config line 4: garbage at end of line; "LastName\\.ssh\\hub".
我尝试使用引号指定字符串,并尝试在 IdentityFile 路径中使用 %USERPROFILE% 变量,因此没有空格。
带引号的解决方案导致这个错误:
no such identity: \342\200\252\342\200\252\342\200\252\342\200\252C:\\Users\\FirstName LastName\.ssh\\hub: No such file or directory
然后问我密码:
root@192.168.1.151's password:
%USERPROFILE% 的解决方案给了我这个错误:
percent_expand: unknown key %U
所以我基本上被困在这里,关于如何解决这个问题的任何想法?
【问题讨论】:
标签: windows ssh path config git-bash