0

Whenever I try to pull or sync from git in visual studio, I get the error

The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.

Visual Studio Git commands - Path, file name length error

The local path where my repository is located : C:\Users\user3008\Documents\Projects\clientconsultancyservice\ClientConsultancyInterface

Both the .vs and .gitignore files are saved in the above directory. I never faced this issue in VS 2015 and have recently upgraded to VS2019.

What I have tried so far:

  1. Updating Visual Studio
  2. Updating GitHub Extension

Relevant Details:

Visual Studio 2019 Professional v16.4.5

GitHub Extension for Visual Studio v2.10.8.8132

4
  • Try moving the local repository folder to C:\GitSource directly instead of C:\Users\user3008\Documents\Projects\clientconsultancyservice\ClientConsultancyInterface. The error is due to limitation of filname in dos, it has nothing to do with VS or GIt. Commented Feb 14, 2020 at 10:39
  • @stud3nt This doesn't make sense. For large projects in enterprises, the longest path may exceed 260 characters without even adding to the base directory Commented Feb 14, 2020 at 11:03
  • 1
    Try using this if it helps. git config --system core.longpaths true Commented Feb 14, 2020 at 11:08
  • @stud3nt No, didn't work. Commented Feb 14, 2020 at 11:58

1 Answer 1

1

The local path where my repository is located:

C:\Users\user3008\Documents\Projects\clientconsultancyservice\ClientConsultancyInterface

And then add the longest path & file name in to repo to the starting point: if any go over 260 characters you;ll get that error., Blame MS-DOS 2.0 for the 260 character limitation.

Options: either use WSL, or (easier) put you repo somewhere more sensible on you machine where the location of the repo is a rather shorter name.

(I use C:\Projects and have changed VS's default project location to match.)

Sign up to request clarification or add additional context in comments.

3 Comments

This doesn't make sense. For large projects in enterprises, the longest path may exceed 260 characters without even adding to the base directory.
@MM not if being developed on Windows they don't.
(Also you'll hit issues if there is a dependency on file/folder names differing only in case... and this applies to git refs as well.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.