A lightweight Git server that supports the Git Smart HTTP protocol, built with Java 8, Spring Boot, and JGit.
- β Git Smart HTTP: Fully compatible with standard Git clients (including Eclipse EGit)
- β RESTful API: Simple repository management endpoints
- β Localization: English / Japanese UI and messages
- β HTTP Basic Auth: Simple and reliable authentication
- β Single-jar deployment: Package as an executable JAR and run
- β Audit logging: Detailed Git access logs
- β Health check: Service health monitoring
- β
Built-in CLI client (mgit): Common Git operations without native
git.exe(init/clone/status/add/commit/log/branch/checkout/push/pull/remote)
- Java 8 or later
- Maven 3.6+ (build time only)
# Clone the repository
git clone <repo-url>
cd mini-git-server
# Build (server + client executable JARs)
mvn clean package -DskipTestsGenerated JARs:
- Server:
target/mini-git-server-1.0.0.jar - CLI client (mgit):
target/mini-git-server-1.0.0-client.jar
Note: Both are Spring Boot executable JARs. Running
-client.jarstartscom.minigit.util.GitClientMain.
java -jar target/mini-git-server-1.0.0.jarjava -jar target/mini-git-server-1.0.0.jar \
--server.port=8080 \
--vcs.storage.dir="/opt/git-repos" \
--vcs.auth.user=admin \
--vcs.auth.pass=mypassword \
--vcs.lang.default=encurl http://localhost:8080/actuator/health# English locale
curl -u admin:admin123 -H "Accept-Language: en" -X POST \
"http://localhost:8080/api/repos?name=my-project"
# Response
{
"name": "my-project.git"
}curl -u admin:admin123 "http://localhost:8080/api/repos"
# Response
[
"my-project.git",
"docs.git"
]{
"error": "REPO_ALREADY_EXISTS",
"message": "Repository already exists: my-project.git",
"timestamp": "2025-08-29T02:19:31Z"
}-
Clone repository
- In Eclipse:
FileβImportβGitβProjects from Git - Choose
Clone URI - Enter URI:
http://localhost:8080/git/my-project.git - Credentials:
admin/admin123
- In Eclipse:
-
Push code
- Right-click project β
TeamβPush Branch - Set upstream branch on first push
- Right-click project β
# Clone with credentials
git clone http://admin:admin123@localhost:8080/git/my-project.git
# Or step-by-step (will prompt for password)
git clone http://localhost:8080/git/my-project.git
# Add and commit
cd my-project
# ... edit files
# Commit
git add .
git commit -m "init"
# Push
git push origin mainDesigned for environments where native Git is unavailable. The client is built into this project; after building, run the
-client.jarto perform common Git operations.
# Windows / macOS / Linux
java -jar target/mini-git-server-1.0.0-client.jar --help| mgit command | Syntax | Native Git |
|---|---|---|
init |
init <repoPath> |
git init |
clone |
clone <url> <dir> [--user U --pass P] |
git clone |
status |
status <repoPath> |
git status |
add |
add <repoPath> <pathspec> |
git add |
commit |
commit <repoPath> -m "msg" |
git commit |
log |
log <repoPath> [--max N] |
git log |
branch |
branch <repoPath> / branch -c <repoPath> <newBranch> |
git branch |
checkout |
checkout <repoPath> <branch> |
git checkout |
remote |
remote <repoPath> / remote -a <repoPath> <name> <url> |
git remote |
push |
push <repoPath> <remote> <branch> [--user U --pass P] |
git push |
pull |
pull <repoPath> <remote> <branch> [--user U --pass P] |
git pull |
Note:
mgitexplicitly passes<repoPath>instead of using the global-Cflag.
# 1) Initialize and first commit
java -jar target/mini-git-server-1.0.0-client.jar init ./demo
cd demo
# ... edit files
java -jar target/mini-git-server-1.0.0-client.jar add . .
java -jar target/mini-git-server-1.0.0-client.jar commit . -m "first commit"
# 2) Configure remote (native Git or edit .git/config)
# 3) Push / pull (HTTP Basic supported)
# Option A: explicit credentials (demo only; avoid in production history)
java -jar target/mini-git-server-1.0.0-client.jar push . origin main --user admin --pass admin123
# Option B: environment variables (recommended)
export GIT_USER=admin
export GIT_PASSWORD=admin123
java -jar target/mini-git-server-1.0.0-client.jar push . origin main- CLI flags
--user/--pass - Environment variables
GIT_USER/GIT_PASSWORD - Interactive prompt (when console is available)
Authentication failed: Verify--user/--passor environment variables; confirm server credentials.Repository not found: Create the repo via REST API or verify remote URL.- Merge conflicts (
pullshowsCONFLICTING): resolve in workspace, thenadd/commit.
git clone- clone repositorygit fetch- fetch updatesgit pull- pull and mergegit push- push commits- Branch operations
- Tag operations
# Server port
server.port=8082
# Repository storage directory
vcs.storage.dir=./data/repos
# Credentials
vcs.auth.user=admin
vcs.auth.pass=admin123
# Default language (en/ja)
vcs.lang.default=en
# Logging
logging.level.com.minigit=INFOjava -jar target/mini-git-server-1.0.0.jar \
--server.port=8080 \
--vcs.storage.dir=/data/repos \
--vcs.auth.user=git \
--vcs.auth.pass=secretmini-git-server/
βββ data/ # default data directory
β βββ repos/ # Git repository storage
β βββ project1.git/ # bare repository 1
β βββ project2.git/ # bare repository 2
βββ logs/ # log directory
β βββ mini-git-server.log # application log
β βββ git-access.log # Git access audit log
βββ target/
βββ mini-git-server-1.0.0.jar # server
βββ mini-git-server-1.0.0-client.jar # CLI client (mgit)
java -jar target/mini-git-server-1.0.0.jar \
--vcs.auth.user=git \
--vcs.auth.pass=change-me- Run behind a reverse proxy (e.g., Nginx)
- Enable HTTPS
- Restrict allowed IP ranges
- Back up repository data regularly
curl http://localhost:8080/actuator/health- Application log:
logs/mini-git-server.log - Git access log:
logs/git-access.log
[2025-08-29 10:43:27] git-upload-pack: /git/my-project.git, user=admin, ip=127.0.0.1
Error
Port 8080 was already in use.
Fix
- Change
server.portor stop the process using the port.
Error
Permission denied: ./data/repos
Fix
- Ensure the directory is writable by the current user.
Error
Authentication failed for 'http://localhost:8080/git/my-project.git/'
Fix
- Check credentials and server configuration.
Error
Repository not found: my-project.git
Fix
- Create the repo via REST API first, or verify the URL.
- Start the server with
--debug.
Use NSSM to register the application as a service:
# Download NSSM and install
Create /etc/systemd/system/mini-git-server.service:
[Unit]
Description=Mini Git Server
After=network.target
[Service]
Type=simple
User=git
WorkingDirectory=/opt/mini-git-server
ExecStart=/usr/bin/java -jar /opt/mini-git-server/mini-git-server-1.0.0.jar
Restart=always
[Install]
WantedBy=multi-user.targetStart the service:
sudo systemctl daemon-reload
sudo systemctl enable mini-git-server
sudo systemctl start mini-git-serverCreate Dockerfile:
FROM eclipse-temurin:8-jre
WORKDIR /app
COPY target/mini-git-server-1.0.0.jar /app/app.jar
EXPOSE 8080
ENTRYPOINT ["java", "-jar", "/app/app.jar"]Build and run:
docker build -t mini-git-server .
docker run -d -p 8080:8080 -v ./data:/app/data mini-git-server- Current version: 1.0.0
- Build time: 2025-08-29
- Java version: 1.8+
Issues and pull requests are welcome.
This project is released under the MIT License.
Tip: This is a lightweight Git server for small teams or internal networks. For advanced features (web UI, fine-grained permissions, Git LFS, etc.), consider GitLab, Gitea, or other mature solutions.