Windows 10 / Git SSH Could not create directory ‘/home/DELL/.ssh‘.报错解决

Windows 10 下 Git 使用 SSH Could not create directory ‘/home/DELL/.ssh’.报错解决

课程需要使用ssh连接,提交公钥后尝试连接,报错如下:
在这里插入图片描述
一开始以为是公钥没有被添加,仔细观察报错信息后发现:最先的报错是
Could not create directory '/home/DELL/.ssh'
开始解决报错问题。
发现:https://stackoverflow.com/questions/36011084/could-not-create-directory-home-username-ssh
里面说是目录问题: ssh是Linux文件系统路径模式,Windows系统不存在 / home 的路径,需要设置环境变量,但设置了HOME变量后并没有什么用。

之后看到链接: OpenSSH for Windows 提示 “Could not create directory ‘/home/username/.ssh’.”.
这个作者是用OpenSSH出现了这个问题,通过构建了/home/目录解决了这个问题。
然后我也尝试迁移他的做法,在GIT目录下构造了‘/home/username/.ssh’目录,一开始我是在命令行使用的ssh连接,因为我是在GIT目录下构造的,所以我打开了 GIT BASH,进行连接,发现:
在这里插入图片描述
使用GIT BASH 路径是不一样的,于是迁移.ssh 目录到/c/Users 路径下
重新运行,成功。

猜你喜欢

转载自blog.csdn.net/m0_54352040/article/details/120323404
今日推荐