← All libraries

CandyServe

CandyServe

Self-hostable Git server over SSH + Git + HTTP

port of charmbracelet/soft-serve gitserversshself-hosted

Self-hostable Git server with SSH (authorized keys), Git (git://), and HTTP endpoints. Users, repos, access control, and optional LFS — all driven by a config file.

Install

composer require sugarcraft/candy-serve

Quickstart

use SugarCraft\Serve\{Config, Repo, SSH\SSHServer};

// Load config
$config = Config::fromDefaults();

// Create a repo
$repo = Repo::create($config, 'my-project');
echo "Repo path: {$repo->path()}\n";

// Spawn the SSH server
$server = new SSHServer($config);
$server->listen();

What's in the box

SSH endpointAuthorized-key authentication, git upload-pack / receive-pack.
Git daemonUnauthenticated git:// protocol endpoint.
HTTP endpointDumb HTTP gateway for behind-firewall access.
Access controlPer-repo read/write/user grants and denials.
LFS supportOptional LFS handler for large file storage.
Config fileYAML-based server configuration.

Source & demos

Try the quickstart →

API

ClassMethodDescription
ConfigfromDefaults()Create default configuration
ConfigfromYaml(path)Load configuration from YAML
Repocreate(config, name)Create a new repository
Repopath()Get repository path
SSHServernew(config)Create SSH server
SSHServerlisten()Start listening for connections
GitDaemonnew(config)Create Git daemon
HttpServernew(config)Create HTTP server

Demos.

VHS-recorded GIFs of every example shipped with the library. Regenerated automatically on every push that touches the source.

Config inspection

Config inspection

Resolved server config — name, host, ports, repo dir.
Repo metadata

Repo metadata

Per-repo settings — owner, ACLs, LFS, hooks.