不知道是什么原因造成的...
系统:OSX 10.9.2
Shell:在tmux中与oh-my-zsh一起使用zsh
> echo $HOME
/Users/xxmplus
> echo ~
/Users/xxmplus
> echo ~xxmplus
/home/xxmplus
这很烦人,因为我的ssh无法正常工作...
> ssh -T xxmplus@github.com
Could not create directory '/home/xxmplus/.ssh'.
The authenticity of host 'github.com (192.30.252.129)' can't be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)? yes
Failed to add the host to the list of known hosts (/home/xxmplus/.ssh/known_hosts).
Hi xxmplus! You've successfully authenticated, but GitHub does not provide shell access.
有什么建议么?谢谢!
最佳答案
最可能的原因是用户数据库中定义的主目录与您的配置文件和登录脚本设置为$HOME
的目录不同。
至于,
> echo $HOME
/Users/xxmplus
> echo ~
/Users/xxmplus
上面严格按照规范,一个独立的
~
在POSIX中被简单地定义为$ HOME,因此证明很少。但这是不同的:
> echo ~xxmplus
/home/xxmplus
规格说明如下:
... the tilde-prefix shall be replaced by a pathname of the initial working directory associated with the login name obtained using the getpwnam() ... If the system does not recognize the login name, the results are undefined
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_01
因此,另一个不太可能的选择是您遇到了规范的未定义行为部分–可能是在包装盒上无法识别登录名(xxmplus)的情况下,特别是无法使用getpwnam()获得登录名,但是更简单的解释是它在那里,您只需要在用户数据库中更改主目录即可。
关于git - zsh波浪号(〜)在OS X上的扩展方式不同,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22700025/