GitHub Actions Auto-Sync Setup Guide
This guide walks you through setting up automatic synchronization from your GitHub repository to your Hugging Face Space using GitHub Actions.
β What's Already Done
- Created GitHub repository directory:
F:\github-fleetmind-team - Copied all HF Space code to GitHub repo
- Created GitHub Actions workflows:
.github/workflows/sync-to-huggingface.yml- Auto-sync on push.github/workflows/check-file-size.yml- Check file sizes on PRs
π― What You Need to Do Now
STEP 3: Get Your Hugging Face Token
Click: "Create new token"
Fill in:
- Name:
GitHub Actions Sync - Type: Write (important!)
- Scope: Select all or at least:
- β Write access to repos
- β Write access to spaces
- Name:
Click: "Generate token"
COPY THE TOKEN (you won't see it again!)
- It looks like:
hf_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
- It looks like:
STEP 4: Push Code to GitHub
Open PowerShell or Command Prompt:
# Navigate to the GitHub repo
cd F:\github-fleetmind-team
# Add all files
git add .
# Commit
git commit -m "Initial commit: FleetMind MCP with GitHub Actions sync"
# Add GitHub remote (REPLACE YOUR-USERNAME with your actual GitHub username)
git remote add origin https://github.com/YOUR-USERNAME/fleetmind-mcp.git
# Push to GitHub
git push -u origin main
If you get an error about 'main' branch:
# Rename branch to main
git branch -M main
# Push again
git push -u origin main
STEP 5: Add HF_TOKEN as GitHub Secret
Go to your GitHub repo:
- URL:
https://github.com/YOUR-USERNAME/fleetmind-mcp
- URL:
Click: Settings (top right of repo page)
In left sidebar, click:
- Secrets and variables β Actions
Click: "New repository secret"
Fill in:
- Name:
HF_TOKEN - Secret: Paste the Hugging Face token you copied in Step 3
- Name:
Click: "Add secret"
STEP 6: Add HF Space as Git Remote (Optional but Recommended)
This allows you to manually push to HF Space if needed:
cd F:\github-fleetmind-team
# Add HF Space as a remote
git remote add space https://huggingface.co/spaces/MCP-1st-Birthday/fleetmind-dispatch-ai
# Verify remotes
git remote -v
You should see:
origin https://github.com/YOUR-USERNAME/fleetmind-mcp.git (fetch)
origin https://github.com/YOUR-USERNAME/fleetmind-mcp.git (push)
space https://huggingface.co/spaces/MCP-1st-Birthday/fleetmind-dispatch-ai (fetch)
space https://huggingface.co/spaces/MCP-1st-Birthday/fleetmind-dispatch-ai (push)
STEP 7: Test the Auto-Sync
Let's make a test change to verify everything works:
cd F:\github-fleetmind-team
# Make a small change to README
echo "\n\n## π€ Auto-Synced with GitHub Actions" >> README.md
# Commit the change
git add README.md
git commit -m "Test: GitHub Actions auto-sync"
# Push to GitHub
git push origin main
What happens next:
- β Code pushes to GitHub
- β GitHub Actions triggers automatically
- β Workflow runs and pushes to HF Space
- β HF Space rebuilds with new code
Check the progress:
On GitHub:
- Go to:
https://github.com/YOUR-USERNAME/fleetmind-mcp/actions - You'll see "Sync to Hugging Face Space" workflow running
- Wait for green checkmark β
- Go to:
On Hugging Face:
- Go to: https://huggingface.co/spaces/MCP-1st-Birthday/fleetmind-dispatch-ai
- Check the "Files" tab - you should see the new commit
- Space will rebuild automatically
π Success! Your Setup is Complete
From now on:
Team Members Workflow:
# 1. Clone the GitHub repo (one time)
git clone https://github.com/YOUR-USERNAME/fleetmind-mcp.git
cd fleetmind-mcp
# 2. Make changes
# ... edit files ...
# 3. Commit and push to GitHub
git add .
git commit -m "Add new feature"
git push origin main
# 4. GitHub Actions automatically syncs to HF Space
# β¨ DONE! Nothing else needed!
What GitHub Actions Does:
Every time someone pushes to the main branch on GitHub:
- β GitHub Actions workflow starts
- β Checks out the code
- β Pushes to HF Space using your HF_TOKEN
- β HF Space rebuilds automatically
- β Your app goes live with the new changes
π Adding Team Members
On GitHub (Full Access):
- Go to:
https://github.com/YOUR-USERNAME/fleetmind-mcp/settings/access - Click "Add people"
- Enter their GitHub username
- Select role: Write (they can push directly)
- Click "Add"
On Hugging Face (Documentation Only):
Team members don't need HF access! The GitHub Actions bot handles all HF Space updates using your HF_TOKEN.
Just make sure they're listed in the README:
- Edit
README.mdlines 29-42 - Add their real names and HF usernames
- Commit and push
π§ Troubleshooting
β "Error: Process completed with exit code 128"
Solution: Check that HF_TOKEN is correctly set in GitHub Secrets
- Go to:
https://github.com/YOUR-USERNAME/fleetmind-mcp/settings/secrets/actions - Verify
HF_TOKENexists - If not, add it (see Step 5)
β "Error: failed to push some refs"
Solution: HF Space has newer commits
# Pull from HF Space first
git pull space main --allow-unrelated-histories
# Then push again
git push origin main
β GitHub Actions workflow doesn't run
Solution: Check that workflow file is in correct location
- Must be:
.github/workflows/sync-to-huggingface.yml - Check GitHub repo β Actions tab
- Click "I understand my workflows, go ahead and enable them"
β Files larger than 10MB
Solution: Use Git LFS
# Install Git LFS
git lfs install
# Track large files
git lfs track "*.psd" # Example: Photoshop files
git lfs track "*.pkl" # Example: Model files
# Commit .gitattributes
git add .gitattributes
git commit -m "Add Git LFS tracking"
git push
π Advanced: Manual Sync
If you ever need to manually sync to HF Space:
cd F:\github-fleetmind-team
# Option 1: Push directly to HF Space remote
git push space main
# Option 2: Trigger GitHub Actions manually
# Go to: https://github.com/YOUR-USERNAME/fleetmind-mcp/actions
# Click "Sync to Hugging Face Space"
# Click "Run workflow" β "Run workflow"
π Workflow Diagram
Developer β GitHub Repo β GitHub Actions β HF Space β Live App
β β β β β
Codes Receives Triggers Updates Rebuilds
Push Event Sync with new & Serves
code
π― Benefits of This Setup
β Team Collaboration: Everyone works on GitHub (familiar workflow) β Automatic Deployment: Push to GitHub = Deploy to HF Space β No Permission Issues: GitHub Actions uses your HF_TOKEN β Version Control: Full history on GitHub β CI/CD Ready: Can add tests, linting, etc. β Hackathon Compliant: Final Space is on HF organization
π Next Steps
After setup is complete:
- Invite team members to GitHub repo
- Update README with team information
- Continue building your project
- Create demo video (1-5 minutes)
- Post on social media
- Submit before November 30, 2025
π Resources
- GitHub Actions Docs: https://docs.github.com/en/actions
- HF Spaces Docs: https://huggingface.co/docs/hub/spaces
- Git LFS: https://git-lfs.github.com/
- Hackathon Info: https://huggingface.co/MCP-1st-Birthday
You're all set! Happy coding! π