DENIED update refs/heads/main: forbidden

I followed the instructions shown immediately upon creating a huggingface space; however, I cannot push any changes I make to the cloned space git repo.
If I try I will get the following:

Enumerating objects: 4, done.
Counting objects: 100% (4/4), done.
Delta compression using up to 16 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 414 bytes | 414.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
remote: ----------------------------------------------------------
remote: Your push was rejected for the following reasons:
remote: DENIED update refs/heads/main: forbidden
remote: ----------------------------------------------------------
 ! [remote rejected] main -> main (pre-receive hook declined)
error: failed to push some refs to ''

I have tried searching this error, but I could not find anything helpful. If someone could point me in the right direction thank you.

I am facing the same issue. Were you able to resolve this?

have you tried git push --force ?

I am pushing this model from colab. How do I use this from the trainer.push_to_hub()?

I see, we don’t support the force push yet on push_to_hub(). If you’re on colab, can you found out the dir of your Trainer? then run this shell command on a cell. I hope after that, you might not have issues with trainer.push_to_hub()

!cd trainer_folder && git push --force

I think for me my issue was using incorrect credentials for my huggingface account, as I was able to push successfully following the original instructions after I reset my account password.

1 Like