# Design a Git hosting service like GitHub: system design interview question

> Large Git transfers, concurrent ref updates, durable objects, and safe object removal.

Source: https://sysround.com/questions/design-git-hosting-service-like-github
Updated: 2026-11-05


Difficulty: hard. Levels: Senior, Staff+.

## How the interviewer opens it

"Design a service that hosts Git repositories. Users must clone repositories, fetch changes, and push updates."

## What to clarify first

- Protocol and repository access
- Repository count and size
- Operation volume and read:write mix
- Transfer sizes
- Latency
- Consistency and availability
- Durability and deployment
- Push behavior
- Object retention
- Identity and exclusions

## Scope of a strong answer

Core requirements:

- Create repositories and enforce repository access permissions
- Serve clone and fetch operations through Git over HTTPS
- Accept concurrent pushes without losing accepted updates
- Keep accepted repository data durable

Usually out of scope:

- Pull requests and code review
- CI jobs
- Git LFS
- A web code viewer
- A new version control protocol

## What interviewers probe

### Concurrent branch updates

Two valid pushes can start from the same branch tip. The service must preserve Git semantics without serializing entire transfers.

### When a push succeeds

A ref can expose objects that storage has not made durable. Failover can also permit two workers to change one repository.

### Large clone and fetch requests

Transfer counts hide large differences in bytes and CPU cost. Pack construction can overload a worker before network capacity runs out.

### Old objects and repository size

Force pushes remove refs while readers still need old objects. Object cleanup also needs temporary space and competes with live traffic.

## Common mistakes

- Treats a Git repository as one file and copies it for every operation.
- Uses last-writer-wins updates for branch refs.
- Reports push success before both objects and refs meet the durability requirement.
- Assumes an object store directly provides the filesystem behavior that standard Git tools need.
- Sizes the service from request counts without transfer sizes or pack construction costs.
- Removes unreachable objects without protecting old ref tips and active transfers.

## The bar by level

- **Senior:** Defines push publication order and atomic multi-ref behavior. Handles force pushes, failed responses, failover, large transfers, and safe object removal.
- **Staff+:** Defines enforceable ownership and storage guarantees. Compares storage designs and plans live repository moves. Controls maintenance cost while preserving consistency and latency.

Practice this question with an AI interviewer: https://sysround.com/practice/new?problem=git-repository-hosting


---
SysRound (https://sysround.com) is an AI practice tool for system design interviews. It has a voice or typed AI interviewer and a shared whiteboard. At the end, you get feedback on each skill and a model answer. The AI feedback can be wrong.
