Q: You're setting up a Git server for an organization. What are the differences between the four transfer protocols Git supports (Local, HTTP, SSH, Git), and which would you choose?
Git supports four protocols for communication between client and server:
Want to master this scenario in a live sandbox? KodeKloud's Advanced Git Workflows, Rebase & Interactive Diagnostics covers this exact problem with hands-on terminal drills.
🛠️ Production Runbook & Step-by-Step Resolution
Direct Answer: "Git is an immutable directed acyclic graph (DAG); knowing commands like git reflog means you never truly lose commits. The interviewer is testing: Understanding of Git transport protocols and security considerations.. I structure my answer around systematic triage first, root cause analysis second, and permanent remediation third."
Initial Diagnostics & Root Cause Analysis
Git supports four protocols for communication between client and server:
- Uses the filesystem directly. No network, no authentication beyond filesystem permissions.
- Fast, simple, but only works on the same machine or NFS mounts.
- Use case: shared server with SSH access where repos live on a mounted filesystem.
- Runs over standard HTTP(S) — passes through firewalls, proxies, and load balancers.
- Authentication via username/password, tokens, or SSO.
- Smart HTTP (default since Git 1.6.6) negotiates only needed objects — efficient as SSH.
- Recommended for most organizations — works everywhere, supports all auth methods, TLS for encryption.
- Encrypted, authenticated via SSH keys. No anonymous access possible.
Remediation & Permanent Safeguards
1. Local protocol (file:// or just a path): 2. HTTP/HTTPS (Smart HTTP): 3. SSH: 4. Git protocol (git://): For a new organization: Smart HTTPS with token-based authentication (PATs or OAuth via SSO). It works through corporate proxies, supports granular permissions via the hosting platform, and uses TLS. SSH as a secondary option for developers who prefer it. Never use the raw Git protocol.
git clone /srv/git/repo.git
- Well-understood security model; keys can be centrally managed (LDAP, SSO-issued certificates).
- No built-in authorization granularity — you either have shell access or you don't. Tools like Gitolite or platform features (GitHub, GitLab) add per-repo/per-branch authorization on top.
- Best for: internal teams where everyone has SSH keys, and you want simplicity without HTTP infrastructure.
- Unauthenticated, unencrypted, read-only by convention. Runs on port 9418.
- Fastest protocol (no encryption overhead), but no security.
- Almost never used today. Was useful for public read-only mirrors; HTTPS has replaced it.
- Uses the filesystem directly. No network, no authentication beyond filesystem permissions.
- Fast, simple, but only works on the same machine or NFS mounts.
- Use case: shared server with SSH access where repos live on a mounted filesystem.
Senior hiring managers and bar raisers evaluate how you prioritize during outages. Avoid these common anti-patterns:
-
Running raw git push --force rather than git push --force-with-lease on shared team feature branches when configuring Youre setting server
git push --forceunconditionally overwrites remote commits made by teammates, whereas--force-with-leaseaborts if the remote ref was updated. - Resolving complex merge conflicts with blind checkout overwrite strategies without running unit tests when configuring Youre setting server Unilateral conflict resolution frequently clobbers complementary logic introduced in parallel feature branches, creating regression bugs.
-
Discarding corrupted working directories prematurely instead of recovering lost state using git reflog when configuring Youre setting server
git reflogtracks every HEAD movement, allowing instant recovery of discarded commits, botched rebases, or deleted local branches. - Disabling branch protection rules and mandatory PR approval reviews on shared release branches when configuring Youre setting server Without branch protection, developers can bypass CI validation gates and push untested code directly to production branches.