Spaces:
Sleeping
Sleeping
๐ง Git Configuration - HF Spaces as Default Remote
Date: 3 octobre 2025
Status: โ
Configured
๐ Current Configuration
Remote Setup
space https://huggingface.co/spaces/Luigi/rts-commander (fetch)
space https://huggingface.co/spaces/Luigi/rts-commander (push)
Branch Tracking
* master [space/main] - Tracks HF Spaces main branch
Push Configuration
push.default = upstream
โ What This Means
Simple Workflow Now Available
Before:
git push space master:main --force
Now:
git push
That's it! ๐
๐ New Deployment Workflow
1. Make Changes
cd /home/luigi/rts/web
# Edit your files
vim app.py
vim static/game.js
# etc.
2. Commit Changes
git add .
git commit -m "feat: Add new feature"
3. Push to HF Spaces
git push
Done! Your changes are now on Hugging Face Spaces and will trigger a rebuild.
๐ How It Works
Branch Tracking
Your local master branch now tracks space/main:
git statusshows if you're ahead/behind HF Spacesgit pullfetches from HF Spacesgit pushpushes to HF Spaces
Push Strategy
With push.default = upstream:
- Git automatically pushes to the tracked upstream branch
- No need to specify remote or branch names
masterโspace/mainmapping is automatic
๐ Configuration Commands Used
# Set upstream tracking
git branch --set-upstream-to=space/main master
# Configure push default
git config push.default upstream
# Verify configuration
git branch -vv
git status
๐ Full Example Workflow
# Navigate to project
cd /home/luigi/rts/web
# Check status
git status
# Output: "Votre branche est ร jour avec 'space/main'"
# Make changes
echo "console.log('New feature');" >> static/game.js
# Stage changes
git add static/game.js
# Commit
git commit -m "feat: Add logging"
# Push to HF Spaces (automatic!)
git push
# HF Spaces will automatically rebuild
๐ฏ Benefits
Before Configuration
- โ Long command:
git push space master:main --force - โ Easy to forget branch mapping
- โ Risk of pushing to wrong branch
- โ Verbose and error-prone
After Configuration
- โ
Simple command:
git push - โ Automatic branch mapping
- โ Git tracks upstream status
- โ Clean and intuitive
๐ง Advanced Commands
Check Current Tracking
git branch -vv
# Output: * master 1b4f6c0 [space/main] docs: Add...
Check Configuration
git config --get push.default
# Output: upstream
git config --get branch.master.remote
# Output: space
git config --get branch.master.merge
# Output: refs/heads/main
Pull Changes from HF Spaces
git pull
# Equivalent to: git pull space main
Push Changes to HF Spaces
git push
# Equivalent to: git push space master:main
๐ Troubleshooting
If Push Fails
Check tracking:
git branch -vv
Re-configure if needed:
git branch --set-upstream-to=space/main master
If Pull Fails
Fetch first:
git fetch space
git branch -vv
Force pull if diverged:
git pull --rebase
If You Need to Push Elsewhere
Override with explicit remote:
git push origin master # Push to different remote
git push space main # Push to different branch
๐ Status Interpretation
"Votre branche est ร jour avec 'space/main'"
โ Everything synced, ready to push new changes
"Votre branche est en avance sur 'space/main' de 1 commit"
๐ผ You have local commits to push: git push
"Votre branche est en retard sur 'space/main' de 1 commit"
๐ฝ HF Spaces has changes you don't have: git pull
"Votre branche et 'space/main' ont divergรฉ"
โ ๏ธ Both have different commits: git pull --rebase then git push
๐ Related Documentation
web/docs/DEPLOYMENT_HF_SPACES.md- Complete deployment guideweb/DEPLOY_QUICK.md- Quick referenceHF_SPACES_DEPLOYED.md- Deployment summary
โ Configuration Complete!
You can now use git push to deploy directly to Hugging Face Spaces! ๐
Space URL: https://huggingface.co/spaces/Luigi/rts-commander
App URL: https://Luigi-rts-commander.hf.space