1

I am learning Git Hub. So I am a newbie. Trying to remove git related files in project directory. I used this line:

rd .git /S/Q

However it gives me this error when I use VS Code:

Remove-Item : A positional parameter cannot be found that accepts argument '/q'. At line:1 char:1 + rd /s /q .git + ~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (:) [Remove-Item], ParameterBindingException + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.RemoveItemCommand

and when I use CMD - command promt it gives me this error:

.git\refs\remotes - The directory is not empty.

What is going on. This is where I get my information about this: From stackoverflow From YouTube

I am using Windows 10 btw.

EDIT: I tried:

rd /S /Q .git

and I get error:

Remove-Item : A positional parameter cannot be found that accepts argument '/Q'. At line:1 char:1 + rd /S /Q .git + ~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (:) [Remove-Item], ParameterBindingException

Tried:

rd /S/Q .git

Error:

Remove-Item : A positional parameter cannot be found that accepts argument '.git'. At line:1 char:1 + rd /S/Q .git + ~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (:) [Remove-Item], ParameterBindingException

However I tried in command promt:

rd /S /Q .git

And I get :

.git\refs\remotes - The directory is not empty.

I try it second time right after that and it works... So what am I missing here?

EDIT 2:

All of these comands work in command promt but only if I type them for the second time. Including the command - rd .git /S/Q. The first time I get :

.git\refs\remotes - The directory is not empty.

and if I type it for the second time it works. In VS Code it is not working no matter how many times I type them.

Happy Coconut
  • 973
  • 4
  • 14
  • 33
  • Doesn't the error message just say that the switches (i.e., `/S /Q`) need to go before the files / directories you want to delete? Try `rd /S /Q .git` (also note the space before each slash). – Robert Dec 24 '19 at 23:33
  • 1
    Thanks for the response. Tried it and the results are in the edit section of my question – Happy Coconut Dec 24 '19 at 23:58

0 Answers0