Back to services

minimal-git-server

Lightweight git server with a basic CLI to manage repositories, supporting multiple accounts and running in a container.

View alternatives to minimal-git-server
Suggest edit
Open source
Self-hostable
MIT
Recent reviews

Alternatives

Tech stack

No tech stack added yet. Sign in to suggest some

Introduction

minimal-git-server is an open-source (MIT license) minimalist Git server that runs in container environments such as Docker and Podman. Its design is based on jkarlosb/git-server-docker. All configuration lives in a single config.yml file. It provides a simple command-line interface for managing repositories, but it has no web interface, issues, merge requests or similar features. Its only job is to host Git repositories over SSH.

Key Features

  • Multi-account support: Define multiple accounts in config.yml. Each account can have a uid and several SSH public keys that are allowed to log in.
  • Command-line repository management: After logging in over SSH, you can list, create, rename and delete repositories.
  • Script-friendly: Every supported command can be run directly as a single SSH command, for example ssh ACCOUNT@HOSTNAME -p PORT create project1/my_repo, which makes it well suited to automation.
  • Works with multiple container runtimes: Tested on Docker and Podman.

Target Users and Use Cases

It suits individual developers, homelab users and small teams who just need a private Git remote and don't want to deploy a full platform such as GitLab or Gitea. Common uses include hosting private code on a NAS or VPS, backing up configuration files (dotfiles), keeping repositories in one place on an internal network, and automatically creating repositories from scripts or CI.

Core Strengths

  • Small and simple, relying only on SSH and Git, so it is cheap to maintain.
  • A single declarative configuration file, which is easy to put under version control and to redeploy.
  • Follows semantic versioning and offers several image tags, so automatic updates can be done safely.

Deployment

Prebuilt images are published on GitHub Packages (ghcr.io):

  • ghcr.io/mcarbonne/minimal-git-server:latest: the latest tagged release
  • :main / :dev: builds of the corresponding branches
  • :x.x.x, :x.x, :x: pinned by version number

If you use Watchtower or podman-auto-update for automatic updates, the project recommends using the major version tag (such as :2) to avoid incompatible changes.

The container needs 3 volumes mounted:

  • /srv/ssh: persistently stores the generated server keys
  • /srv/git: stores the repositories
  • /srv/config.yml: configures the accounts and the allowed public keys
docker run -v .../ssh:/srv/ssh -v .../git:/srv/git -v .../config.yml:/srv/config.yml:ro \
        --name minimal-git-server -d -p 20222:22 ghcr.io/mcarbonne/minimal-git-server:2

Example config.yml:

external_hostname: localhost
external_port: 20222
accounts:
  - user: user_a
    uid: 12345
    keys:
      - "ssh-rsa XXXXXX [email protected]"
  - user: user_b

Technical Requirements

  • A container runtime such as Docker or Podman.
  • Clients need SSH and Git, and their SSH public keys must be registered in the configuration file.

Things to Note

  • There is no web interface; all management is done through the SSH command line.
  • The test.sh file in the repository contains more examples of scripted usage.