Git Windows Solution: Git checkout fails in windows OS

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.

Problem

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.

Solution

The Solution of this problem is quite easy. Just add below line in your favourite console.

git config --system core.longpaths true
Advertisements


Categories: Git

Tags: ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.