How did I do?*

File name too long

Handling files in Windows or Git where the path and file name exceed the maximum default length

Introduction

If you're experiencing problems opening or creating directories, or with common Git commands like push, stage, delete etc. where the error message is something along the lines of "file name too long", the simplest solution is to reduce the directory nesting path to the file and/or the file name itself, however this is always the appropriate solution. Windows and Git apply default character limits, but this configuration can be changed when needed.

Enable long paths in Windows

  1. 🪟 + R
  2. gpedit.msc
  3. CTRL + SHIFT + RETURN (to run as admin)
  4. Computer Configuration > Administrative Templates > System > Filesystem
  5. Enable Win32 long paths
  6. Enable > Apply > OK (may need a reboot)

Enable long paths in Git

  1. Ensure no other processes are using Git (e.g. an open IDE such as Visual Studio etc.)
  2. Open a PowerShell terminal (might need to be as admin)
git config --system core.longpaths true