--- name: orbites-vault-git description: Git operations for OrbitOS vault — init, push large repos with many files, .gitignore for monorepo, HTTP 413 workarounds, project deploy separation. Use when setting up, pushing, or troubleshooting the OrbitOS vault git repo. --- # OrbitOS: Vault Git Management ## Architecture — Single Vault Repo + Separate Deploy Repos The OrbitOS vault is a **single git monorepo** that tracks EVERYTHING — metadata (inbox, daily, wiki, plans) AND all project source code, images, CSVs, PDFs, documents. Clone once and you have the complete workspace. ``` ~/vault/ ← Git repo A (vault — everything) ├── .gitignore ← Build artifacts only ├── 00_Inbox/ ├── 10_Daily/ ├── 20_Projects/ │ ├── CrowdSight/ ← tracked by vault git │ ├── OrbitOS/ │ ├── moreminimore/ │ └── ... (all 10 projects) ├── 90_Plans/ └── 99_System/ ``` Project repos in `~/Gitea/` remain separate for **deploy-only pushes**: ``` ~/Gitea/MiroFish/.git/ ← Git repo B (deploy — CrowdSight) ~/Gitea/moreminimore-service-system/ ← Git repo C (deploy — moreminimore) ``` ## Vault .gitignore — Build Artifacts ONLY The `.gitignore` must exclude **only build artifacts**. NEVER exclude source files, images, PDFs, CSVs, or data files — the vault is a complete snapshot. ```gitignore # Python build __pycache__/ *.py[cod] *$py.class *.so .env .venv/ venv/ *.egg-info/ dist/ build/ # Node build node_modules/ # OS .DS_Store Thumbs.db # IDE .idea/ .vscode/ *.swp # AI agent state .omc/ .hermes/ ``` ### DO NOT add: ``` *.csv ❌ — CSV data must be tracked *.pdf ❌ — documents must be tracked *.png *.jpg ❌ — images must be tracked *.mq5 *.ex5 ❌ — MT5 sources must be tracked 20_Projects/*/ ❌ — projects must be tracked ``` ## Init Vault Git ```bash cd ~/vault # Only if truly starting fresh: rm -rf .git && git init # Or use existing: git init # if no .git yet # First commit git add . git commit -m "init: vault — all projects + metadata" git remote add origin https://git.moreminimore.com/kunthawat/vault.git git push -u origin main --force ``` ## HTTP 413 — Fixes in Priority Order If `git push` fails with HTTP 413 ("Request Entity Too Large"): ### ① Increase buffer (first try): ```bash git config http.postBuffer 524288000 git push ``` ### ② Push in split chunks: Commit one project or one file at a time, pushing each incrementally: ```bash git add 20_Projects/CrowdSight/ git commit -m "add: CrowdSight data/assets" git push ``` ### ③ For very large repos, split per-file: ```bash for f in $(git diff --cached --name-only); do git add "$f" && git commit -m "add: $(basename "$f")" && git push done ``` Expect ~600+ small commits — acceptable for initial setup. Optionally squash later with interactive rebase. ### ⚠️ Pitfall: False HTTP 413 `git push` may show HTTP 413 even when the push actually succeeded — the sideband connection closes before the client receives the success response. **Always verify** with: ```bash git fetch origin git log origin/main --oneline | head -3 ``` ### ④ DO NOT nuke `.git` and re-init: `rm -rf .git && git init` destroys commit history and force-pushes can corrupt the remote. Only use this as a last resort when the local state is irrecoverable and no history matters. ## Project Deploy Workflow **Vault** tracks all code changes. **Project repos** in ~/Gitea/ push only deploy-ready releases: ```bash # Work normally in vault cd ~/vault/20_Projects/CrowdSight # edit code... # Commit in vault (tracks everything) cd ~/vault git add . && git commit -m "feat: new simulation engine" && git push # When ready for deploy — copy to project repo cp -r ~/vault/20_Projects/CrowdSight/src/ ~/Gitea/MiroFish/ cd ~/Gitea/MiroFish git add . && git commit -m "release: v2.1" && git push origin main ``` ## Nested .git Handling When copying projects from Gitea into vault: 1. **Remove** `20_Projects//.git` from the vault copy — git creates gitlinks (mode 160000) otherwise 2. **Keep** the original `.git` in `~/Gitea//` — used for deploy pushes only 3. Projects without `.git` in source (PreTradeChecklist, TPOsystem, grid-order-flow-mt5, moreminimore) are tracked as regular folders by vault git ## Verification Checklist After pushing: - [ ] `.gitignore` has build artifacts only (no `*.pdf`, `*.png`, `*.csv` patterns) - [ ] `git ls-files | wc -l` shows ~2,000+ files including all images, CSVs, PDFs - [ ] `git fetch origin && git diff origin/main` is empty - [ ] `du -sh .git/` shows ~150-200MB (normal for full vault with assets) - [ ] Project repos in `~/Gitea/` still have their `.git` for deploy pushes