微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

如何解决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

为我解决了这个问题。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。