Reverting a commit generally makes a new commit that reverses the changes of the commit being reverted. That stops them from being in the immediate working copy, but there’s still a historical record of it having happened.
For something like this, you need a rebase operation that modifies the first commit to have added the file.
Merge does various things that perform rebases for you, though there may be no substitute for doing it manually. One thing you can do is select commits in the tree and use the context menu to Edit Commit > Drop Selected Commits
to rewrite the history as if that commit was never made (though if there were other changes in it that you want to keep, you would need to make sure to preserve those.
Something to note is that if you’ve pushed the commit anywhere, although you can force push the branch later, there’s always the possibility that someone has seen the secret.