| 1 |
# git-rs |
| 2 |
|
| 3 |
A fast, minimal web interface for self-hosted Git repositories, inspired by `cgit` and written in Rust using Actix Web, `gix` (gitoxide), and Askama templates. |
| 4 |
|
| 5 |
 |
| 6 |
[*Demo*](https://git.y2w8.online) |
| 7 |
|
| 8 |
## Features |
| 9 |
|
| 10 |
- Browse repositories, branches, tags, commit logs, and file trees |
| 11 |
- Unified diffs with diffstat bars and raw `.patch` export (`git am` compatible) |
| 12 |
- Download `.tar.gz` snapshots of any branch, tag, or commit |
| 13 |
- Read-only HTTP smart protocol support (`git clone` / `git pull`) |
| 14 |
- Automatic filesystem watcher (`notify`) that picks up new or removed repositories in `/srv/git` without restarting the server |
| 15 |
- Markdown rendering for repository `README` files |
| 16 |
- Static assets and templates compiled directly into a single binary |
| 17 |
|
| 18 |
More screenshots are available in [`docs/screenshots/`](docs/screenshots/). |
| 19 |
|
| 20 |
## Usage |
| 21 |
|
| 22 |
By default, `git-rs` reads bare repositories from `/srv/git` and listens on `127.0.0.1:80`: |
| 23 |
|
| 24 |
```sh |
| 25 |
git-rs --url 0.0.0.0 --port 80 --repos-dir /srv/git |
| 26 |
``` |
| 27 |
|
| 28 |
### Options |
| 29 |
|
| 30 |
| Flag | Default | Description | |
| 31 |
| :--- | :--- | :--- | |
| 32 |
| `-u, --url <URL>` | `127.0.0.1` | Bind address | |
| 33 |
| `-p, --port <PORT>` | `80` | Port to listen on | |
| 34 |
| `-r, --repos-dir <DIR>` | `/srv/git` | Directory containing bare Git repositories | |
| 35 |
|
| 36 |
## Repository Metadata |
| 37 |
|
| 38 |
For each bare repository in `/srv/git/<repo>`: |
| 39 |
|
| 40 |
- **Description:** Write a plain-text description to `/srv/git/<repo>/description` |
| 41 |
- **Owner:** Set `gitweb.owner` in the repository config: |
| 42 |
```sh |
| 43 |
git -C /srv/git/<repo> config gitweb.owner "your-name" |
| 44 |
``` |
| 45 |
|
| 46 |
## Building |
| 47 |
|
| 48 |
```sh |
| 49 |
cargo build --release |
| 50 |
``` |
| 51 |
|
| 52 |
To run as a `systemd` service, copy [`git-rs.service`](git-rs.service) to `/etc/systemd/system/` and enable it: |
| 53 |
|
| 54 |
```sh |
| 55 |
sudo cp target/release/git-rs /usr/bin/git-rs |
| 56 |
sudo cp git-rs.service /etc/systemd/system/git-rs.service |
| 57 |
sudo systemctl daemon-reload |
| 58 |
sudo systemctl enable --now git-rs |
| 59 |
``` |
| 60 |
|
| 61 |
## License |
| 62 |
|
| 63 |
Licensed under the [GPL-3.0](LICENSE) license. |