Cant push my model using git

When I try to push it shows me that error
Enumerating objects: 4, done.
Counting objects: 100% (4/4), done.
Delta compression using up to 8 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 3.89 KiB | 3.89 MiB/s, done.
Total 3 (delta 1), reused 0 (delta 0), pack-reused 0

remote: -------------------------------------------------------------------------
remote: You are not authorized to push to this repo.
remote: Make sure that you are properly logged in.
remote: -------------------------------------------------------------------------

To https://huggingface.co/dev-gaju/Squad-DistilBert
! [remote rejected] main → main (pre-receive hook declined)
error: failed to push some refs to ‘https://huggingface.co/dev-gaju/Squad-DistilBert’

hugging face env:
Copy-and-paste the text below in your GitHub issue.

`- huggingface_hub version: 0.18.0

  • Platform: Windows-10-10.0.22621-SP0
  • Python version: 3.9.13
  • Running in iPython ?: No
  • Running in notebook ?: No
  • Running in Google Colab ?: No
  • Token path ?: C:\Users\gazur.cache\huggingface\token
  • Has saved token ?: True
  • Who am I ?: dev-gaju
  • Configured git credential helpers: manager, store
  • FastAI: N/A
  • Tensorflow: N/A
  • Torch: 2.1.0
  • Jinja2: 3.1.2
  • Graphviz: N/A
  • Pydot: N/A
  • Pillow: 10.0.1
  • hf_transfer: N/A
  • gradio: N/A
  • tensorboard: N/A
  • numpy: 1.26.1
  • pydantic: 2.5.2
  • aiohttp: 3.9.1
  • HUGGINGFACE_HUB_CACHE: C:\Users\gazur.cache\huggingface\hub
  • HUGGINGFACE_ASSETS_CACHE: C:\Users\gazur.cache\huggingface\assets
  • HF_TOKEN_PATH: C:\Users\gazur.cache\huggingface\token
  • HF_HUB_OFFLINE: False
  • HF_HUB_DISABLE_TELEMETRY: False
  • HF_HUB_DISABLE_PROGRESS_BARS: None
  • HF_HUB_DISABLE_SYMLINKS_WARNING: False
  • HF_HUB_DISABLE_EXPERIMENTAL_WARNING: False
  • HF_HUB_DISABLE_IMPLICIT_TOKEN: False
  • HF_HUB_ENABLE_HF_TRANSFER: False`

Looks like it is a private repository (at least I can’t open the link), did you log in with your access token? You should probably use the huggingface-cli login command beforehand.

Yes, I used my access token to log in, Should I use my access token before every push? Manually adding to the repository works for me but not with the command line.

No no, logging in once should be enough, I just thought this might be the cause because of the “not authorized” error. Maybe this other thread helps, you can also try with SSH authentication as one of the users suggests.

If anyone else is having problems with pushing to your repo, be sure to set your API Key to “write”. A little thing that you may not think about while committing…

2 Likes