Hugging Face Hub: Important Git Authentication Changes

Published August 25, 2023
Update on GitHub

Because we are committed to improving the security of our services, we are making changes to the way you authenticate when interacting with the Hugging Face Hub through Git. Starting from October 1st, 2023, we will no longer accept passwords as a way to authenticate your command-line Git operations. Instead, we recommend using more secure authentication methods, such as replacing the password with a personal access token or using an SSH key.

Background

In recent months, we have implemented various security enhancements, including sign-in alerts and support for SSH keys in Git. However, users have still been able to authenticate Git operations using their username and password. To further improve security, we are now transitioning to token-based or SSH key authentication. Token-based and SSH key authentication offer several advantages over traditional password authentication, including unique, revocable, and random features that enhance security and control.

Action Required Today

If you currently use your HF account password to authenticate with Git, please switch to using a personal access token or SSH keys before October 1st, 2023.

Switching to personal access token

You will need to generate an access token for your account; you can follow https://huggingface.co/docs/hub/security-tokens#user-access-tokens to generate one.

After generating your access token, you can update your Git repository using the following commands:

$: git remote set-url origin https://<user_name>:<token>@huggingface.co/<repo_path>
$: git pull origin

where <repo_path> is in the form of:

  • <user_name>/<repo_name> for models
  • datasets/<user_name>/<repo_name> for datasets
  • spaces/<user_name>/<repo_name> for Spaces

If you clone a new repo, you can just input a token in place of your password when your Git credential manager asks you for your authentication credentials.

Switching to SSH keys

Follow our guide to generate an SSH key and add it to your account: https://huggingface.co/docs/hub/security-git-ssh

Then you'll be able to update your Git repository using:

$: git remote set-url origin git@hf.co:<repo_path> # see above for the format of the repo path

Timeline

Here's what you can expect in the coming weeks:

  • Today: Users relying on passwords for Git authentication may receive emails urging them to update their authentication method.
  • October 1st: Personal access tokens or SSH keys will be mandatory for all Git operations.

For more details, reach out to HF Support to address any questions or concerns at website@huggingface.co

Community

и как это г использовать

This is an awful decision

this is a shittiest one!

·

Thanks brother, you saved me hours of headaches :D

passwordless authentication is more secure, in fact using token as password makes it "bruteforceless"

this shit sucks

give us an exmaple please?
its very confusing

what exactly do i put?
what constitutes repo?

É de cair o cú da bunda

For someone struggling like me, try this :

pip install -U "huggingface_hub[cli]"

hf auth login --add-to-git-credential
paste your token and you are set

·

非常奈斯,还得是你啊,把我折腾够呛

说一说流程吧:首先你得在你电脑的该文件夹点一下输入cmd,然后git clone https://huggingface.co/spaces/名字/仓库名,然后会在你该文件夹下载并创建仓库,然后你把代码复制丢这个仓库文件里(如果你是国网那你还得翻墙/代理)然后初始化 Git LFS (用来管理大文件,比如 .onnx 模型)--git lfs install,然后git lfs track "*.onnx"这一步很重要,不然模型传不上去,然后把所有文件加入待上传列表git add .,然后git commit -m "deploy",然后git remote set-url origin https://名字:令牌@huggingface.co/spaces/名字/仓库名.git然后git push等待上传完毕(不足之处请指点)

Sign up or log in to comment