SimpleGit is a lightweight, self-hosted Git server written in Go that provides a clean web interface for browsing repositories and Git operations over HTTP and SSH protocols.
- Repository browser
- Commit history viewer
- Multi-branch support with branch switching
- HTTP Git protocol support:
- Clone, push operations
- Automatic bare repository handling
- SSH Git protocol support:
- Public key authentication
- User-managed SSH key system
- Complete user authentication system
- SSH key management
- Add/remove SSH keys
- Key fingerprint tracking
- Per-user SSH key management
- Backend:
- Go 1.21+
- SQLite database for user management
- GORM for ORM functionality
- JWT for authentication
- Gorilla Mux for routing
- go-git for Git operations
- Built-in TypeScript service for syntax highlighting
- Frontend:
- Highlight.js for syntax highlighting
- Clone the repository:
git clone https://github.com/yourusername/simplegit.git
cd simplegit
- Create the configuration file:
cp config.json.example config.json
-
Edit
config.json
with your settings -
Start with Docker Compose:
docker-compose up -d
- Install Go 1.21 or later, Install NodeJS and NPM
- Clone the repository:
git clone https://github.com/yourusername/simplegit.git
cd simplegit
- Create the configuration file:
cp config.json.example config.json
-
Edit
config.json
with your settings -
Build and run:
go build
./simplegit
The server can be configured through environment variables or a JSON config file. Environment variables take precedence over the JSON configuration.
SIMPLEGIT_DEV_MODE
: Enable development mode (boolean)SIMPLEGIT_PORT
: HTTP server portSIMPLEGIT_SSH_PORT
: SSH server port (default: 2222)SIMPLEGIT_DATE_FORMAT
: Date format stringSIMPLEGIT_MAX_FILE_SIZE
: Maximum file size for web display in bytesSIMPLEGIT_DATA_DIR
: Directory for database and data storageSIMPLEGIT_JWT_SECRET
: Secret key for JWT tokensSIMPLEGIT_DOMAIN
: Server domain name (default: localhost)SIMPLEGIT_SSH_KEY_PATH
: Path to SSH host keySIMPLEGIT_REPO_PATH
: Path to store Git repositoriesSIMPLEGIT_DB_PATH
: Path to SQLite database fileTS_SERVICE_URL
: URL for the TypeScript syntax highlighting service (default: http://localhost:3001)
The included Docker setup provides a single container deployment including both Go and TypeScript services
Example docker-compose.yml:
version: "3.8"
services:
simplegit:
image: ghcr.io/waveringana/simplegit:v0.1
ports:
- "3000:3000"
- "2222:2222"
volumes:
- ./repositories:/app/repositories
- ./data:/app/data
- ./ssh:/app/ssh
environment:
- SIMPLEGIT_PORT=3000
- SIMPLEGIT_SSH_PORT=2222
- SIMPLEGIT_JWT_SECRET=your-secure-secret
- SIMPLEGIT_DOMAIN=git.yourdomain.com
- SIMPLEGIT_MAX_FILE_SIZE=10485760
restart: unless-stopped
deploy:
resources:
limits:
memory: 768M
reservations:
memory: 256M
- Start the server for the first time
- Look for the admin setup token in the console output
- Visit http://localhost:3000/setup-admin
- Use the setup token to create the admin account
- Log in with the admin account
- Create repositories and users through the admin interface
- Log in as admin
- Go to Admin → Repositories
- Click "Create Repository"
- Enter repository name and description
HTTP:
git clone http://localhost:3000/repo/example.git
SSH:
git clone ssh://git@localhost:2222/example.git
simplegit/
├── config/ # Configuration handling
├── database/ # Database initialization
├── handlers/ # HTTP request handlers
├── models/ # Data models and business logic
├── services/ # Additional services (TS worker)
├── ssh/ # SSH server implementation
├── static/ # Static web assets
├── templates/ # HTML templates
└── utils/ # Utility functions
-
Backend:
- Go 1.21+
- go-git (Git operations)
- GORM (ORM)
- SQLite (Database)
- Gorilla Mux (Routing)
- JWT (Authentication)
-
Frontend:
- Highlight.js (Syntax highlighting)
-
Services:
- Built-in TypeScript syntax highlighting service
- Express.js for TS service API
- highlight.js for server-side syntax highlighting
This project is released under the Unlicense. See the LICENSE file for details.
Built with these excellent libraries:
- highlight.js - BSD Three Clause License
- htmx - BSD Zero Clause License
- go-git - Apache License 2.0