Git filename too long in Windows MINGW / Git Bash

We had some source code downloaded from internet and which was developed on Windows. We wanted to make sure we add this code to git so we track the further modification we do in it. So, after extraction and trying to do “git add” command, we received an error as below,

$ git add .

warning: could not open directory 'VERY_LONG_FILE_PATH' : Filename too long

fatal: adding files failed

So, adding files to git didn’t succeed. As we wanted to track this code with git any way, so we searched and found solution.

Note: This error is only visible on Windows Git clients such as MINGW or Git Bash.

Solution :

Type below command before doing git add,

$ git config --system core.longpaths true

Now, if you do “git add”

$ git add .

You will not see this error. Enjoy !

Leave a Comment