This question already has an answer here:
I can't find the command. I tried Googling "git 'delete a repository'".
This question already has an answer here:
I can't find the command. I tried Googling "git 'delete a repository'".
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
Delete the .git
directory in the root-directory of your repository if you only want to delete the git-related information (branches, versions).
If you want to delete everything (git-data, code, etc), just delete the whole directory.
.git directories are hidden by default, so you'll need to be able to view hidden files to delete it.
sudo rm -r directory
.
– Jonatan Öström
Aug 18 '16 at 15:26
ls -a
to see hidden files.
– Lincoln Bergeson
Jan 27 '17 at 18:44
To piggyback on rkj's answer, to avoid endless prompts (and force the command recursively), enter the following into the command line, within the project folder:
$ rm -rf .git
Or to delete .gitignore and .gitmodules if any (via @aragaer):
$ rm -rf .git*
Then from the same ex-repository folder, to see if hidden folder .git is still there:
$ ls -lah
If it's not, then congratulations, you've deleted your local git repo, but not a remote one if you had it. You can delete GitHub repo on their site (github.com).
To view hidden folders in Finder (Mac OS X) execute these two commands in your terminal window:
defaults write com.apple.finder AppleShowAllFiles TRUE
killall Finder
Source: http://lifehacker.com/188892/show-hidden-files-in-finder.
.git*
to also remove .gitignore
and .gitmodules
if any.
– aragaer
May 7 '13 at 22:14
In the repository directory you remove the directory named .git and that's all :). On Un*x it is hidden, so you might not see it from file browser, but
cd repository-path/
rm -r .git
should do the trick.
That's right, if you're on a mac(unix) you won't see .git in finder(the file browser). You can follow the directions above to delete and there are git commands that allow you to delete files as well(they are sometimes difficult to work with and learn, for example: on making a 'git rm -r ' command you might be prompted with a .git/ not found. Here is the git command specs:
usage: git rm [options] [--] ...
-n, --dry-run dry run
-q, --quiet do not list removed files
--cached only remove from the index
-f, --force override the up-to-date check
-r allow recursive removal
--ignore-unmatch exit with a zero status even if nothing matched
When I had to do this, deleting the objects and refs didn't matter. After I deleted the other files in the .git, I initialized a git repo with 'git init' and it created an empty repo.
.git
and other hidden/system folder easily (e.g., .DS_Store
). All you need to do is to configure Finder. Here is how: lifehacker.com/188892/show-hidden-files-in-finder. defaults write com.apple.finder AppleShowAllFiles TRUE
and then killall Finder
.
– Azat
May 7 '13 at 21:57