Error: LibGit2Sharp.LibGit2SharpException: path too long

Check the solution from here: Maximum Path Length Limitation - Win32 apps | Microsoft Learn

To enable the new long path behavior, both of the following conditions must be met:

  • The registry key Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem\LongPathsEnabled (Type: REG_DWORD) must exist and be set to 1. The key’s value will be cached by the system (per process) after the first call to an affected Win32 file or directory function (see below for the list of functions). The registry key will not be reloaded during the lifetime of the process. In order for all apps on the system to recognize the value of the key, a reboot might be required because some processes may have started before the key was set.

You can also copy this code to a .reg file which can set this for you, or use the PowerShell command from a terminal window with elevated privileges:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem]
"LongPathsEnabled"=dword:00000001

Example:

This registry key can also be controlled via Group Policy at Computer Configuration > Administrative Templates > System > Filesystem > Enable Win32 long paths > set to Enabled .

After you performed these changes, restart your machine and retry.

Let us know if this helped.

1 Like