nandi / forge

Load .env in dev shell
nandi committed 13d 53c0162
Clone: git clone http://git.latha.org/nandi/forge.git
📁 src
📄 .dockerignore 162 B
📄 .env.example 353 B
📄 .gitignore 240 B
📄 deps.json 10.7 KB
📄 Dockerfile 530 B
📄 flake.lock 1.5 KB
📄 flake.nix 3.9 KB
📄 fly.toml 411 B
📄 Forge.sln 2.4 KB
📄 justfile 1.2 KB
📄 README.md 2.3 KB

README.md

Forge

Forge is a small self-hosted Git forge built with ASP.NET Core, Blazor, SQLite, and Git Smart HTTP.

Features

  • Browse repositories, trees, blobs, commits, and branches
  • Create repositories from the web UI
  • Push over HTTP to auto-create a missing repository on first push
  • Cookie-based web login with Basic auth support for Git operations
  • Repository visibility controls with private/public settings
  • README rendering on the repository page
  • Syntax highlighting for source files and fenced code blocks

Running Locally

nix run .#run-forge

Open http://localhost:5128.

The bootstrap admin username is admin.

For local runtime, the app now expects a decrypted password file path, which matches the Home Manager agenix pattern. By default the flake looks for:

$XDG_RUNTIME_DIR/agenix/forge-admin-password

Override it with:

export FORGE_ADMIN_PASSWORD_FILE=/path/to/decrypted/password-file

After signing in as the bootstrap admin, open Settings to add additional Forge users. Those users can log in to the web UI and use Git HTTP with their own credentials.

Fly.io Deployment

This repo includes:

Recommended setup:

cp .env.example .env
# edit .env and set FLY_APP / FLY_REGION
fly apps create "$FLY_APP"
just fly-volume
just fly-secrets
just deploy

What each step does:

  • just fly-volume creates the forge_data volume mounted at /data
  • just fly-secrets reads the admin password from FORGE_ADMIN_PASSWORD_FILE and sets: Auth__Username, Auth__Password, Database__Path, Repositories__Root, and ASPNETCORE_ENVIRONMENT
  • just deploy runs nix run .#deploy-fly, which calls fly deploy -a "$FLY_APP"

Fly volume note:

  • The app expects persistent storage at /data
  • forge.db is stored at /data/forge.db
  • bare Git repositories are stored under /data/repositories

Push This Repo To Forge

git remote add forge "http://admin:$(cat ${FORGE_ADMIN_PASSWORD_FILE:-${XDG_RUNTIME_DIR}/agenix/forge-admin-password})@localhost:5128/admin/forge.git"
git push -u forge main
An unhandled error has occurred. Reload 🗙