Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to enable using Git repository with files with long paths for all users?

Tags:

git

path

windows

On Windows using git repository with long paths causes errors for example for pull:

"Fatal: cannot create directory at PATH: Filename too long".

To solve that all repository users can add "longpaths = true" to their .gitconfig files. But how can I do this so that other users don't have to worry about it and can use the repository normally?

like image 730
user8097676 Avatar asked Dec 14 '22 22:12

user8097676


1 Answers

You can't make a central repository configuration that will automagically propagate out to everyone that clone your repository.

As such you're left with the following options:

  1. Shorten the paths in the repository
  2. Advice or help your programmers on how to configure their git accordingly

    • For instance, you could provide the git command for them or even a batch file with:

      git config --global core.longpaths true
      
  3. Move the repository closer to the root of the drive
  4. Not use Windows (but I'm guessing this is not a realistic option)

Be aware that unless you do 1 or 3, there is no guarantee that any editor or whatever you use to relate to the files in the repository will be able to access the files if their paths are still that long. In other words, even if you persuade git to handle long paths, your favorite code editor or build system might not be able to.

My best advice is thus to use point 1, try to shorten the paths down to it not being a problem.

like image 180
Lasse V. Karlsen Avatar answered Dec 26 '22 14:12

Lasse V. Karlsen