尝试使用在Linux上开发的项目在Windows 10中进行开发。代码存储在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
绝对不是长路径(较长的文件名已签出,并且我已移动目录以缩短总长度):
→ git config --system -l
...
core.longpaths=true
此外,它在出错之前在该目录中写入了其他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
(顺便说一句,这在Windows版Git,TortoiseGit上以及尝试通过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.
尽我所能,这对于Windows编写文件的Git肯定是有用的,但是我不知道是什么。
这是更多信息:通过WSL / Ubuntu签出后,我转到该目录并做了一个git status
。这表明:
→ 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")
但是,该文件在那里:
→ ls -1 test/template/
total 14
'Complex Testing Scenario.template'
create_from_template.py
PRN.template
Scheduled.template
但是,从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将无法检出路径或名称与另一文件相似的文件(大小写不同)。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句