# Push was rejected: forbidden

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fpush-was-rejected-forbidden%2F23120%3E%5C
**Category:** Spaces\
**Created:** [September 14, 2022, 8:14am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fpush-was-rejected-forbidden%2F23120 "2022-09-14T08:14:28Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![MazzzyStar](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/mazzzystar/32/6053_2.png) [@MazzzyStar](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FMazzzyStar)%5C
**Post date:** [September 14, 2022, 8:14am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fpush-was-rejected-forbidden%2F23120%2F1 "2022-09-14T08:14:28Z")

</div>

```auto
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](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fdenied-update-refs-heads-main-forbidden%2F21597) , or generating GPG Keys and put it into huggingface, or using:

```bash
huggingface-cli login

```

Still do NOT work.

---

<div class="post-metadata">

**Author:** ![NimaBoscarino](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/nimaboscarino/32/4358_2.png) [@NimaBoscarino](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FNimaBoscarino)%5C
**Post date:** [September 14, 2022, 9:42am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fpush-was-rejected-forbidden%2F23120%2F2 "2022-09-14T09:42:40Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![MazzzyStar](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/mazzzystar/32/6053_2.png) [@MazzzyStar](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FMazzzyStar)%5C
**Post date:** [September 14, 2022, 9:59am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fpush-was-rejected-forbidden%2F23120%2F3 "2022-09-14T09:59:20Z")

</div>

Yes, The results are:

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

```

---

<div class="post-metadata">

**Author:** ![NimaBoscarino](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/nimaboscarino/32/4358_2.png) [@NimaBoscarino](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FNimaBoscarino)%5C
**Post date:** [September 14, 2022, 10:03am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fpush-was-rejected-forbidden%2F23120%2F4 "2022-09-14T10:03:24Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![sswam](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/sswam/32/12205_2.png) [@sswam](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fsswam)%5C
**Post date:** [October 24, 2022, 4:16am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fpush-was-rejected-forbidden%2F23120%2F5 "2022-10-24T04:16:12Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![MazzzyStar](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/mazzzystar/32/6053_2.png) [@MazzzyStar](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FMazzzyStar)%5C
**Post date:** [October 24, 2022, 4:49am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fpush-was-rejected-forbidden%2F23120%2F6 "2022-10-24T04:49:39Z")

</div>

It works, thanks a lot!

---

<div class="post-metadata">

**Author:** ![shaase](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/shaase/32/12339_2.png) [@shaase](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fshaase)%5C
**Post date:** [November 1, 2022, 5:32pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fpush-was-rejected-forbidden%2F23120%2F7 "2022-11-01T17:32:33Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Andreilys](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/andreilys/32/12368_2.png) [@Andreilys](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FAndreilys)%5C
**Post date:** [November 2, 2022, 7:30pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fpush-was-rejected-forbidden%2F23120%2F8 "2022-11-02T19:30:55Z")

</div>

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

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

```
