Let’s Talk

We would love to hear from you. Want to know more about
our services or have any questions? Say Hi!

How to solve the GitHub Long-path Error?

November 03, 2023
How to solve the GitHub Long-path Error?
Juanita Xavier
Juanita Xavier
Project Manager
how-to-solve-the-gitHub-long-path-error

While dealing with YML files that are created by Sitecore,

I faced one error that said the File name was too long when I tried to push my change to the origin of the branch in GitHub.

The "GitHub Long-path Error" typically occurs when you're trying to work with files or directories in a Git repository, and the file path exceeds the maximum path length allowed by the Windows operating system. This issue is commonly encountered on Windows systems due to Windows' historical limitation on file paths, which is 260 characters.

how-to-solve-the-gitHub-long-path-error-1

when Git is compiled with msys. It uses an older version of the Windows API and there's a limit of 260 characters for a filename.

But Git has a limit of 4096 characters for a filename, to enable this we need to add

“longpaths = true” in the config file of our repo’s git configuration file which then allows us to use the character limit of 4096 for the file name.

File location: (Repository name)\.git\config

how-to-solve-the-gitHub-long-path-error-2

We need to add this line in the [core] section and save the config file.

Now when you reopen the GitHub error should be gone. We can now successfully commit and push the files into the branch (Origin).

Git should now handle long file paths on Windows without triggering the GitHub Long-path Error. This configuration change allows Git to work with file paths longer than the traditional Windows limit.


YOU MAY ALSO LIKE