2

On Windows when I try to clone a repository which contains files with long paths (e.g. this repository) it fails:
Git error

My question is not how to solve this (that is already answered here), but about the command it recommends:

git restore --source=HEAD :/

When I run git config core.longpaths true followed by that command it has no effect: The command takes a while but afterwards git status still reports a lot of changes.

However, running git reset --hard works without issues and properly checks out the files.

So is Git's advice of using git restore incorrect (at least in this context)?


Git version: 2.33.0.windows.2

Marcono1234
  • 5,856
  • 1
  • 25
  • 43

1 Answers1

1

When I run git config core.longpaths true followed by [the recommended git restore] command it has no effect: The command takes a while but afterwards git status still reports a lot of changes. However, running git reset --hard works without issues and properly checks out the files.

This implies a bug in Git-for-Windows. The bug might be quite difficult to fix (basically Git has no idea how core.longpaths was set on an earlier attempt), but you should report it.

You can try git restore --source=HEAD -SW :/, which makes the action match git reset --hard internally, and see if that works. If it does, perhaps the fix will be to change the default advice here. :-)

torek
  • 448,244
  • 59
  • 642
  • 775