问题
I just got a new laptop and wanted to clone my universities git repository with pycharm
.
Whenever I try to clone the repository, using either Git bash/GUI or Pycharm, it fails with the error,
Filename in tree entry contains backslash: 'Aufgabe4a.py# coding=utf-8 ...
Within the error is the complete content of the mentioned file.
As this is the repo of my university, I can't just go and rename files that are not mine. The weird thing is, this doesn't happen on my desktop. I can clone the repo just fine on there.
- Both machines are running Windows 10 and the latest versions of Git/Pycharm.
- SSH is configured properly and I can't clone using HTTPS either.
I look forward to your suggestions, as I need this repo to hand in my exercises and don't always have access to my desktop.
Edit: There is not a single file in the repository containing a backslash in its name. I checked through the website and “working copy“, an iOS app to preview Git repos.
These are the results when debugging with Git on the laptop:
18:28:45.034704 exec-cmd.c:237 trace: resolved executable dir: C:/Program Files/Git/mingw64/bin
18:28:45.036676 git.c:439 trace: built-in: git clone git@*removed*.git
Cloning into 'uebungen'...
18:28:45.093121 run-command.c:663 trace: run_command: unset GIT_DIR; ssh git@*university URL* 'git-upload-pack '\''*university repo*'\'''
18:28:48.140893 run-command.c:663 trace: run_command: git index-pack --stdin -v --fix-thin '--keep=fetch-pack 8492 on DESKTOP-QNIF5QA' --check-self-contained-and-connected
18:28:48.155482 exec-cmd.c:237 trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
18:28:48.157663 trace.c:375 setup: git_dir: C:/Users/*removed*/uebungen/.git
18:28:48.157663 trace.c:376 setup: git_common_dir: C:/Users/*removed*/uebungen/.git
18:28:48.157663 trace.c:377 setup: worktree: C:/Users/*removed*
18:28:48.157663 trace.c:378 setup: cwd: C:/Users/*removed*
18:28:48.157663 trace.c:379 setup: prefix: (null)
18:28:48.158012 git.c:439 trace: built-in: git index-pack --stdin -v --fix-thin '--keep=fetch-pack 8492 on DESKTOP-QNIF5QA' --check-self-contained-and-connected
remote:
remote: Enumerating objects: 828, done.
remote:
(...)
remote: Counting objects: 100% (828/828), done.
remote:
(...)
remote:
remote: Compressing objects: 100% (380/380), done.
remote: Total 1184 (delta 490), reused 725 (delta 430)
error: filename in tree entry contains backslash: 'Aufgabe4a.py# coding=utf-8
import random #Liste für die Auswahlmöglichkeiten für den Rechner list = ["Schere", "Stein", "Papier"] #Eingabemöglichkeit für den Benutzer print("Versuchen Sie ihr Glück in Schere, Stein, Papier!") w = (raw_input("Bitte wählen sie Schere, Stein, oder Papier:")) # if w == "Schere": print("Sie haben Schere gewaehlt!\n") else: if w == "Stein": print("Sie haben Stein gewaehlt!\n") else: if w == "Papier": print("Sie haben Papier geweahlt!\n") else: print("Sie haben keine zugelassene Eingabe getaetigt!") exit() #Wahl des Rechners wird, sowie der Ausgang des Spiels entschieden x = list[random.randint(0, 2)] print("Ihr Gegner hat " + x + " gewaehlt!\n") if w == "Schere": if x == "Schere": print("Sie haben unentschieden gespielt!") else: if x == "Stein": print("Stein schleift Schere, Sie haben verloren!") else: if x == "Papier": print("Schere schneidet Papier, Sie haben gewonnen!") elif w == "Stein": if x == "Schere": print("Stein schleift Schere, Sie haben geweonnen!") elif x == "Stein": print("Sie haben unentschieden gespielt!") elif x == "Papier": print("Papier umfaltet Stein, Sie haben verloren!") elif w == "Papier": if x == "Schere": print("Schere schneidet Papier, Sie haben verloren!") elif x == "Papier": print("Sie haben unentschieden gespielt!") elif x == "Stein": print("Papier umfaltet Stein, Sie haben gewonnen!")'
fatal: Not all child objects of 9(...)c are reachable
fatal: index-pack failed
This is the debugging output on the desktop machine:
21:38:07.768170 exec-cmd.c:237 trace: resolved executable dir:C:/Program Files/Git/mingw64/bin
21:38:07.769170 git.c:440 trace: built-in: git clone git@*uni repo*.git
Cloning into 'uebungen'...
21:38:07.783173 run-command.c:663 trace: run_command: unset GIT_DIR; ssh git@*uni domain* 'git-upload-pack '\''*repo*.git'\'''
21:38:08.587244 run-command.c:663 trace: run_command: git index-pack --stdin -v --fix-thin '--keep=fetch-pack 14672 on Leo-PC' --check-self-contained-and-connected
21:38:08.602247 exec-cmd.c:237 trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
21:38:08.604247 trace.c:377 setup: git_dir: C:/Users/*removed*/uebungen/.git
21:38:08.604247 trace.c:378 setup: git_common_dir: C:/Users/*removed*/uebungen/.git
21:38:08.604247 trace.c:379 setup: worktree: C:/Users/*removed*
21:38:08.604247 trace.c:380 setup: cwd: C:/Users/*removed*
21:38:08.604247 trace.c:381 setup: prefix: (null)
21:38:08.604247 git.c:440 trace: built-in: git index-pack --stdin -v --fix-thin '--keep=fetch-pack 14672 on Leo-PC' --check-self-contained-and-connected
remote:
remote: Enumerating objects: 852, done.
(...) remote: Counting objects: 100% (852/852), done.
(...) remote: Compressing objects: 100% (373/373), done.
remote: Total 1208 (delta 508), reused 792 (delta 461)
Receiving objects: 100% (1208/1208), 6.24 MiB | 36.54 MiB/s, done.
Resolving deltas: 100% (680/680), done.
21:38:09.614724 run-command.c:663 trace: run_command: git rev-list --objects --stdin --not --all --quiet --alternate-refs '--progress=Checking connectivity'
21:38:09.628565 exec-cmd.c:237 trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
21:38:09.630566 trace.c:377 setup: git_dir: C:/Users/*removed*/uebungen/.git
21:38:09.630566 trace.c:378 setup: git_common_dir: C:/Users/*removed*/uebungen/.git
21:38:09.630566 trace.c:379 setup: worktree: C:/Users/*removed*
21:38:09.630566 trace.c:380 setup: cwd: C:/Users/*removed*
21:38:09.630566 trace.c:381 setup: prefix: (null)
21:38:09.630566 git.c:440 trace: built-in: git rev-list --objects --stdin --not --all --quiet --alternate-refs '--progress=Checking connectivity'
21:38:09.639568 chdir-notify.c:65 setup: chdir from 'C:/Users/*removed*' to 'C:/Users/*removed*/uebungen'
21:38:09.639568 chdir-notify.c:40 setup: reparent packed-refs to 'C:/Users/*removed*/uebungen/.git/packed-refs'
21:38:09.639568 chdir-notify.c:40 setup: reparent files-backend $GIT_DIR to 'C:/Users/*removed*/uebungen/.git'
21:38:09.639568 chdir-notify.c:40 setup: reparent files-backend $GIT_COMMONDIR to 'C:/Users/*removed*/uebungen/.git'
回答1:
There is an open issue on git-for-windows repository (for v2.24)
Git 2.24 breaks existing repositories: filename in tree entry contains backslash
The workaround as suggested by user carlescufi is to disable core.protectNTFS.
git config --global core.protectNTFS false
Quoting git docs here,
core.protectNTFS
If set to true, do not allow checkout of paths that would cause problems with the NTFS filesystem, e.g. conflict with 8.3 "short" names. Defaults to true on Windows, and false elsewhere.
回答2:
I've fixed the problem (for now), by downgrading to Git for Windows 2.23.0. The problem persists on the newest version and is reproducable on my desktop.
来源:https://stackoverflow.com/questions/59345571/pycharm-behaving-strange-with-git-filename-in-tree-entry-contains-backslash