windows下git clone时出现“Filename too long”错误的解决办法

在windows下,当使用git clone复制项目时,出现下述错误表示项目中有文件民字符过长的问题,需要开启git的长路径支持解决:

bash 复制代码
fatal: cannot create directory at 'xxxx': Filename too long
warning: Clone succeeded, but checkout failed.
You can inspect what was checked out with 'git status'
and retry with 'git restore --source=HEAD :/'

方法如下:

  1. 使用管理员模式运行git

  2. 设置系统变量为长路劲有效:

    git config --system core.longpaths true

Note: 如果第二步还是报错,可以设置git全局变量的长路径有效:

复制代码
git config --global core.longpaths true

更多git的 git config设置方式 点击这里查看.

相关推荐
言之。8 小时前
Git Hooks
git
代码AI弗森9 小时前
Git Bash 与 PowerShell:定位差异、使用场景与选择建议
开发语言·git·bash
森叶10 小时前
Git flow command error: ‘flow‘ is not a git command 问题解决
git
天麓12 小时前
git merge 举例
git
AI_567813 小时前
Git冲突治理白皮书:智能标记与可视化协同的下一代解决方案
大数据·人工智能·git·机器学习
念丶小宇13 小时前
Git常用指令
大数据·git·elasticsearch
CSDN_RTKLIB14 小时前
Git Clone
git
中二病码农不会遇见C++学姐14 小时前
.env 文件是干啥的?为什么不能提交到 Git?
git·学习
CoderJia程序员甲15 小时前
GitHub 热榜项目 - 日榜(2026-02-03)
git·ai·开源·llm·github
宴之敖者、15 小时前
Linux——git和gdb
linux·运维·git