# DENIED update refs/heads/main: forbidden

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fdenied-update-refs-heads-main-forbidden%2F21597%3E%5C
**Category:** Spaces\
**Created:** [August 13, 2022, 9:36pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fdenied-update-refs-heads-main-forbidden%2F21597 "2022-08-13T21:36:48Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![warrenwang](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/warrenwang/32/5685_2.png) [@warrenwang](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fwarrenwang)%5C
**Post date:** [August 13, 2022, 9:36pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fdenied-update-refs-heads-main-forbidden%2F21597%2F1 "2022-08-13T21:36:48Z")

</div>

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:

```auto
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: ----------------------------------------------------------
To https://huggingface.co/spaces/warrenwang/minimal_hello
 ! [remote rejected] main -> main (pre-receive hook declined)
error: failed to push some refs to 'https://huggingface.co/spaces/warrenwang/minimal_hello'

```

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

---

<div class="post-metadata">

**Author:** ![Paarth](https://avatars.discourse-cdn.com/v4/letter/p/dfb087/32.png) [@Paarth](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FPaarth)%5C
**Post date:** [August 21, 2022, 6:27pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fdenied-update-refs-heads-main-forbidden%2F21597%2F2 "2022-08-21T18:27:52Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![radames](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/radames/32/28246_2.png) [@radames](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fradames)%5C
**Post date:** [August 21, 2022, 6:31pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fdenied-update-refs-heads-main-forbidden%2F21597%2F3 "2022-08-21T18:31:49Z")

</div>

have you tried `git push --force` ?

---

<div class="post-metadata">

**Author:** ![Paarth](https://avatars.discourse-cdn.com/v4/letter/p/dfb087/32.png) [@Paarth](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FPaarth)%5C
**Post date:** [August 21, 2022, 6:48pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fdenied-update-refs-heads-main-forbidden%2F21597%2F4 "2022-08-21T18:48:35Z")

</div>

I am pushing this model from colab. How do I use this from the trainer.push\_to\_hub()?

---

<div class="post-metadata">

**Author:** ![radames](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/radames/32/28246_2.png) [@radames](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fradames)%5C
**Post date:** [August 21, 2022, 7:32pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fdenied-update-refs-heads-main-forbidden%2F21597%2F5 "2022-08-21T19:32:09Z")

</div>

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()`

```nohighlight
!cd trainer_folder && git push --force

```

---

<div class="post-metadata">

**Author:** ![warrenwang](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/warrenwang/32/5685_2.png) [@warrenwang](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fwarrenwang)%5C
**Post date:** [August 21, 2022, 8:04pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fdenied-update-refs-heads-main-forbidden%2F21597%2F6 "2022-08-21T20:04:07Z")

</div>

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.

---

<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:15am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fdenied-update-refs-heads-main-forbidden%2F21597%2F7 "2022-10-24T04:15:24Z")

</div>

I had the same error messages, turns out it was because I was using a “read” token instead of a “write” one.

---

<div class="post-metadata">

**Author:** ![Shang37](https://avatars.discourse-cdn.com/v4/letter/s/2bfe46/32.png) [@Shang37](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FShang37)%5C
**Post date:** [October 26, 2022, 8:50am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fdenied-update-refs-heads-main-forbidden%2F21597%2F8 "2022-10-26T08:50:30Z")

</div>

Thank you!!!

---

<div class="post-metadata">

**Author:** ![sushmanth](https://avatars.discourse-cdn.com/v4/letter/s/34f0e0/32.png) [@sushmanth](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fsushmanth)%5C
**Post date:** [February 5, 2023, 4:50am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fdenied-update-refs-heads-main-forbidden%2F21597%2F9 "2023-02-05T04:50:35Z")

</div>

@radames I was having this problem with this following errors can’t push my files to hugging face ,I was having following error

 ![Screenshot 2023-02-05 at 10.17.02 AM](https://us1.discourse-cdn.com/hellohellohello/original/2X/b/b8fd82c8ac57f0da653c6e501ee498b0cdc58e86.png)  
’

I was using write token only but I was getting this error…pls anyone help me out

@sswam

---

<div class="post-metadata">

**Author:** ![radames](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/radames/32/28246_2.png) [@radames](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fradames)%5C
**Post date:** [February 5, 2023, 4:56am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fdenied-update-refs-heads-main-forbidden%2F21597%2F10 "2023-02-05T04:56:22Z")

</div>

hi @sushmanth ,

Can you please try to lfs track the `.onnx` then add push then?

```auto
git lfs track "*.onnx"
git add *.onnx
git commit -a
git push

```

Please let me know if that works . You can read more about it [here](https://huggingface.co/docs/hub/repositories-getting-started#terminal) and [here](https://docs.github.com/en/repositories/working-with-files/managing-large-files/configuring-git-large-file-storage)

---

<div class="post-metadata">

**Author:** ![sushmanth](https://avatars.discourse-cdn.com/v4/letter/s/34f0e0/32.png) [@sushmanth](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fsushmanth)%5C
**Post date:** [February 5, 2023, 5:06am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fdenied-update-refs-heads-main-forbidden%2F21597%2F11 "2023-02-05T05:06:48Z")

</div>

@radames ,I was using this .yml file ,I don’t knew where iam going wrong once u pls check this out

 ![Screenshot 2023-02-05 at 10.35.14 AM](https://us1.discourse-cdn.com/hellohellohello/original/2X/e/ef973c9f47f1b194cf1c23923fca6ed49b719772.png)

---

<div class="post-metadata">

**Author:** ![sushmanth](https://avatars.discourse-cdn.com/v4/letter/s/34f0e0/32.png) [@sushmanth](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fsushmanth)%5C
**Post date:** [February 5, 2023, 5:15am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fdenied-update-refs-heads-main-forbidden%2F21597%2F12 "2023-02-05T05:15:31Z")

</div>

@radames I was using GitHub workflow to deploy into hugging face ,so I don’t knew where I was going wrong…

---

<div class="post-metadata">

**Author:** ![jignasha](https://avatars.discourse-cdn.com/v4/letter/j/dc4da7/32.png) [@jignasha](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fjignasha)%5C
**Post date:** [June 9, 2023, 6:33am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fdenied-update-refs-heads-main-forbidden%2F21597%2F13 "2023-06-09T06:33:49Z")

</div>

![image](https://us1.discourse-cdn.com/hellohellohello/original/3X/2/c/2c0d9d2c48e344b12ff5cd42753cb740d50e1908.png)  
i have done git lfs install, also done git track “_.dll" and "_.lib”, then also not able to push to my new spaces

---

<div class="post-metadata">

**Author:** ![radames](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/radames/32/28246_2.png) [@radames](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fradames)%5C
**Post date:** [June 9, 2023, 9:08pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fdenied-update-refs-heads-main-forbidden%2F21597%2F14 "2023-06-09T21:08:20Z")

</div>

Hi @Jignasha, you might need to clean up the git history, since you may have committed these `.dll` and `.libs` files before you started tracking them with LFS

---

<div class="post-metadata">

**Author:** ![jignasha](https://avatars.discourse-cdn.com/v4/letter/j/dc4da7/32.png) [@jignasha](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fjignasha)%5C
**Post date:** [June 12, 2023, 11:15am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fdenied-update-refs-heads-main-forbidden%2F21597%2F15 "2023-06-12T11:15:12Z")

</div>

![image](https://us1.discourse-cdn.com/hellohellohello/original/3X/3/b/3b0742491702e126a2560074ecaaa0dd91d56431.png)  
cleared git history, did git lfs install, gilt lfs track \*.dll and \*.lib, git lfs track \*.pyd, not updating to spaces  
issue is not resolving, taking a lot of time

---

<div class="post-metadata">

**Author:** ![radames](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/radames/32/28246_2.png) [@radames](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fradames)%5C
**Post date:** [June 12, 2023, 6:23pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fdenied-update-refs-heads-main-forbidden%2F21597%2F16 "2023-06-12T18:23:18Z")

</div>

hi @jignasha , you have offending files `.pyd` these are compiled python binaries, they don’t need to be on your commit, please add it to your `.gitignore` and cleanup the files from your history. I hope that works now

---

<div class="post-metadata">

**Author:** ![nehalelkaref](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/nehalelkaref/32/17425_2.png) [@nehalelkaref](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fnehalelkaref)%5C
**Post date:** [July 7, 2023, 9:14pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fdenied-update-refs-heads-main-forbidden%2F21597%2F17 "2023-07-07T21:14:40Z")

</div>

second link was a life save, thank you so much!
