Push was rejected: forbidden

Enumerating objects: 4, done.
Counting objects: 100% (4/4), done.
Delta compression using up to 10 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 431 bytes | 431.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 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)

I’ve tried the method in this thread , or generating GPG Keys and put it into huggingface, or using:

huggingface-cli login

Still do NOT work.

Hello! Hmm, that’s strange! Did you run git lfs install before adding and committing your files?

Yes, The results are:

$ git lfs install
Updated git hooks.
Git LFS initialized.

Sweet! And before adding and committing you ran git lfs track <EXTENSION> for any larger files?

You can try running git lfs ls-files to see if all the files that you’re trying to track have actually been added with Git LFS. Generally anything large-ish (checkpoint files, images, etc.) should be tracked. If they’re not, then you can undo the commit, track the files, commit and push again.

I had the same errors. Eventually I figured out that it was because I was using a “read” token instead of a “write” one.

5 Likes

It works, thanks a lot!

Anyone else still seeing this error? I’m just starting with a basic repo with only tiny files. I saw @sswam’s post and that totally made sense. I was in fact using a READ token. But I have since created a WRITE token and have confirmed (multiple times) that that token is the one I’m using as my huggingface-cli login credentials, but I’m still seeing this error.

1 Like

Also facing this issue, I setup my GPG key and am using a WRITE token after running huggingface-cli login but still getting:

remote: Your push was rejected for the following reasons:
remote: DENIED update refs/heads/main: forbidden