Facing the below issue while pulling from github

How can i pull latest repo in main branch.

Error: LibGit2Sharp.CheckoutConflictException: no error
at LibGit2Sharp.Core.Ensure.HandleError(Int32 result) in C:\work\UiPathGit\libgit2sharp\LibGit2Sharp\Core\Ensure.cs:line 156
at LibGit2Sharp.Core.Proxy.git_rebase_init(RepositoryHandle repo, AnnotatedCommitHandle branch, AnnotatedCommitHandle upstream, AnnotatedCommitHandle onto, GitRebaseOptions options) in C:\work\UiPathGit\libgit2sharp\LibGit2Sharp\Core\Proxy.cs:line 1728
at LibGit2Sharp.Rebase.Start(Branch branch, Branch upstream, Branch onto, Identity committer, RebaseOptions options) in C:\work\UiPathGit\libgit2sharp\LibGit2Sharp\Rebase.cs:line 116
at UiPath.Studio.Plugin.Git.Services.RebaseService.<>c__DisplayClass5_1.b__1()
at UiPath.Studio.Plugin.Git.Services.ExecuteWithCurrentDirectoryService.Execute[T](String workingDirectory, Func1 func) at UiPath.Studio.Plugin.Git.Services.ExecuteWithCurrentDirectoryService.Execute[T](String workingDirectory, Func1 func)
at UiPath.Studio.Plugin.Git.Services.RebaseService.<>c__DisplayClass5_0.<b__0>d.MoveNext()
— End of stack trace from previous location —
at UiPath.Studio.Plugin.Git.Services.RebaseService.ExecuteWithRebaseContext(Func2 action) at UiPath.Studio.Plugin.Git.Services.RebaseService.Rebase(IRepository repository, Identity identity, Branch newReference) at UiPath.Studio.Plugin.Git.Services.PullService.TryRebase(IRepository repository, Signature signature) at UiPath.Studio.Plugin.Git.Services.PullService.Pull(IRepository repository) at UiPath.Studio.Plugin.Git.Desktop.Services.PullUiService.<>c__DisplayClass22_0.<<PullAsync>b__1>d.MoveNext() --- End of stack trace from previous location --- at UiPath.Studio.Plugin.Git.Services.GitSession.ExecuteAsyncInternal[TResult](Func2 action, Func1 repoFactory) at UiPath.Studio.Plugin.Git.Services.GitSession.<>c__DisplayClass19_01.<b__1>d.MoveNext()
— End of stack trace from previous location —
at UiPath.Studio.Plugin.Git.Services.GitSession.SafeExecuteAsync[TResult](Func1 action) at UiPath.Studio.Plugin.Git.Services.GitSession.ExecuteAsync[TResult](Func2 action)
at UiPath.Studio.Plugin.Git.Desktop.Services.PullUiService.PullAsync(IGitSession session)
at UiPath.Studio.Plugin.Git.Desktop.Services.PullUiService.PullCommandExecute()
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

Hi @jaswanthvarma.gottumukka1

It seems like you have some local changes that may be overwritten by this check out, hence the error.

You can consider manually resolving the conflicts first or commit changes to git first before pulling out new branch.

Alternatively, you can clone this main branch to a new local folder and work from that new location.

Hope this helps.

Regards

Sonali

Hi @jaswanthvarma.gottumukka1,

The error you’re seeing — LibGit2Sharp.CheckoutConflictException — usually happens when there are local changes in your current folder that would be overwritten by the pull/rebase. Sonali’s suggestions are correct, but here’s a step-by-step way you can handle it safely:

  1. Check for uncommitted changes
  • Open Studio’s Git panel or run git status in your repo folder.
  • If you see modified files, you have two options:Option A: Commit your changes
git add .
git commit -m "Save my local changes before pull"

Then try pulling again.Option B: Stash your changes temporarily

git stash
git pull origin main
git stash pop

This saves your changes, pulls the latest main branch, and reapplies your changes on top.
2. If you don’t need your local changes, you can discard them:

git reset --hard
git pull origin main
  1. Alternative approach
  • Clone the repo into a new folder and start fresh if you don’t want to deal with conflicts in the current workspace.

:light_bulb: Tip: Always make sure your local changes are saved somewhere before discarding or stashing.

This should resolve the CheckoutConflictException and allow you to pull the latest main branch safely.

1 Like