This is the brute-force approach.
Note: This does NOT work if the repository has submodules! If you are using submodules, you should use e.g. interactive rebase.
Start by moving your config:
$ mv .git/config .
Then delete the Git repository:
$ rm -rf .git
Then reconstruct the Git repository with only the current content:
$ git init $ mv config .git/ $ git add . $ git commit -a -m "Initial commit"
Then push it:
$ git push -u --force origin master
If you have any comments or corrections please feel free to email them to me. Also, if you found this content useful consider supporting me on Patreon