git签出(Windows 10/mingw64)错误,带有;没有这样的文件或目录;

git签出(Windows 10/mingw64)错误,带有;没有这样的文件或目录;,windows,git,Windows,Git,尝试在Windows 10中开发一个在Linux上开发的项目。代码存储在GitLab中,我在多个存储库中看到以下错误。使用git版本2.15.1.windows.2 下面是一个例子: → git pull remote: Counting objects: 5, done. remote: Compressing objects: 100% (5/5), done. remote: Total 5 (delta 0), reused 0 (delta 0) Unpacking objects:

尝试在Windows 10中开发一个在Linux上开发的项目。代码存储在GitLab中,我在多个存储库中看到以下错误。使用git版本2.15.1.windows.2

下面是一个例子:

→ git pull
remote: Counting objects: 5, done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 5 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (5/5), done.
From myurl:project/master
   c23fc916..6dd18de8  master     -> origin/master
error: unable to create file test/template/PRN.template: No such file or directory
Updating c23fc916..6dd18de8
绝对不是长路径(签出的文件名更长,我移动了目录以缩短总长度):

此外,它在出错之前在该目录中写入了3个其他文件:

→ ls -1 test/template/
'Complex Testing Scenario.template'
create_from_template.py
Scheduled.template
如果我使用GIT_TRACE,我会看到:

→ GIT_TRACE=1 git pull
18:16:13.337044 git.c:344               trace: built-in: git 'pull'
18:16:13.342045 run-command.c:626       trace: run_command: 'fetch' '--update-head-ok'
18:16:13.355048 git.c:344               trace: built-in: git 'fetch' '--update-head-ok'
18:16:13.361063 run-command.c:626       trace: run_command: 'C:\ProgramData\chocolatey\bin\PLINK.EXE' 'git@xxxxxxx' 'git-upload-pack '\''xxxxxxx/master.git'\'''
18:16:19.820957 run-command.c:626       trace: run_command: 'rev-list' '--objects' '--stdin' '--not' '--all' '--quiet'
18:16:19.882937 run-command.c:626       trace: run_command: 'rev-list' '--objects' '--stdin' '--not' '--all' '--quiet'
18:16:19.897933 git.c:344               trace: built-in: git 'rev-list' '--objects' '--stdin' '--not' '--all' '--quiet'
18:16:19.976095 run-command.c:1452      run_processes_parallel: preparing to run up to 1 tasks
18:16:19.976095 run-command.c:1484      run_processes_parallel: done
18:16:19.976095 run-command.c:626       trace: run_command: 'gc' '--auto'
18:16:19.988095 git.c:344               trace: built-in: git 'gc' '--auto'
18:16:19.999065 run-command.c:626       trace: run_command: 'merge' 'FETCH_HEAD'
18:16:20.013068 git.c:344               trace: built-in: git 'merge' 'FETCH_HEAD'
error: unable to create file test/template/PRN.template: No such file or directory
Updating c23fc916..6dd18de8
(顺便说一句,这在Git for Windows、Ortoisegit和尝试通过IntelliJ克隆时都失败)

但是,如果我启动WSL/Ubuntu并将其签入我的主目录(因此在我的NTFS分区中),它工作正常:

 2018-01-17 19:49:25   DESKTOP-GPVE514 in /mnt/c/Users/mcrow/Programming
○ → git clone --branch master git@xxxxxxxxx/master.git
Cloning into 'master'...
remote: Counting objects: 24462, done.
remote: Compressing objects: 100% (108/108), done.
remote: Total 24462 (delta 115), reused 87 (delta 68)
Receiving objects: 100% (24462/24462), 277.43 MiB | 840.00 KiB/s, done.
Resolving deltas: 100% (17596/17596), done.
Checking connectivity... done.
Checking out files: 100% (2521/2521), done.
据我所知,这肯定是Git for Windows编写文件的原因,但我不知道是什么原因

这里有更多信息:在通过WSL/Ubuntu签出后,我去了那个目录,并做了一个
git状态
。这表明:

→ git status
On branch master
Your branch is up to date with 'origin/master'.

Changes not staged for commit:
  (use "git add/rm <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        deleted:    test/template/PRN.template

no changes added to commit (use "git add" and/or "git commit -a")
但是,从Windows来看,这仍然是一个问题:

→ git reset --hard HEAD
error: unable to create file test/template/PRN.template: No such file or directory
fatal: Could not reset index file to revision 'HEAD'.

如果这在Ubuntu上有效,但在Windows上无效,请仔细检查路径(父文件夹)或文件本身的大小写(大写/小写)


Windows将无法签出路径或名称与另一个路径或名称相似的文件,但情况不同。

我认为可能是这种情况,但我尝试在linux端修复它(重命名文件)。我最终不得不在windows端重命名该文件以完全解析它
→ ls -1 test/template/
total 14
'Complex Testing Scenario.template'
create_from_template.py
PRN.template
Scheduled.template
→ git reset --hard HEAD
error: unable to create file test/template/PRN.template: No such file or directory
fatal: Could not reset index file to revision 'HEAD'.