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!

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