⚡ ~/naveed Interview Prep
⚡ Portfolio Home ✍️ Engineering Blog Deep Dives 🎯 Interview Hub 998+ Scenarios ☸️ Kubernetes Mastery Hub 24 Modules 🎮 DevOps Arcade & Quizzes Subnet Blitz ⚡ 🗺️ DevOps Roadmaps PDFs & Guides 🤖 Morpheus Analysis AI Quant ↗ 🛠️ Developer Tools Utilities 🧪 Labs & Experiments 📄 Interactive CV & Certs 🔗 All Links & Socials ⚡ Join The Dispatch (Weekly SRE Newsletter) →
Staff SRE / Principal Architect [L3] Git Determine affected services based on changed paths Staff SRE Scenario [L3]

Q: A developer reports that `git push` is extremely slow (takes 5+ minutes) even for small commits. The repo itself is only 500 MB. How do you diagnose and fix this?

Slow pushes with small changesets typically aren't about bandwidth — the bottleneck is usually pack negotiation or server-side processing.

#Git #Determine affected services based on changed paths #L3 #Version Control #Collaboration
🎙️ Candidate Opening & Architectural Context
""When an engineer accidentally creates this branch or commit divergence, I walk them through safe recovery without data loss. The interviewer is testing: Debugging Git performance, understanding pack negotiation, and server-side issues.. I structure my answer around systematic triage first, root cause analysis second, and permanent remediation third.""
Advertisement

🛠️ Production Runbook & Step-by-Step Resolution

1️⃣

Initial Diagnostics & Root Cause Analysis

Slow pushes with small changesets typically aren't about bandwidth — the bottleneck is usually pack negotiation or server-side processing.

  • Enable Git tracing:
  • Check where time is spent:
  • "Counting objects" / "Compressing objects" takes minutes? — the local repo has too many loose objects or a bloated object database. Run git gc and git repack -a -d --depth=250 --window=250.
  • Negotiation phase is slow? — Git exchanges "have/want" lists with the server. With many branches and tags, this can be large. Prune stale remote refs: git remote prune origin. Delete merged branches.
  • Server-side hooks are slow? — pre-receive or update hooks (code scanning, large file checks, CI triggers) run synchronously. Check with the platform admin.
  • Network latency? — curl -o /dev/null -w "time_connect: %{time_connect}\ntime_total: %{time_total}\n" to check.
  • Check for large files in recent commits:
2️⃣

Remediation & Permanent Safeguards

Diagnosis: This shows every step: DNS resolution, TLS handshake, ref advertisement, pack negotiation, and upload. A single large blob forces a big packfile upload. Fixes: If the root cause is many stale refs, regularly run git fetch --prune and delete merged feature branches both locally and remotely.

GIT_TRACE=1 GIT_TRANSFER_TRACE=1 GIT_CURL_VERBOSE=1 git push origin main
  • Run git gc --aggressive if the local object store is fragmented.
  • Enable push.negotiate (Git 2.36+): git config push.negotiate true — uses a more efficient negotiation algorithm.
  • Use SSH instead of HTTPS if TLS overhead is contributing.
  • Push only the branch you need: git push origin main instead of git push --all.
  • Consider --thin (default) — verify it's not disabled. Thin packs send deltas against objects the server already has, reducing transfer size.
  • Check for server-side quotas or throttling — some Git hosting providers rate-limit pushes or run expensive server-side operations.
💡 The Senior SRE Gold Nugget (Key Architectural Takeaway)
"Pro-Tip: Enable Git tracing:."
⚡ 60-Second Elevator Pitch Talking Points
  • Enable Git tracing:
  • Check where time is spent:
  • "Counting objects" / "Compressing objects" takes minutes? — the local repo has too many loose obj...
Advertisement
Want more Git scenarios?
Explore our complete collection of scenario-based Git interview runbooks.
Browse All Git Questions →

📚 Related Production Scenarios in Git