vscode icon indicating copy to clipboard operation
vscode copied to clipboard

Deletion of directory '...' failed. Should I try again? (y/n)

Open Forge36 opened this issue 1 year ago • 1 comments

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version:
1.86.2
903b1e9d8990623e3d7da1df3d33db3e42d80eda
x64
  • OS Version:
Edition	Windows 10 Enterprise
Version	22H2
OS build	19045.3930
Experience	Windows Feature Experience Pack 1000.19053.1000.0

Steps to Reproduce:

  1. Configure VS Code as git's editor git config --global core.editor = 'code --wait --reuse-window --disable-extensions'
  2. start an interactive rebase git rebase HEAD~2 -i
  3. Delete all text in the rebase file
  4. Save
  5. Close visual studio

See error: Deletion of directory '...' failed. Should I try again? (y/n)

I'm also using windows terminal with git-bash and this entirely breaks the terminal forcing me to close the tab.

There does appear to be a race condition as leaving visual studio open for a longer period of time does not exhibit the error (i.e. it's inconsistent).

Forge36 avatar Feb 22 '24 18:02 Forge36

You might have a subdirectory in the directory you are trying to delete.

roscoekerby avatar Aug 28 '24 12:08 roscoekerby

I get the same symptoms, but I am using Notepad++ as my editor. i.e. I will do a rebase, and at the end I get Deletion of directory '.git/rebase-merge' failed. Should I try again? (y/n). Sometimes it's that git-internal path, other times it can't delete a directory which was removed as part of the rebase. In other words, this might not be a vscode bug. I never saw this error in years of using git, until recently when I also started using Windows Terminal for the first time. Perhaps that's related.

HughWarrington avatar Oct 31 '24 12:10 HughWarrington

I am using Windows Terminal as well.

Forge36 avatar Oct 31 '24 22:10 Forge36

Run PowerShell with administration permission.

ganganiSoN avatar Nov 25 '24 11:11 ganganiSoN

@HughWarrington, is your repo in OneDrive?

ftsfranklin avatar Nov 28 '24 03:11 ftsfranklin

Run PowerShell with administration permission.

The original reporter was not using PowerShell and nor was I.

@HughWarrington, is your repo in OneDrive?

No. But it was in Google Drive.

HughWarrington avatar Nov 28 '24 12:11 HughWarrington

I am encountering the same problem.

I am also on Windows 10 Enterprise, version 22H2 and the issue persists with (as of writing) the latest git version (version 2.47.1 64-bit for windows). I am not admin of my PC.

I first got the issue when I started to git rebase in git bash inside VS Code, but after investigation the problem appeared in different configurations (with git bash and the windows terminal inside and outside of VS Code).

It seems like all kind of folders can't be deleted by git (folders inside the .git folder and the repo's).

tanguy0807 avatar Nov 28 '24 22:11 tanguy0807

I had the same problem. If your files are in One Drive you will have problems with Git. My situation is even worse. I have to use portable vscode and portable git. If it is possible try to move stuff somewhere outside One Drive and test it. Works for me.

mastapiggy avatar Feb 24 '25 22:02 mastapiggy

ran into this just now as well, git repository is inside OneDrive. could set the answers to default to no, but wish it worked out of the box

skyhirider avatar Mar 16 '25 19:03 skyhirider

I also have this problem. For me, it's when I try to run git gc (and I would expect other git commands that try to clean up folders). My repo is also in OneDrive. Since I'm not currently using VSCode in this repo (but rather just Git for Windows), I would expect this is a Git problem, and not a VSCode problem.

jonathonmckay avatar Apr 03 '25 13:04 jonathonmckay

Yeah since I originally commented, I have found I also get the problem using the git-bash that is bundled with GitHub Desktop (and with my repo still stored in Google Drive). Interestingly, this problem occurs 100% of the time, it's not intermittent. But this strongly points to it not being a vscode issue. I would recommend to close this ticket as it needs to be filed upstream.

HughWarrington avatar Apr 04 '25 13:04 HughWarrington

I was facing issue while pulling changes from remote branch, git somehow cannot delete the last folder and getting stuck in yes or no permission to delete the folder. Manually deleting the folders in you'r local repo will solve the issue, infact git itself will give you the folder name which it cannot delete just remove that one and terminate current terminal next pull again

sanjay-route53 avatar Apr 11 '25 17:04 sanjay-route53

Given the reports with other programs I'm closing this as it's not likely to be a VSCode specific issue.

A recent fix was made to git which may also resolve this: https://github.com/git-for-windows/git/issues/4776

Forge36 avatar May 12 '25 15:05 Forge36

@Forge36 I can't see how that other ticket is relevant, but you did the right thing to close this ticket in any case.

HughWarrington avatar May 12 '25 15:05 HughWarrington