我正在使用Windows作为我的操作系统,并与一位正在使用Mac的朋友一起开展项目.他在我们的Github上签了代码.
我试图git拉他所做的一切,并在第三方代码的"文件名太长"错误中止.
我能做什么?
mlo*_*kot 194
关于Git的msysgit FAQ 无法创建一个长路径的目录,似乎不是最新的,因为它仍然链接到旧的msysgit 票#110.但是,根据后来的#122票,问题已在msysgit 1.9中修复,因此:
git config core.longpaths true到目前为止,它对我很有用.
请注意对机票#122发表评论的重要通知
不要回到这里抱怨它破坏了Windows资源管理器,cmd.exe,bash或你正在使用的任何工具.
Dan*_*ári 65
Solution1 - 通过运行此命令设置全局配置:
git config --system core.longpaths true
Run Code Online (Sandbox Code Playgroud)
Solution2 - 或者您可以直接编辑您的特定git配置文件,如下所示:
YourRepoFolder - > .git - > config:
[core]
repositoryformatversion = 0
filemode = false
...
longpaths = true <-- (add this line under core section)
Run Code Online (Sandbox Code Playgroud)
解决方案3 - 克隆新存储库时:此处.
xan*_*key 23
迟了几年,但我想补充说,如果你需要一举这样做(就像我一样)你可以在克隆命令中设置配置设置.试试这个:
git clone -c core.longpaths=true <your.url.here>
小智 12
打开your.gitconfig文件以添加longpaths属性.所以它看起来如下:
[core]
symlinks = false
autocrlf = true
longpaths = true
Run Code Online (Sandbox Code Playgroud)
正如有人已经在Windows上的Java库就遇到了这个问题不断,最好的解决办法是安装Cygwin(https://www.cygwin.com/),并在所有> devel的> git的使用它的git的安装.
这是我遇到的最佳解决方案的原因是因为Cygwin管理长路径名称所以其他提供的命令受益.例如:find,cp和rm.相信我,当您必须删除Windows中太长的路径名时,真正的问题就开始了.
小智 5
尽量让您的文件靠近文件系统根目录。更多细节:由于技术原因,当绝对路径超过 260 个字符时,Git for Windows 无法创建文件或目录。
在 Windows 上以管理员身份运行“cmd”并执行命令。
"C:\Program Files\Git\mingw64\etc>"
"git config --system core.longpaths true"
Run Code Online (Sandbox Code Playgroud)
或者你必须为安装了 git 的文件夹 chmod。
或 manullay 通过转到路径“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**
Run Code Online (Sandbox Code Playgroud)