A GitHub Action that syncs your repository to Hugging Face Hub π€
Uses the official HF CLI via uvx for fast, reliable deployments to Spaces, Models, or Datasets.
Add your HF token as a GitHub secret (HF_TOKEN), then:
name: Sync to Hugging Face
on:
push:
branches: [main]
jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: huggingface/hub-sync@main
with:
github_repo_id: ${{ github.repository }}
huggingface_repo_id: username/repo-name
hf_token: ${{ secrets.HF_TOKEN }}- uses: huggingface/hub-sync@main
with:
# Required
github_repo_id: ${{ github.repository }}
huggingface_repo_id: username/repo-name
hf_token: ${{ secrets.HF_TOKEN }}
# Optional
repo_type: space # space | model | dataset (default: space)
space_sdk: gradio # gradio | streamlit | docker | static (default: gradio)
private: false # Create as private (default: false)
subdirectory: '' # Sync only this folder (default: '' = root)- Automatic exclusions β
.github/and.git/filtered via--exclude - True mirroring β deletes removed files from HF using
--delete="*" - Subdirectory support β perfect for monorepos
- Custom commit messages β synced commits say "Sync from GitHub via hub-sync"