MicroBlog – Filename too long in Git? Enable Long path support

Just a quick blog about an issue I hit when assigning an Azure Policy via AzOps for Enterprise Scale.

When you configure a layered Management Group Structure in Azure for Enterprise Scale, you can go to 6 levels in depth, however when it comes to storing Policy Definitions and Assignments the file name length can quickly exceed the Windows API max length of 260 characters. The main reason for this is that these json files are stored in Git with Guid values and somewhat long filenames.

Example:

Now, when cloning a Git Repo using a local VSCode and these files have to be created on the Windows Filesystem there is this limitation of 260 characters…… which I hit of course! By default Win10 has support for ‘LongPath’ which has been around for a few years now, it used to have to be toggled on via a registry mod:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem

In order to enable support for Long Paths, this setting has to be configured to a value of ‘1’.

But wait, my system was already set to that! So now what?

It appears that in my local Git, the system property also has to be set to use long paths:

git config --system core.longpaths true

No more errors! I guess there could be side effects by enabling this on your Git, but I will see what there are over time I am sure!

Hope this helps!

2 thoughts on “MicroBlog – Filename too long in Git? Enable Long path support

  1. I really like your blog.. very nice colors & theme. Did you design this website yourself or did you hire someone to do it for you? Plz respond as I’m looking to create my own blog and would like to find out where u got this from. thanks a lot

    Like

  2. Anna's avatar Anna

    Long Path Tool complements the above by helping you manage your local Git repo files and avoid long path errors before or after clone/checkout: TaskUse Long Path Tool to…Clone failed due to long pathsIdentify/shorten nested folders or file namesGit checkout failsDelete or move long-path filesRepo cleanupFlatten directory structure manually

    Liked by 1 person

Leave a comment

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