I created a repository from existing files. Inside the set of files, was one with the name "español.gif". Now, everytime I do
$ git status
I receive an error:
$ path/espa�ol.gif: Protocol error
I tried removing the files using
$ 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
but, nothing changes, it keeps saying "Protocol error".
If I try a merge, I receive:
error: Your local changes to 'path/espa�ol.gif' would be overwritten by merge. Aborting.
Is there any way to remove the file from the index, and stop having this error?
Edit: I solved the problem deleting the Git repository and creating it again, without any file with an Spanish character in the name.
Edit: git does not mess with character encoding. This is still here to share knowlege and avoid others making the same mistake. The context: My enterprise uses an svn repository. I'm using git-svn as a client to interact with this repository. All text files in the project are (and must be) encoded with windows default encoding (cp-....).
However, Git stores the name of the commit encoding if the config key "i18n.commitEncoding" is set (and if it's not the default value "utf-8"). You can print its current value with the following command:
When using a CLI, you might have situations where a branch or tag name contains special characters that have a special meaning for your shell environment. To use these characters safely in a Git command, they must be quoted or escaped, otherwise the command may have unintended effects.
In that case, what's the best character set for encoding english, french, arabic and spanish at the same time ? Probably UTF-8 (which would be the AL32UTF8 or UTF8 character set depending on the Oracle version). That is a variable width character set, so one character will be stored in between 1 and 4 bytes.
This should solve the problem
git config core.quotepath false
From man git-config(1) for 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.
You could also use git clean
(probably git clean -d -f
but consult git manual first!) command to remove untracked files - this is the reason for error message "error: Your local changes ....".
Because of the encoding problems, Git probably already created a file with a bad filename and although the whole (pull/push?) operation was rejected, the already created file remained in the destination.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With