I got Authorization error

I did all steps in the tutorial, but when I execute git push I got the error:

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

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

Did you find a solution?

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?

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

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

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

1 Like

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

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

1 Like

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

1 Like

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

2 Likes

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:

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). :face_with_spiral_eyes:

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

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.