About
HTTP git server for Tana website deployments with JWT authentication

Tags
No tags available

Languages
Rust 97%, Dockerfile 3%

tana-box-git

minimal git server in rust implementing the smart http protocol. handles git push, pull, and fetch operations over http with bare repository storage.

features

  • git push/pull/fetch over http
  • create and list repositories via api
  • bare repository storage
  • identity service authentication
  • stateless http mode

building

cargo build --release

running

# set repos directory (default: /tmp/box-repos)
export REPOS_DIR=/tmp/box-repos

# start server without authentication (development)
cargo run

# start server with authentication (production)
REQUIRE_AUTH=true IDENTITY_URL=http://localhost:8504 cargo run

# custom port
PORT=8080 cargo run

usage

# create a repository
curl -X POST http://localhost:9418/api/repos/alice/mystore

# clone it
git clone http://localhost:9418/alice/mystore.git

# push code
cd mystore
echo "# test" > README.md
git add README.md
git commit -m "initial commit"
git push origin main

api endpoints

git protocol (used by git client)

  • GET /:user/:repo/info/refs?service=git-receive-pack - advertise refs for push
  • POST /:user/:repo/git-receive-pack - receive pack (git push)
  • POST /:user/:repo/git-upload-pack - send pack (git pull/fetch)

management api

  • POST /api/repos/:user/:repo - create repository
  • GET /api/repos/:user - list user's repositories
  • GET /health - health check

development

# run with debug logging
RUST_LOG=box_git=debug cargo run

# run tests
cargo test

# format code
cargo fmt

# lint
cargo clippy