14

error: invalid path xxx fatal: Could not reset index file to revision ‘HEAD’.

 3 years ago
source link: http://i.lckiss.com/?p=7384
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

error: invalid path xxx fatal: Could not reset index file to revision ‘HEAD’.

2021-08-06

今天在 windows 上拉代码,没想到遇到了这么一个错:

error: invalid path xxx
fatal: Could not reset index file to revision 'HEAD'.

当然,xxx 代表一个文件路径,这个项目在 mac 以及 linux 上都不会出现这么离谱的错误,但 windows 就是这么争气,主要原因是这个:

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.

简单来说,就是 windows 用的磁盘格式NTFS 不支持一些短名称,通俗点讲就是一些特殊的文件名会导致 NTFS 磁盘出错。但我尝试命名同样的文件名后,并没出现错误,说明或许这只是一个正则匹配罢了,离谱。

关掉即可:

git config core.protectNTFS false

参考:https://git-scm.com/docs/git-config#Documentation/git-config.txt-coreprotectNTFS


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK