git lfs签出在具有Unicode路径“ Error:CreateFile”的Windows上失败

问题描述

我已经为Windows正确安装了git。打电话

git lfs checkout

在包含特殊字符(C:\ Users \ myUser \öäüü)的路径上使用bash.exe失败,并出现错误:

Error: CreateFile C:\Users\myUser\���: The system cannot find the file specified.

我尝试将GitKraken的LFS文件检出到相同的目录,但失败并出现相同的错误(我也看到GitKraken也调用bash.exe)。当使用git-bash.exe时,我无法重现该错误。两个终端都是MINGW64,即bash.exe打印的语言环境

$ locale
LANG=
LC_CTYPE="C.UTF-8"
LC_NUMERIC="C.UTF-8"
LC_TIME="C.UTF-8"
LC_COLLATE="C.UTF-8"
LC_MONETARY="C.UTF-8"
LC_MESSAGES="C.UTF-8"
LC_ALL=

而git-bash.exe则输出en_GB.UTF-8。我也尝试过这样设置

MSYSTEM=MINGW64

但是不幸的是,这根本没有帮助。 在Mingw-w64模式下使用/ usr / bin / mintty会启动功能正常的bash,我也无法重现该问题。因此,我想知道如何配置bash.exe以使其正常运行,我觉得必须有某种方法可以实现。

编辑: git lfs版本打印

git-lfs/2.12.0 (GitHub; windows amd64; go 1.15.1)

通过GIT_TRACE = 1打印git lfs checkout:

$ GIT_TRACE=1 git lfs checkout
14:12:20.043934 exec-cmd.c:237          trace: resolved executable dir: C:/Program Files/Git/mingw64/bin
14:12:20.059555 git.c:704               trace: exec: git-lfs checkout
14:12:20.059555 run-command.c:663       trace: run_command: git-lfs checkout
14:12:20.079718 trace git-lfs: exec: git 'version'
14:12:20.109504 trace git-lfs: exec: git '-c' 'filter.lfs.smudge=' '-c' 'filter.lfs.clean=' '-c' 'filter.lfs.process=' '-c' 'filter.lfs.required=false' 'rev-parse' '--git-dir' '--show-toplevel'
14:12:20.132914 trace git-lfs: exec: uname
14:12:20.189343 trace git-lfs: exec: cygpath '-w' '.git'
14:12:20.208415 trace git-lfs: exec: cygpath '-w' 'C:/Users/myUser/äöü'
14:12:20.243879 trace git-lfs: Error running 'git rev-parse': CreateFile C:\Users\myUser\���: The system cannot find the file specified.
Error: CreateFile C:\Users\myUser\���: The system cannot find the file specified.
...

解决方法

@ bk2204能够在git-lfs内核中对其进行修复,请参见:https://github.com/git-lfs/git-lfs/issues/4227

作为解决方法设置

LC_ALL=C.UTF-8

为我解决了这个问题。

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...