A custom Git server implementation for Dot Code School, providing repository management and webhooks.
- Ubuntu/Debian-based system
- Root or sudo access
- Domain name configured with DNS A record pointing to server IP
# Install fcgiwrap for Git HTTP operations
sudo apt-get install fcgiwrap
# Install jq for JSON parsing
sudo apt-get install jq# Start and enable fcgiwrap service
sudo systemctl start fcgiwrap
sudo systemctl enable fcgiwrap# Create required directories
sudo mkdir -pv /srv/git/{repos,scripts,templates}
# Copy scripts to git server
sudo cp -r scripts /srv/git/
# Make scripts executable
sudo chmod +x /srv/git/scripts/*- Install Caddy server
- Create a Caddy environment file at
/etc/caddy/caddy.env:
# Git server configuration
GIT_DOMAIN=git.yourdomain.com
ADMIN_EMAIL=admin@yourdomain.com
GIT_SERVER_URL=https://git.yourdomain.com
BACKEND_URL=https://backend.yourdomain.com- Update
/etc/caddy/Caddyfilewith your configuration - Enable port binding for Caddy:
sudo setcap cap_net_bind_service=+ep /usr/bin/caddy# Update permissions for repos directory
sudo chown -R www-data:caddy /srv/git/repos
sudo chmod -R 775 /srv/git/repos- Create a default template repository:
/srv/git/scripts/create_git_template.sh- (Optional) Add custom hooks to
/srv/git/templates/default/hooks/
Send a POST request to create a new repository:
curl -H "Content-Type: application/json" \
-H "Authorization: Bearer <your-auth-token>" \
-d '{
"repo_name": "<your-repo>",
"template_repo": "default"
}' \
https://git.yourdomain.com/api/v0/create_repository- Keep your authentication tokens secure
- Regularly update system packages and Caddy
- Monitor server logs for suspicious activity
- Check fcgiwrap status:
sudo systemctl status fcgiwrap- Check Caddy logs:
sudo journalctl -u caddy- Verify repository permissions:
ls -la /srv/git/reposThis project is licensed under the WTFPL - Do What The Fuck You Want To Public License.