What can I do when git runs into a long filename error?
By default on Windows, git has a filename limit of 260. This can be increased in many cases
Filenames >260 characters are not too long for Windows. Rather, they are too long for git for Windows, as described below:
Simple answer: https://gitforwindows.org/git-cannot-create-a-file-or-directory-with-a-long-path.html
Detailed answer: https://stackoverflow.com/questions/22575662/filename-too-long-in-git-for-windows
We recommend thoroughly reading the StackOverflow post for its description of the tradeoffs (and Registry keys, etc). However, the summarized version is to try the below:
-
Open the Windows Registry Editor and check the value of the key
HKLM\SYSTEM\CurrentControlSet\Control\FileSystem\LongPathsEnabled -
If the value of the key is
0, set it to1. (This may require admin rights) -
In Copia Desktop, Repository > Open Command Prompt
-
git config core.longpaths true -
Retry the problematic file
a. If the above causes problems,git config core.longpaths falseto revert it.b. If the above helps,
git config --global core.longpaths trueto set it for all repositories.