Git checkout fails in window OS and error is “filename too long”
Git checkout is a very normal process & developers do not face many issues however, if there are some limitation in the tool or OS then it could be a problematic. In this post, would like to description of the git checkout branch issue in Windows OS.
In windows OS, While checkout branch, Git console may throw an exception that checkout is failed because “fileName is too long”.
It may appear weird but don’t worry too much & don’t even try to use multiple tools (CMS, Git bash, Source Tree etc) to execute same command and hope that might work.
Actually, the problem is somewhere else and It is interesting to know that Windows OS does not support files & directories more than 260 characters and that is why Git throws such exception.
The Solution of this problem is quite easy. Just add below line in your favourite console.
git config --system core.longpaths true