带有西类牙字符的 Git 字符编码

标签 git encoding filenames character

我从现有文件创建了一个存储库。在这组文件中,有一个名为“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/

相关文章:

git - Jenkins 在 github probject 中访问 msbuild 文件

Git:使用 git hook 将回车符\r 转换为新行\n?

git:仅列出为所有存储修改的文件

java - 检查下划线是否包含任何有效的 Windows 文件名字符(下划线和 csv 扩展名除外)

windows - 递归重命名子文件夹中的文件 Windows 批处理文件

bash - 如何在 bash 脚本中验证文件名?

Git show vs Git log --numstat 输出差异

java - 如何为某个 Web 应用程序配置 URIEncoding?

html - delphi html解码

encoding - GUID 有多少个字符?