Reputation: 7198
How can I delete everything from GIT repository, so that no one can see any history?
If you ask why I want to do that. For security reasons, I need to protect the code into another server.
Upvotes: 1
Views: 5507
Reputation: 1129
THIS WILL DELETE ALL COMMITS AND HISTORY IN YOUR REMOTE REPOSITORY. MAKE SURE THIS IS WHAT YOU WANT TO DO BEFORE CONTINUING.
Create a new, empty directory
In this directory, git init
git remote add origin remote-url
(replace remote-url with the remote repo you will be deleting)
Need to create an initial commit so: touch .empty
git add .empty
git commit
git push origin --mirror
If anyone clones your remote repository, they will clone a tiny repository that only contains .empty
. Note that while your git refs will be unreachable from any commit, they still exist on the server until git gc
is run on the server end. If you're hosting with GitHub or BitBucket, this is done periodically. But, if that's the case, just delete the repository.
Upvotes: 3