participatory-planner / PUSH_TO_HUGGINGFACE.md
thadillo
Fix HuggingFace model cache permission error
18bfe26

How to Push to HuggingFace

The Issue

Git push to HuggingFace isn't prompting for authentication because we're in a non-interactive environment. Here's how to authenticate properly:


Solution: Use HuggingFace CLI to Login

Step 1: Login with HuggingFace CLI

Run this command in your terminal:

huggingface-cli login

When prompted:

  • Enter your new HuggingFace write token (the one you created after revoking the old one)
  • The token should start with hf_...
  • Choose Yes when asked to add token as git credential

This will:

  1. Store your HuggingFace token securely
  2. Configure git to use it for HuggingFace operations
  3. Enable pushing to your HuggingFace Space

Step 2: Push to HuggingFace

After logging in, push your changes:

cd /home/thadillo/MyProjects/participatory_planner
git push hf feature/sentence-level-categorization:main

This should now work without prompting!


Alternative: Manually Add HuggingFace Credential

If the CLI login doesn't work, you can manually add the credential:

# Add HuggingFace credential to git credentials file
echo "https://thadillo:[email protected]" >> ~/.git-credentials

Replace YOUR_NEW_HF_TOKEN with your actual HuggingFace token.

Then push:

git push hf feature/sentence-level-categorization:main

Alternative: Use Git with Token in URL (One-time)

If you prefer a one-time push without storing credentials:

cd /home/thadillo/MyProjects/participatory_planner

# Push with token embedded (replace YOUR_TOKEN)
git push https://thadillo:[email protected]/spaces/thadillo/participatory-planner feature/sentence-level-categorization:main

Warning: This doesn't store the credential, so you'll need to do this every time.


Verify the Push

After pushing successfully, verify:

  1. Check HuggingFace Space: https://huggingface.co/spaces/thadillo/participatory-planner
  2. Check Build Logs: https://huggingface.co/spaces/thadillo/participatory-planner/logs
  3. Verify Files Updated: The commit should show in the Space's Files tab

What Happens Next

Once pushed, HuggingFace will:

  1. Automatically rebuild your Space
  2. Apply all the security fixes
  3. Fix the deployment errors (TRANSFORMERS_CACHE, matplotlib, SQLite)

Don't forget: You still need to set the HuggingFace Spaces secrets (FLASK_SECRET_KEY and ADMIN_TOKEN) as described in SETUP_INSTRUCTIONS.md!


Quick Commands Summary

# Option 1: Login with HuggingFace CLI (recommended)
huggingface-cli login
git push hf feature/sentence-level-categorization:main

# Option 2: Manual credential file edit
echo "https://thadillo:[email protected]" >> ~/.git-credentials
git push hf feature/sentence-level-categorization:main

# Option 3: One-time push with token
git push https://thadillo:[email protected]/spaces/thadillo/participatory-planner feature/sentence-level-categorization:main

Troubleshooting

Error: "Authentication failed"

  • Double-check your HuggingFace token is correct
  • Ensure it's a write token (not read-only)
  • Verify the token hasn't expired

Error: "could not read Username"

  • This means git isn't getting credentials properly
  • Use huggingface-cli login to fix this

Error: "remote rejected"

  • Check you have write access to the Space
  • Verify the Space name is correct: thadillo/participatory-planner

Current Status

  • ✅ All changes committed to git
  • ✅ Pushed to GitHub successfully
  • Waiting for you to push to HuggingFace
  • ⏳ Waiting for HuggingFace Spaces secrets to be set

Follow the steps above to complete the deployment!