You are in the lookout for a free, serverless git server? Say no more! That’s exactly what S3 Git Server is, a fully managed Git hosting solution that runs entirely on AWS Lambda and S3.
Serverless Git Hosting
Traditional Git servers like GitLab, Gitea, or even pure Git require dedicated servers, databases, and ongoing maintenance. Even self-hosted solutions demand server provisioning and management, database setup and maintenance, storage configuration, security hardening, backup strategies, and scaling considerations. For small personal projects, this is just overkill. You just want to host some code repositories without the operational burden, but want full privacy and control over your data.
S3 Git Server is a serverless Git server that runs entirely on AWS Lambda with S3 as storage, designed for teams seeking Git hosting without infrastructure complexity. It offers zero maintenance by running on AWS Lambda so there are no servers to manage, is secure by default through IAM roles and API Gateway authentication, uses S3 for durable storage with automatic replication, auto-scales to handle any load thanks to Lambda’s serverless scaling, and is cost-effective since you pay only for what you use.
This solution is ideal for small development teams who want Git hosting without any DevOps overhead, personal or side projects needing private repositories, test environments that require isolated repositories, organizations looking to avoid the costs of enterprise Git solutions, and anyone already using AWS who wants to leverage their existing infrastructure with minimal setup.
Important Limitations
⚠️ Not for large repositories or binary-heavy projects. AWS Lambda has payload limits:
- API Gateway: 10MB maximum request/response size
- Lambda Function: 6MB maximum payload size
This means:
- Large commits may fail if they exceed limits
- Binary files and large repositories might cause issues
- Not suitable for repositories with very large files or frequent large commits
Best for: Text-based code repositories, small to medium development projects, private repositories with normal development workflows.
Getting Started
1. Deploy the Infrastructure
The entire infrastructure is defined as code using Terraform:
cd terraform
terraform init
terraform plan
terraform apply
2. Get Your API Endpoint
terraform output api_gateway_url
3. Create Your First Repository
curl -X POST -u git:password123 https://your-api-gateway-url/repos/my-first-repo
4. Clone and Start Using
# Clone the repository
git clone https://git:password123@your-api-gateway-url/repos/my-first-repo
# Make changes and push
cd my-first-repo
echo "# My Project" > README.md
git add README.md
git commit -m "Initial commit"
git push origin main
Authentication & Security
The server uses HTTP Basic Authentication with configurable users. Default credentials are git:password123
, but you should change these in production by modifying the git_users
variable in terraform/terraform.tfvars
.
The Lambda function runs with minimal IAM permissions, following the principle of least privilege.
How It Works Under the Hood
While I’ve been using GitHub and GitLab for years, I always felt the need to dig deeper into Git fundamentals. This project was my opportunity to learn Git internals by implementing the Git HTTP smart protocol from scratch in pure Python with no external dependencies:
- Git Protocol Handler (
git_protocol.py
): Implements the Git HTTP smart protocol for clone, fetch, and push operations - S3 Storage Backend (
s3_storage.py
): Handles Git object storage and retrieval from S3 - Authentication (
auth.py
): Manages user authentication and authorization - Lambda Function (
lambda_function.py
): Orchestrates the entire Git server logic
Git objects are stored compressed in S3, maintaining compatibility with standard Git clients while leveraging S3’s durability and cost-effectiveness.
Configuration & Customization
The Terraform configuration allows extensive customization:
# AWS region
region = "us-east-1"
# S3 bucket for Git repositories
bucket_name = "my-git-server-bucket"
# Lambda function name
function_name = "git-server-lambda"
# User credentials (change these!)
git_users = {
"git" = "your-secure-password"
"admin" = "another-secure-password"
}
Whether you’re a startup looking to minimize infrastructure costs, a developer wanting personal Git hosting, or an organization needing internal Git services, S3 Git Server offers a compelling alternative to traditional Git hosting solutions.