# πŸ”§ Git Configuration - HF Spaces as Default Remote **Date:** 3 octobre 2025 **Status:** βœ… Configured --- ## πŸ“Š Current Configuration ### Remote Setup ```bash space https://huggingface.co/spaces/Luigi/rts-commander (fetch) space https://huggingface.co/spaces/Luigi/rts-commander (push) ``` ### Branch Tracking ```bash * master [space/main] - Tracks HF Spaces main branch ``` ### Push Configuration ```bash push.default = upstream ``` --- ## βœ… What This Means ### Simple Workflow Now Available **Before:** ```bash git push space master:main --force ``` **Now:** ```bash git push ``` That's it! πŸŽ‰ --- ## πŸš€ New Deployment Workflow ### 1. Make Changes ```bash cd /home/luigi/rts/web # Edit your files vim app.py vim static/game.js # etc. ``` ### 2. Commit Changes ```bash git add . git commit -m "feat: Add new feature" ``` ### 3. Push to HF Spaces ```bash 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 status` shows if you're ahead/behind HF Spaces - `git pull` fetches from HF Spaces - `git push` pushes 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/main` mapping is automatic --- ## πŸ“ Configuration Commands Used ```bash # 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 ```bash # 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 ```bash git branch -vv # Output: * master 1b4f6c0 [space/main] docs: Add... ``` ### Check Configuration ```bash 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 ```bash git pull # Equivalent to: git pull space main ``` ### Push Changes to HF Spaces ```bash git push # Equivalent to: git push space master:main ``` --- ## πŸ› Troubleshooting ### If Push Fails **Check tracking:** ```bash git branch -vv ``` **Re-configure if needed:** ```bash git branch --set-upstream-to=space/main master ``` ### If Pull Fails **Fetch first:** ```bash git fetch space git branch -vv ``` **Force pull if diverged:** ```bash git pull --rebase ``` ### If You Need to Push Elsewhere **Override with explicit remote:** ```bash 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 guide - `web/DEPLOY_QUICK.md` - Quick reference - `HF_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