No more “Filename too long” using git on Windows
Hello, World! :)
If you are a developer, you certainly get this error sometimes:
This article will explain why we get this error when running a long git command line on Windows. Soooo, let’s begin.
What Happens?
By default, git has 4096 character of tolerance for a command line statement. But when we use Windows, the rules change, and this character count goes up to 260.
Get Gabriel Fidelles’s stories in your inbox
Join Medium for free to get updates from this writer.
This limitation happens because when git is run on Windows, it is compiled by “msys” an older Windows API than “msys2” , which “[…] is a collection of tools and libraries providing you with an easy-to-use environment for building, installing and running native Windows software” and this older version has this 260 character limitation.
Ok but, how to solve it?
You could use two different ways to solve this problem:
- Just download an alternative git client
- Enable longpaths in your git bash CLI
So, we will use this second solution because we are not lazy, right? XD
Let’s begin:
1. First you need to open your git bash as administrator. You can do this by right-clicking on the git bash shortcut:
2. When your git bash opens, run this command:
And that’s it! Now, try running your command line and don’t forget to tell me if this article helps you solve this problem.
See you soon! :)



