|-- Remove the history from|
|rm -rf .git|
|-- recreate the repos from the current content only|
|git add .|
|git commit -m "Initial commit"|
|-- push to the github remote repos ensuring you overwrite history|
|git remote add origin email@example.com:<YOUR ACCOUNT>/<YOUR REPOS>.git|
|git push -u --force origin master|
This might be problematic with repositories with git submodules.
This did work for me, but initially I ran into problems after the two last lines (with my account and repo name, of course):
After running the last command, which failed, I started to get error messages for every command I used. I was not allowed to push. For example:
In my case, the solution was to follow this guide to use HTTPS instead of SSH:
I believe you need to delete and recreate the Github remote repo to completely remove the logs. See for example Recovering a commit from Githubs reflog.
Using the Github API described there, you access commits that are stored on Github don't appear in the normal commit history on Github.
With this method, you don't know have to know the SHA of a commit you are looking for.
Also, if the project in question is public, it appears the API calls to review the history are also public.