我从现有文件创建了一个存储库。在这组文件中,有一个名为“español.gif”的文件。现在,每次我这样做
$ git status
我收到一个错误:
$ path/espa�ol.gif: Protocol error
我尝试使用
删除文件$ git rm path/espa�ol.gif
$ git rm --cached path/espa�ol.gif
$ git rm path/espa?ol.gif
$ git rm --cached path/espa?ol.gif
但是,没有任何变化,它一直说“协议(protocol)错误”。
如果我尝试 merge ,我会收到:
error: Your local changes to 'path/espa�ol.gif' would be overwritten by merge. Aborting.
有什么方法可以从索引中删除文件,并不再出现此错误?
编辑:我解决了删除 Git 存储库并重新创建它的问题,没有任何名称中包含西类牙字符的文件。
最佳答案
这应该可以解决问题
git config core.quotepath false
来自 man git-config(1)对于 core.quotepath:
The commands that output paths (e.g. ls-files, diff), when not given the -z option, will quote “unusual” characters in the pathname by enclosing the pathname in a double-quote pair and with backslashes the same way strings in C source code are quoted. If this variable is set to false, the bytes higher than 0×80 are not quoted but output as verbatim. Note that double quote, backslash and control characters are always quoted without -z regardless of the setting of this variable.
关于带有西类牙字符的 Git 字符编码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7113849/