一、概述:
最近公司组织病毒扫描,不知道是不是扫描误删了我电脑的系统文件,导致git在电脑重启后就异常,idea的git功能无法正常使用,重新安装提示如下截图的异常:
Git 2.45.2 Setup
Unable to set system config"diff.astextplain.textcony":="astextplain": exit code 128
stderr:
fatal: could not open '/dev/null' for reading and writing: No such fileor directory
----------
×Git 2.45.2 SetupLine 3398: Could not reconfigure Scalar enlistments (output: , errors:fatal: could not open '/dev/null' for reading and writing: No such fileor directory, exit code: 128).
还有很多类似的,就不一一截图了。
二、解决方法:
大概原因是系统的null.sys文件丢失或者损坏,
1.修改注册表:HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\Null
2.从其他电脑win10系统复制一份null.sys文件,先删除自己系统的,再粘贴进去
路径:C:\Windows\System32\drivers\null.sys
注意:先验证系统文件是否可用:打开cmd窗口,执行如下命令:
sc stop null -- 停止服务
sc start null -- 启动服务
sc query null -- 查询服务状态
sfc /scannow -- 修复文件
重点:请参考上面地址的文章,我也是从这篇文章取经的!!!