git remove file with umlaut

git remove file with umlaut

I recently updated from git 1.7.7.1 to git 1.8.3, and now I experience problems with files that contain umlauts in their names. When I try to remove them, I get the error

fatal: pathspec 'Tiefkühl_Buttons_60px.gif' did not match any files

In the file system the file exists with this name, in git-bash it is listed as "Tiefk\374hl_Buttons_60px.gif", in my Git-Frontent (SmartGit 4.5) it appreas as Tiefk�hl_Buttons_60px.gif.

When using the git-bash, I cannot delete this file, because I cannot type a ü character (simply doesn't work). When I try to use the escaped octet (\374) it is interpreted as path-segment (Tiefk/374l_Buttons_60px.gif)

When using the normal commandline (cmd.exe) and invoking the git.exe, I get the error

Warning: Your console font probably doesn't support Unicode. If you experience  
strange characters in the output, consider switching to a TrueType font such as 
Lucida Console!

Switching the font leads again to the first error.

I tried to invoke the command through a BAT-File stored as ANSI (with 0xFC as the code for ü) and UTF-8, still no success.

I also tried to call git add -u . to add the file to the index and remove it later, but that simply doesn't add it

Is there any other option to remove a file from git?

答案1

Ok, I found a way that is working...

I didn't remove the single file, but the whole containing folder from the cache, using

git rm --cache -r Katalog

Afterwards, I unstaged the remove from all files but the offending one, so that they won't be deleted, and added the file with the correct name (with correct umlaut).

After commit, everything was normal again

答案2

that was probaply more than you had to do... I had the same problem with my files and folders. In my Project I have a directory that contains all the flow charts that is named

Abläufe

in my exclude I had line with

Abläufe\ . After updating to version 1.9x from git Abläufe was listet as an untracked file. Obviously exclude didn't work anymore. The solution and the reason for this behaviour is that the exclude files was created in ASCII I simply opend the exclude file in notepad++ and recoded it to utf8 unicode and saved the file... and voila problem solved

相关内容