# I got Authorization error

**URL:** <https://discuss.huggingface.co/t/i-got-authorization-error/32881>\
**Category:** 🤗Datasets\
**Created:** [March 2, 2023, 11:06am UTC](https://discuss.huggingface.co/t/i-got-authorization-error/32881 "2023-03-02T11:06:59Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![zeusfsx](https://avatars.discourse-cdn.com/v4/letter/z/c57346/32.png) [@zeusfsx](https://discuss.huggingface.co/u/zeusfsx)\
**Post date:** [March 2, 2023, 11:06am UTC](https://discuss.huggingface.co/t/i-got-authorization-error/32881/1 "2023-03-02T11:06:59Z")

</div>

I did all steps in the [tutorial](https://huggingface.co/docs/datasets/share), but when I execute `git push` I got the error:

```auto
Uploading LFS objects: 0% (0/1), 0 B | 0 B/s, done.
batch response: Authorization error.
error: failed to push some refs to 'https://huggingface.co/datasets/zeusfsx/ukrainian-news'

```

I logged via `huggingface-cli login`

---

<div class="post-metadata">

**Author:** ![emiltj](https://avatars.discourse-cdn.com/v4/letter/e/d07c76/32.png) [@emiltj](https://discuss.huggingface.co/u/emiltj)\
**Post date:** [March 8, 2023, 11:29am UTC](https://discuss.huggingface.co/t/i-got-authorization-error/32881/2 "2023-03-08T11:29:56Z")

</div>

Getting the exact same error - so peeking for any answers as well.

Did you find a solution?

---

<div class="post-metadata">

**Author:** ![radames](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/radames/32/28246_2.png) [@radames](https://discuss.huggingface.co/u/radames)\
**Post date:** [March 9, 2023, 5:49am UTC](https://discuss.huggingface.co/t/i-got-authorization-error/32881/3 "2023-03-09T05:49:52Z")

</div>

hi @zeusfsx and @emiltj can you please double check you’re using a token with **write** role permission?  
Another question, which OS are you running?

---

<div class="post-metadata">

**Author:** ![emiltj](https://avatars.discourse-cdn.com/v4/letter/e/d07c76/32.png) [@emiltj](https://discuss.huggingface.co/u/emiltj)\
**Post date:** [March 9, 2023, 7:21am UTC](https://discuss.huggingface.co/t/i-got-authorization-error/32881/4 "2023-03-09T07:21:53Z")

</div>

I triple checked. Must be working as I can push with push\_to\_hub(), but not using the cli.

---

<div class="post-metadata">

**Author:** ![radames](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/radames/32/28246_2.png) [@radames](https://discuss.huggingface.co/u/radames)\
**Post date:** [March 9, 2023, 7:56am UTC](https://discuss.huggingface.co/t/i-got-authorization-error/32881/5 "2023-03-09T07:56:59Z")

</div>

I’ve recently encountered similar issues while working on OSX. To resolve the problem, I had to clean up all the `huggingface.co` password on my keychain access. I also had to reconfigure my `git config --global credential.helper osxkeychain` then `huggingface-cli login`. After these steps, it was back to normal. Note these are OSX-specific

---

<div class="post-metadata">

**Author:** ![emiltj](https://avatars.discourse-cdn.com/v4/letter/e/d07c76/32.png) [@emiltj](https://discuss.huggingface.co/u/emiltj)\
**Post date:** [March 9, 2023, 8:15am UTC](https://discuss.huggingface.co/t/i-got-authorization-error/32881/6 "2023-03-09T08:15:00Z")

</div>

Sorry, I forgot to reply to the OS question.

Running MacOS 13.2.1 (22D68), with the M1-chip. Not unlikely that the problem is similar to the one you have. I am not going to bother setting that up, but will just be using the push\_to\_hub().

Thank you for your answer

---

<div class="post-metadata">

**Author:** ![kz919](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/kz919/32/31282_2.png) [@kz919](https://discuss.huggingface.co/u/kz919)\
**Post date:** [April 7, 2023, 5:10pm UTC](https://discuss.huggingface.co/t/i-got-authorization-error/32881/7 "2023-04-07T17:10:02Z")

</div>

getting the same error on ubuntu 16.04, huggingface-cli login does nothing

---

<div class="post-metadata">

**Author:** ![kz919](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/kz919/32/31282_2.png) [@kz919](https://discuss.huggingface.co/u/kz919)\
**Post date:** [April 7, 2023, 5:10pm UTC](https://discuss.huggingface.co/t/i-got-authorization-error/32881/8 "2023-04-07T17:10:32Z")

</div>

Pushing to hub is such a frustrating experience at this point, I am about to give up.

---

<div class="post-metadata">

**Author:** ![radames](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/radames/32/28246_2.png) [@radames](https://discuss.huggingface.co/u/radames)\
**Post date:** [April 12, 2023, 7:41pm UTC](https://discuss.huggingface.co/t/i-got-authorization-error/32881/9 "2023-04-12T19:41:24Z")

</div>

for all in the thread, we now have support for SSH keys, so many of the authentication problems could be overcome via SSH authentication.

> **[Hugging Face – The AI community building the future.](https://huggingface.co/login?next=%2Fsettings%2Fkeys%2Fadd%3Ftype%3Dssh)**
>
> We’re on a journey to advance and democratize artificial intelligence through open source and open science.

 ![image](https://us1.discourse-cdn.com/hellohellohello/original/2X/e/ecd9d19cb8c0e56a3db89ee475646c9d5698b4be.jpeg)

---

<div class="post-metadata">

**Author:** ![vinesmsuic](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/vinesmsuic/32/17428_2.png) [@vinesmsuic](https://discuss.huggingface.co/u/vinesmsuic)\
**Post date:** [July 20, 2023, 5:32pm UTC](https://discuss.huggingface.co/t/i-got-authorization-error/32881/10 "2023-07-20T17:32:02Z")

</div>

You can use your WRITE User Access Tokens as password when `git push` prompted the password.

---

<div class="post-metadata">

**Author:** ![patrickocal](https://avatars.discourse-cdn.com/v4/letter/p/6f9a4e/32.png) [@patrickocal](https://discuss.huggingface.co/u/patrickocal)\
**Post date:** [November 26, 2023, 11:03am UTC](https://discuss.huggingface.co/t/i-got-authorization-error/32881/11 "2023-11-26T11:03:52Z")

</div>

Just spent a good part of my Sunday creating new ssh keys and setting up gpg. I finally pushed this morning and created a new dataset and got verified commit: fantastic.

Now I try to clone the repo created earlier and I get:

```auto
Error downloading object: kg-column-test.txt (da355c7): Smudge error: Error downloading kg-column-test.txt (da355c7ac1bc978121fda6c500c7631d55b71d30d19767c6ececd6e58af4a801): batch response: Authentication required: Password authentication in git is no longer supported. You must use a user access token or an SSH key instead. See https://huggingface.co/blog/password-git-deprecation

Errors logged to '/Users/patrickocal_mchome/Documents/stanford/gov-report-kgs/.git/lfs/logs/20231126T205837.279135.log'.

Use `git lfs logs last` to view the log.

error: external filter 'git-lfs filter-process' failed

fatal: kg-column-test.txt: smudge filter lfs failed

warning: Clone succeeded, but checkout failed.

You can inspect what was checked out with 'git status'

and retry with 'git restore --source=HEAD :/'

```

I am using ssh … I’ve deleted all my hugging face items in keychain (on OSX Sonoma). 😵‍💫

---

<div class="post-metadata">

**Author:** ![sridharps2](https://avatars.discourse-cdn.com/v4/letter/s/b38774/32.png) [@sridharps2](https://discuss.huggingface.co/u/sridharps2)\
**Post date:** [January 9, 2024, 7:51pm UTC](https://discuss.huggingface.co/t/i-got-authorization-error/32881/12 "2024-01-09T19:51:47Z")

</div>

i got the same “Authorization error” when trying trainer.push\_to\_hub(“my-repo”, token=\<write\_token\>). The same works for dataset.push\_to\_hub(…) earlier in the code. i am using Google Colab and finetuning a Llama2-7b-hf model.  
i have a read\_token for downloading the meta/llama2-7b model and a write token to be able to push to the hub repo. i run huggingface-cli login() --token=\<write\_token\>, and the output shows login successful with write permission. However, when i run ‘whoami()’ later, the token shown is the read\_token with role=read.  
Is there a way to overcome this ? It has been quite frustrating, trying to push the finetuned model to the repo in huggingface hub

---

<div class="post-metadata">

**Author:** ![sridharps2](https://avatars.discourse-cdn.com/v4/letter/s/b38774/32.png) [@sridharps2](https://discuss.huggingface.co/u/sridharps2)\
**Post date:** [January 11, 2024, 1:53am UTC](https://discuss.huggingface.co/t/i-got-authorization-error/32881/13 "2024-01-11T01:53:40Z")

</div>

Hi @radames , push\_to\_hub with write token works for dataset.push\_to\_hub(“repo-name”, token=write\_token) or from tokenizer.push\_to\_hub(“repo-name”,use\_auth\_token=write\_token), but does not work for trainer.push\_to\_hub(“repo-name”, token=write\_token), where the trainer is from huggingface transformers library.  
All of this is being done on a Google Colab project for pushing a finetuned model to my huggingface repo, when i get the Authorization error.  
On examination of the python code of the library, there is no token passed, and the git push command seems to be failing authorization somewhere that i am not able to figure out why.
