Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

empty string credential.helper causes IndexError when running huggingface-cli login #1858

Closed
xaptronic opened this issue Nov 23, 2023 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@xaptronic
Copy link

Describe the bug

Installing huggingface_hub in a fresh virtualenv and then running huggingface-cli login results in:

  File "/Users/alex/.pyenv/versions/3.10.7/envs/new-venv/lib/python3.10/site-packages/huggingface_hub/_login.py", line 290, in _login
    if _is_git_credential_helper_configured():
  File "/Users/alex/.pyenv/versions/3.10.7/envs/new-venv/lib/python3.10/site-packages/huggingface_hub/_login.py", line 326, in _is_git_credential_helper_configured
    helpers = list_credential_helpers()
  File "/Users/alex/.pyenv/versions/3.10.7/envs/new-venv/lib/python3.10/site-packages/huggingface_hub/utils/_git_credential.py", line 44, in list_credential_helpers
    item = line.split("=")[-1].split()[0]
IndexError: list index out of range

Debugging and searching led me to conclude that if credential.helper is set to an empty string, then the set comprehension which attempts to take the second value from a string split fails as there is no value.

Empty credential.helper is documented behaviour: git/git@2432137#diff-2df845161726b01749450b375f8358a4cbfde0be0ebd4b551a091df5bd221c48R109

Reproduction

Install huggingface_hub.

Add a credential.helper= to /etc/gitconfig

Run huggingface-cli login, paste a token etc - it should then fail when trying to add the token to git.

Logs

No response

System info

- huggingface_hub version: 0.19.4
- Platform: macOS-14.1.1-arm64-arm-64bit
- Python version: 3.10.7
- Running in iPython ?: No
- Running in notebook ?: No
- Running in Google Colab ?: No
- Token path ?: /Users/alex/.cache/huggingface/token
- Has saved token ?: False
- FastAI: N/A
- Tensorflow: N/A
- Torch: N/A
- Jinja2: 3.1.2
- Graphviz: N/A
- Pydot: N/A
- Pillow: 10.1.0
- hf_transfer: N/A
- gradio: N/A
- tensorboard: N/A
- numpy: 1.26.1
- pydantic: 2.5.0
- aiohttp: N/A
- ENDPOINT: https://huggingface.co
- HF_HUB_CACHE: /Users/alex/.cache/huggingface/hub
- HF_ASSETS_CACHE: /Users/alex/.cache/huggingface/assets
- HF_TOKEN_PATH: /Users/alex/.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
- HF_HUB_ETAG_TIMEOUT: 10
- HF_HUB_DOWNLOAD_TIMEOUT: 10
@xaptronic xaptronic added the bug Something isn't working label Nov 23, 2023
@SID262000
Copy link
Contributor

@xaptronic I would like to give it a try to resolve this issue, please feel free to assign it to me, Thanks!

@Wauplin
Copy link
Contributor

Wauplin commented Nov 24, 2023

Hi @xaptronic, sorry for the inconvenience and thanks for reporting! Looks like you've identified the correct problem.

And thank you @SID262000 for proposing your help so quickly! Please go ahead, I'll assign it to you. Open-source for the win! 🤗

@Wauplin
Copy link
Contributor

Wauplin commented Nov 27, 2023

Should be fixed thanks to @SID262000 in #1860! :)

@Wauplin Wauplin closed this as completed Nov 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants