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
That is the problem basically, I put my hf key in my code by mistake, I know I can’t so I removed it, but now even with it removed it still doesn’t allow me to push.I reverted those commits and still didn’t allow me to push.It seems that it will never allow me again.My solution has been to restart the repository every time it happens, I have restarted repositories 3 times now! I beleive there must be another solution!And the thing I’m using my hf secret in my code for testing purpouses but if I forget to erase it and push, and if you do so, well that repo is doomed forever and I can’t push never ever again.Maybe I’m doing something wrong or it is an obvious solution but I can’t see it, can you help me?This is the output after trying to push even once the secret is erased and saved and commit the correction, it still displays the same mistake.If you put for hf secret by mistake your repo is doomed forever or what i’m doing wrong?Thanks in advance.Writing objects: 100% (8/8), 879 bytes | 879.00 KiB/s, done.Total 8 (delta 6), reused 0 (delta 0), pack-reused 0 (from 0)remote: -------------------------------------------------------------------------remote: It appears that one or more of your files contain valid Hugging Face secrets, such as tokens or API keys.remote: It is important to keep your secrets private and not expose them in code that is publicly accessible.remote: Read more:Spaces Overviewremote:remote: Offending files:remote:   - xxxxx.py (ref: refs/heads/main, token: ‘REDACTED_TOKEN’)remote: -------------------------------------------------------------------------Tohf.co:spaces/Moibe/xxxxx! [remote rejected] main → main (pre-receive hook declined)error: failed to push some refs to ‘hf.co:spaces/Moibe/xxxxx’
2024-07-10T11:09:13Z
You need to hard reset the commit.and if you are using github also then do below stepsgit reset --hard HEAD~ngit push origin <branch_name> --force
2024-07-18T06:30:05Z
This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.