我正在使用Windows作为我的操作系统,并与一位使用Mac的朋友合作完成一个项目。他将代码检入了我们的Github。
我试图git pull他所做的所有事情,但在处理第三方代码时出现了“文件名太长”的错误。
我该怎么办?
我试图git pull他所做的所有事情,但在处理第三方代码时出现了“文件名太长”的错误。
我该怎么办?
msysgit FAQ中关于Git无法创建长路径的文件/目录的问题似乎不是最新的,因为它仍然链接到旧版msysgit 票证#110。但是,根据稍后的票证#122,该问题已在msysgit 1.9中得到解决,因此:
git config core.longpaths true
启用长路径支持到目前为止,这对我非常有效。
请注意票证#122的评论中的重要提示。
“不要回来抱怨它会破坏Windows资源管理器、cmd.exe、bash或其他你正在使用的工具。”解决方案1 - 运行以下命令设置全局配置:
git config --system core.longpaths true
解决方案2 - 或者你可以像下面这样直接编辑你特定的git配置文件:
YourRepoFolder -> .git -> config:
[core]
repositoryformatversion = 0
filemode = false
...
longpaths = true <-- (add this line under core section)
Solution3 - 克隆新存储库时:这里。
git clone -c core.longpaths=true <your.url.here>
git submodule
不起作用。 我无法将此配置传递给 git submodule
,例如: git submodule update -c core.longpaths=true
。 - Ruki Wang[core]
symlinks = false
autocrlf = true
longpaths = true
"C:\Program Files\Git\mingw64\etc>"
"git config --system core.longpaths true"
或者您需要对安装git的文件夹进行chmod操作。
或者手动更新文件,方法是进入路径 "Git\mingw64\etc"。
[http]
sslBackend = schannel
[diff "astextplain"]
textconv = astextplain
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
required = true
[credential]
helper = manager
**[core]
longpaths = true**
尽量将您的文件保存在文件系统的根目录附近。更多细节:出于技术原因,Git for Windows在绝对路径超过260个字符时无法创建文件或目录。
\\?\\
前缀。 - phuclv