Capstone Project 3 — Deploy a Git Server¶
Git is the industry-standard version control system used to manage source code, Infrastructure as Code (IaC), documentation, automation scripts, and configuration files. While cloud-hosted Git platforms such as GitHub and GitLab are widely used, many organizations deploy self-hosted Git servers for greater control, security, compliance, and integration with internal infrastructure. In this capstone project, you'll build a secure production-ready Git server using SSH authentication, repository permissions, backups, monitoring, and system hardening.
Project Overview¶
Objective¶
Build and secure a production-ready self-hosted Git server for team collaboration.
Skills Covered¶
- Linux Administration
- Git Installation
- Git Repository Management
- SSH Authentication
- User Management
- File Permissions
- Backup Strategy
- Monitoring
- Logging
- Firewall Configuration
- Production Hardening
Estimated Time¶
5–7 Hours
Difficulty¶
Beginner → Advanced
Project Architecture¶
Developers
│
Git Push / Pull
│
SSH (22)
│
+----------------------+
| Git Server |
| Ubuntu Linux |
+----------------------+
│
Git Repositories
│
+------------------------+
| /home/git/repos/*.git |
+------------------------+
Learning Outcomes¶
By completing this project, you'll be able to:
- Deploy a Git server
- Configure secure SSH access
- Create Git repositories
- Manage repository permissions
- Secure Git administration
- Configure backups
- Monitor Git services
- Validate production readiness
Project Requirements¶
Hardware¶
Minimum
- 2 vCPU
- 2 GB RAM
- 20 GB Disk
Recommended
- 4 vCPU
- 4 GB RAM
- 40 GB SSD
Operating System¶
Choose one:
- Ubuntu Server 24.04 LTS
- Ubuntu Server 22.04 LTS
- Rocky Linux 9
- AlmaLinux 9
This project uses Ubuntu Server.
Software Stack¶
- Ubuntu Server
- Git
- OpenSSH Server
- UFW
- Fail2Ban
- rsync
- auditd
Project Tasks¶
| Phase | Task |
|---|---|
| 1 | Install Linux |
| 2 | Install Git |
| 3 | Create Git User |
| 4 | Configure SSH |
| 5 | Create Repositories |
| 6 | Clone & Test Repository |
| 7 | Configure Firewall |
| 8 | Configure Backups |
| 9 | Configure Monitoring |
| 10 | Harden Server |
| 11 | Validate Git Operations |
| 12 | Production Review |
Phase 1 — Install Linux¶
Update packages.
Verify.
Phase 2 — Install Git¶
Install Git.
Verify version.
Configure global settings.
Verify configuration.
Phase 3 — Create Git User¶
Create dedicated Git account.
Create repository directory.
Assign ownership.
Phase 4 — Configure SSH¶
Generate SSH key.
Copy public key.
Test SSH login.
Disable password authentication.
Restart SSH.
Phase 5 — Create Repository¶
Create a bare repository.
Verify.
Expected:
Phase 6 — Clone Repository¶
Clone repository.
Create README.
Commit.
Push.
Phase 7 — Configure Firewall¶
Install UFW.
Allow SSH.
Enable.
Verify.
Phase 8 — Configure Backups¶
Backup repositories.
Synchronize backups.
Verify.
Phase 9 — Configure Monitoring¶
CPU.
Memory.
Disk.
Processes.
SSH service.
Phase 10 — Harden Server¶
Install Fail2Ban.
Enable.
Install auditd.
Enable.
Review ports.
Phase 11 — Validate Git Operations¶
Clone repository.
Push changes.
Pull changes.
Verify repository.
Phase 12 — Production Review¶
Validate:
Git.
SSH.
Firewall.
Disk.
Logs.
Backup.
Verify archive exists.
Repository Structure¶
Example:
Final Project Checklist¶
| Item | Status |
|---|---|
| Linux Installed | ☐ |
| Git Installed | ☐ |
| Git User Created | ☐ |
| SSH Keys Configured | ☐ |
| Git Repository Created | ☐ |
| Repository Cloned | ☐ |
| Push & Pull Verified | ☐ |
| Firewall Enabled | ☐ |
| Backup Configured | ☐ |
| Monitoring Verified | ☐ |
| Server Hardened | ☐ |
| Production Validation Completed | ☐ |
Production Perspective¶
Self-hosted Git servers are commonly used for:
- Source code management
- Infrastructure as Code
- CI/CD pipelines
- Configuration repositories
- Documentation
- Automation scripts
- Air-gapped environments
- Enterprise software development
Hands-on Lab¶
Task 1¶
Install Git.
Task 2¶
Create Git administrator.
Task 3¶
Generate SSH keys.
Task 4¶
Create three bare repositories.
Task 5¶
Clone one repository.
Task 6¶
Push initial project.
Task 7¶
Configure repository backup.
Task 8¶
Add a second developer account and verify collaborative Git operations using SSH authentication.
Production Best Practices¶
- Use SSH key authentication only.
- Create dedicated Git accounts.
- Restrict repository permissions.
- Backup repositories regularly.
- Enable audit logging.
- Protect the server using a firewall.
- Monitor storage utilization.
- Keep Git updated.
- Review access logs periodically.
- Document repository ownership and access policies.
Challenge Tasks¶
Complete these additional tasks to extend the project:
- Configure Git hooks for commit validation.
- Host multiple development teams.
- Configure repository access using Linux groups.
- Implement repository backup automation with cron.
- Mirror repositories to a secondary Git server.
- Configure automatic security updates.
- Install Prometheus Node Exporter.
- Build a repository usage dashboard.
- Integrate the Git server with Jenkins or GitLab CI.
- Deploy Git over HTTPS using Nginx and TLS.
Skills Demonstrated¶
After completing this project, you will have demonstrated proficiency in:
- Git Administration
- Linux Security
- SSH Authentication
- Repository Management
- User Management
- Backup Strategy
- Monitoring
- Production Hardening
- Enterprise Linux Administration
Congratulations!¶
You have successfully deployed a production-ready Git Server.
Your Git server now provides secure version control for developers while protecting repositories through SSH authentication, proper permissions, backups, monitoring, and system hardening.
This project reflects how many organizations manage internal source code repositories for software development, Infrastructure as Code, and automation.
What's Next?¶
Capstone Project 4 — Create a Monitoring Server
You'll learn how to:
- Install Prometheus
- Configure Node Exporter
- Install Grafana
- Build monitoring dashboards
- Configure alerting
- Monitor Linux servers
- Visualize infrastructure health
By the end of the project, you'll have a centralized monitoring server capable of collecting metrics, displaying dashboards, and monitoring the health of multiple Linux systems in a production environment.