How to fully delete a git repository created with init? -Delete git repository

278    Asked by Aashishchaursiya in Devops , Asked on Feb 16, 2021

The trick is to remove the file from .git directory since git keeps all of its files in the .git directory. Once you remove that file, init git once again.

Let us see how to find it.

For Windows 7:

Go to your folder > Click on Organize on the top left > click on Folder and search options > click on the View tab > click on the Show hidden files, folders and drives radio button.

For Mac OS:

Open a Terminal (using Spotlight: press CMD + SPACE > type terminal > press Enter) and do this command:

defaults write com.apple.finder AppleShowAllFiles 1 && killall Finder

Remember that the keyboard shortcut to show hidden files in Finder is CMD + SHIFT + . so it is no longer necessary to modify the finder config this way

You could type cd (space is important), drag and drop your git repo folder from Finder to the Terminal window, press return, then type rm -fr .git, then return again.

For Ubuntu:

Use shortcut Ctrl + H.

For more commands like this please go through the following tutorial that will help you understand the git



Your Answer

Interviews

Parent Categories