git bash突然ssh不能用了

git bash 用着一直没有问题,今天突然提示:

bash 复制代码
The authenticity of host '192.168.0.1(192.168.0.1)' can't be established.
ED25519 key fingerprint is SHA256 .....

本地没有动过key,服务器上ssh key也没过期。

后来发现,vim也不能用了:

bash 复制代码
Vim: Warning: Output is not to a terminal
Vim: Warning: Input is not from a terminal

E1187: Failed to source defaults.vim
Press ENTER or type command to continue

再后来发现,cd /c/xxx/yyy 等是可以的,但ls /c/xxx/yyy 提示没有这个文件或目录。

mount一下,发现 C: mount到 /cygdrive/c 上了。没有截图,但原来是mount到/c上的。

正常的mount:

bash 复制代码
C:/Program Files/Git on / type ntfs (binary,noacl,auto)
C:/Program Files/Git/usr/bin on /bin type ntfs (binary,noacl,auto)
C:/Users/xxx/AppData/Local/Temp on /tmp type ntfs (binary,noacl,posix=0,usertemp)
C: on /c type ntfs (binary,noacl,posix=0,user,noumount,auto)
O: on /o type unknown (binary,noacl,posix=0,user,noumount,auto)

一通折腾,GitBash也装了好几遍,换了好几个版本。

怎么搞也没办法把C:\ 映射到 /c .

后来实在没辙了,先把ssh搞好吧,ssh key这个是根据HOME环境变量确定路径的,所以在Windows的设置添加一个用户环境变量 HOME, 值设为我在D盘上建立的一个目录:D:\GitHome。

然后把原来~(C:/Users/xxx)里的.ssh目录,.gitconfig 等文件,复制到D:\GitHome目录里。

在点击运行Bash就可以运行了,vim也好了, C:\也映射到/c上了。

初步判断,git bash可能访问(C:/Users/xxx)这个目录有问题,导致.ssh访问不到,vim也有配置文件访问不到,导致一系列问题。

还有个方案,可以修改 bash的快捷方式的属性,去掉"--cd-to-home", 然后加上命令设置HOME环境变量,再执行bash。

相关推荐
Serene_Dream1 小时前
git 合并冲突的分支
git
我是一只puppy2 小时前
使用AI进行代码审查
javascript·人工智能·git·安全·源代码管理
玄同7653 小时前
Git常用命令指南
大数据·git·elasticsearch·gitee·github·团队开发·远程工作
野指针YZZ3 小时前
一键配置RK3588网络与SSH远程连接
网络·ssh·rk3588
十步杀一人_千里不留行6 小时前
Git提交前ESLint校验实践(Husky + lint-staged)
git·github
logocode_li8 小时前
说透 Linux Shell:命令与语法的底层执行逻辑
linux·运维·ssh
猫头虎8 小时前
OpenClaw-VSCode:在 VS Code 里玩转 OpenClaw,远程管理+SSH 双剑合璧
ide·vscode·开源·ssh·github·aigc·ai编程
dingdingfish8 小时前
Bash学习 - 第3章:Basic Shell Features,第5节:Shell Expansions
开发语言·学习·bash
hh随便起个名9 小时前
适合小白的git的基础使用方法
git
我会一直在的9 小时前
Devps持续集成
git·ci/cd