在Cygwin中,ssh使用错误的主目录

$ ssh [email protected] Could not create directory'/cygdrive/c/Documents and Settings/vidar kongsli/.ssh'. The authenticity of host 'login.somehost.no (...)' can't be established. RSA key fingerprint is .... Are you sure you want to continue connecting (yes/no)? no Host key verification failed. $ set | grep HOME HOME=/cygdrive/d/home/vidar HOMEDRIVE=C: HOMEPATH=/cygdrive/d/home/vidar $ ls ~/.ssh id_rsa id_rsa.pub 

任何想法,当它试图find〜/ .ssh时,为什么ssh不使用$ HOME环境variables?

(编辑:固定格式)

看看/etc/passwd 。 确保那里的条目符合您预期的主目录。 这是用户input的第二个字段。

如果你的$HOMEvariables被设置了,但是ssh不能识别它,把这行放到/etc/nsswitch.conf

 db_home: /%H 

这将设置Cygwin主目录而不需要/ etc / passwd文件存在。

variablesHOME是否已导出? 尝试: export HOME然后再次ssh

/etc/nsswitch.conf中的db_home设置为您家的path。 这是MSYS2 推荐的方法。

添加一个HOME环境variables也适用 。

Git-for-Windows在db_home包含env ,它应该读取你的HOME bashvariables,但是它不可靠 。