git错误invalid path解决方法

在windows上git clone代码时报错:error: invalid path ‘xxxx’

解决方法:

1
git config core.protectNTFS false

参数说明:

1
2
core.protectNTFS
If set to true, do not allow checkout of paths that would cause problems with the NTFS filesystem, e.g. conflict with 8.3 "short" names. Defaults to true on Windows, and false elsewhere.

git文件名过长错误解决方法

git使用过程中,出现error: unable to create file xxx: Filename too long Updated 0 paths from the index

原因是windows的git版本中如果是文件名太长了,git会报错

解决方法:

1
2
3
4
5
# 选其一
# 全局设置
git config --global core.longpaths true
# 当前项目设置
git config core.longpaths true

windows下缺失fcntl报错

windows下运行python项目,报错ModuleNotFoundError: No module named 'fcntl'

fcntl库是linix的Python发行版才有,windows没有带

方法一

pip安装缺失的包,这个地址去搜索https://libraries.io/search?q=micropython

1
pip install micropython-xxx

仓库地址:https://github.com/micropython/micropython

方法二

在python库文件目录D:\Python\Python38\Lib\site-packages中创建’fcnty文件,内容为:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
def fcntl(fd, op, arg=0):
return 0

def ioctl(fd, op, arg=0, mutable_flag=True):
if mutable_flag:
return 0
else:
return ""

def flock(fd, op):
return

def lockf(fd, operation, length=0, start=0, whence=0):
return

windows子系统目录位置

方式一

打开我的电脑,在地址栏输入\\wsl$,确定之后就看到所有的子系统了

方式二

安装的地址路径为

1
2
3
C:\Users\用户\AppData\Local\Packages\对应的子系统\LocalState
# 例如
C:\Users\用户\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState

windows家庭版安装hyper-v

新建bat文件hyper-v.bat,内容为

1
2
3
4
5
6
7
8
9
pushd "%~dp0"

dir /b %SystemRoot%\servicing\Packages\*Hyper-V*.mum >hyper-v.txt

for /f %%i in ('findstr /i . hyper-v.txt 2^>nul') do dism /online /norestart /add-package:"%SystemRoot%\servicing\Packages\%%i"

del hyper-v.txt

Dism /online /enable-feature /featurename:Microsoft-Hyper-V-All /LimitAccess /ALL

以管理员身份执行hyper-v.bat,然后等待安装,需要确认的都选择y