Once I pushed with a Hugging Face secret in my code it will never allow me to push again to Space even if I erase it and revert commit

You need to hard reset the commit.
and if you are using github also then do below steps

git reset --hard HEAD~n
git push origin <branch_name> --force

1 Like