简体   繁体   English

git pull 对太长的文件名不起作用

[英]git pull does not work for too long file name

I did a commit (with Git) & push (to GitHub) 2 pdf files with a bit long names on my Windows 7 machine and then tried to pull those onto my Linux Mint machine, but got this error:我在我的Windows 7机器上做了一个提交(使用 Git)并推送(到 GitHub)2 个名称有点长的 pdf 文件,然后尝试将它们拉到我的Linux Mint机器上,但得到了这个错误:

Updating 1453916..ffdfabc
error: cannot stat 'long-file-name-1.pdf': File name too long
error: cannot stat 'long-file-name-2.pdf': File name too long

How can I have those 2 files on my Linux Machine without losing the names and/or the files?如何在我的 Linux 机器上拥有这 2 个文件而不会丢失名称和/或文件?

If you're NOT using encrypted home, as suggested by @phd, then you're most likely encountering a limitation of Linux that does not exist in Git.如果您没有按照@phd 的建议使用加密的 home,那么您很可能会遇到 Git 中不存在的 Linux 限制。

Most Linux kernels are compiled with NAME_MAX=255 (see here ).大多数 Linux 内核是使用NAME_MAX=255编译的(请参阅此处)。 Which means that file names cannot take more than 255 bytes.这意味着文件名不能超过 255 个字节。 If you're using non-ASCII Unicode characters, than you have even less than 255 characters.如果您使用的是非 ASCII Unicode 字符,那么您的字符数甚至少于 255 个。

In Windows the limit is bigger than 255 bytes, which is why you're able to create these files in Windows.在 Windows 中,限制大于 255 字节,这就是您能够在 Windows 中创建这些文件的原因。

If you want it to work on Linux, you need to rename them in Windows to something that is 255 bytes (bytes, not characters!) or less.如果你想让它在 Linux 上工作,你需要在 Windows 中将它们重命名为 255 字节(字节,而不是字符!)或更小。

If you intend to check out those revisions, you'll need to do some history rewrite .如果您打算查看这些修订版,则需要进行一些历史重写

There are much crazier alternatives like re-compiling the kernel with a different NAME_MAX , don't go there if you don't absolutely have to.有很多更疯狂的选择,比如用不同的NAME_MAX重新编译内核,如果你不是绝对必须的话,不要去那里。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM