A path too long error occurred when running a project added to a cloned remote GIT repository - LibGit2Sharp.LibGit2SharpException: path too long

Why is a 'path too long' error being received when running a project added to a cloned remote GIT repository?

Issue Description:

Encountering this error when running a project added to a cloned remote GIT repository:

Error: LibGit2Sharp.LibGit2SharpException: path too long: 'C:/Users/Kolan/OneDrive - Memorial Sloan Kettering Cancer Center/RPA Projects - GitHub/REV0006_PatientCreationAndAppointmentScheduling/.local/install/REV0006_PatientCreationAndAppointmentScheduling_Expressions.Epic_Epic_ScheduleAppointmentAndUpdateVisitType.dll'

at LibGit2Sharp.Core.Ensure.HandleError(Int32 result)

at LibGit2Sharp.Core.Proxy.git_status_list_new(RepositoryHandle repo, GitStatusOptions options)

at LibGit2Sharp.RepositoryStatus..ctor(Repository repo, StatusOptions options)

at LibGit2Sharp.Repository.RetrieveStatus(StatusOptions options)

at UiPath.Studio.Plugin.Git.Services.RepositoryStatusService.RetrieveStatus(String repositoryPath, StatusOptions options, Action`2 sandboxedAction)

at UiPath.Studio.Plugin.Git.Services.GetChangesService.GetChanges(IRepository repository)

at UiPath.Studio.Plugin.Git.Services.GetChangesService.b__4_0(IRepository r)

at UiPath.Studio.Plugin.Git.Services.GitSession.ExecuteInternal[TResult](Func`2 action, Func`1 repoFactory)

at System.Threading.Tasks.Task`1.InnerInvoke()

at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)

--- End of stack trace from previous location ---

at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)

--- End of stack trace from previous location ---

at UiPath.Studio.Plugin.Git.Services.GitSession.SafeExecuteAsync[TResult](Func`1 action)

at UiPath.Studio.Plugin.Git.Services.GitSession.ExecuteAsync[TResult](Func`2 action)

at UiPath.Studio.Plugin.Git.Services.GetChangesService.GetChangesAsync(IGitSession session)

at UiPath.Studio.Plugin.Git.Desktop.Services.EnsureNoChangesWizard.EnsureNoChanges(IGitSession session)

at UiPath.Studio.Plugin.Git.Desktop.Services.ManageBranchesService.ExecuteSelectedAction(IGitSession session, BranchesManagerViewModel vm)

at UiPath.Studio.Plugin.Git.Desktop.Services.ManageBranchesService.ManageBranchesCommandExecute()

at UiPath.Studio.App.Desktop.MVVM.Commands.TaskCommand`3.Execute(TExecuteParameter parameter, Boolean ignoreCanExecuteCheck)

at System.Threading.Tasks.Task.<>c.b__128_0(Object state)

at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)

at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler), HResult -2146233088

Cause:

There is a bug in Studio where the number of characters in the full path, including the .xaml file name (e.g., C:\directory\file.xaml), is greater than or equal to 261.

Resolution:

To resolve this issue, upgrade to Studio version 2023.10.2+ or edit the .git/config file in the project's directory. Add or save 'longpaths = true' as shown in the example below. Rename the .xaml file to the longer file name used previously and inform us of the outcome

[core]

bare = false

repositoryformatversion = 0

filemode = false

symlinks = false

ignorecase = true

logallrefupdates = true

longpaths = true

[remote "StudioGitIntegrationTest"]

url = https://github.com/user/StudioGitIntegrationTest.git

fetch = +refs/heads/*:refs/remotes/StudioGitIntegrationTest/*

[branch "main"]

remote = StudioGitIntegrationTest

merge = refs/heads/main

[branch "Data_Processing_Branch"]

remote = StudioGitIntegrationTest

merge = refs/heads/Data_Processing_Branch