gpt4 book ai didi

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

转载 作者:IT王子 更新时间:2023-10-29 01:23:05 26 4
gpt4 key购买 nike

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

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com