How to remove local git repositories in Visual Studio 2019?
Asked Answered
F

5

9

In vs 2017 there was an option under Local Git Repositories -> right click "delete repository".

In vs 2019 there is no menu like that:

Information about new Git menu

And in the new menu it seems that there is no option for deleting: New Git menu

Of course I can delete the repositories manually, I am just wondering if there are any way to do it visual studio. Thanks for your help!

Farseeing answered 16/3, 2021 at 17:35 Comment(1)
The only way I achieved this was to really move the repo's root folder somewhere else. If I then closed and reopened Visual Studio it was gone from the menu. Re-moving it to the original location however resulted in the repo popping up again in the menu, so its not really a solution ....Anna
U
6

I know this is an old question, but I'm putting this here for anyone trying to do the same.

  1. Open Visual Studio (I'm using VS2022, don't know if the same for previous versions or not)
  2. Continue without code.
  3. Click on 'Select Repository' (Bottom right corner)
  4. Right click on the repository you want to remove the reference to.
  5. Click 'Remove from List'

N.B: To remove the reference, you cannot have that repository selected, that is why I suggested to Continue without code, regardless, you can remove any reference to a repository that you do not have opened in Visual Studio.

ETA: You do not need to delete, remove, or replace the repositories to remove them.

Unstoppable answered 25/7, 2023 at 16:35 Comment(0)
M
3

just delete the .git file in your project directory and then refresh

if you can't find the .git file in your project it may be

Maceio answered 22/8, 2022 at 9:15 Comment(0)
E
3

Solved!

1- Show hidden items in File Explorer

2- Delete .git folder

enter image description here

Eviaevict answered 27/5 at 10:29 Comment(0)
C
0

I had similar problem in VS2022 / Community edition. Have an unused branch already renamed, but its original name was still available in menu Git / Local Repositories... Matching that name (entry from the menu) in the project folder, showed me following:

  1. Simply try to locate a folder called .vs (usually is hidden) in the root of your git archive folder.
  2. In this folder check for existence of folders having same name as your projects to remove from the menu - usually that folders points to empty directory tree!!
  3. in file explorer, better by VS switched off - delete it. That approach helped me.
Cb answered 22/8, 2022 at 8:44 Comment(0)
K
-3

Use the command: rm -rf .git

The Git command rm -rf is used, rm removes a file from Git, and the -rf option of this command removes files recursively and forcefully. .git*

Kaduna answered 22/4 at 12:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.