all repos

mugit @ 3e7e955

🐮 git server that your cow will love

mugit/README.md (view raw)

Oleksandr Smirnov Oleksandr Smirnov
olexsmir@gmail.com
ssh: print modt on clone/push, 28 days ago
1
# mugit
2
3
A lightweight, self-hosted Git server that your cow will love.
4
5
[See it in action!](https://git.olexsmir.xyz)
6
7
## Features
8
- Web interface — browse repositories, view commits, files, and diffs (no javascript required).
9
- Git Smart HTTP — clone over HTTPS (use SSH for pushing).
10
- Git over SSH — push and clone repos over SSH.
11
- Mirroring — automatically mirror repos from other forges (supports GitHub authentication).
12
- Private repositories — repos accessible only via SSH
13
- CLI — command-line for managing your repositories
14
15
## Quick install & deploy
16
17
```sh
18
git clone https://git.olexsmir.xyz/mugit.git
19
cd mugit
20
go build
21
22
# or
23
go install github.com/olexsmir/mugit@latest
24
```
25
26
For nixos, you can use our flake, see [my config](https://git.olexsmir.xyz/dotfiles/blob/master/nix/modules/services/mugit.nix) for reference.
27
28
Start the server:
29
```sh
30
# start server with default config lookup
31
mugit serve
32
33
# start with a custom config path
34
mugit -c /path/to/config.yaml serve
35
36
# mirror your repo from github
37
mugit repo new repo-name --mirror https://github.com/user/repo
38
```
39
40
## Configuration
41
42
mugit uses YAML for configuration. By default the server looks for a configuration file in this order (override with `-c` / `--config`):
43
1. `./config.yaml`
44
2. `/etc/mugit.yaml`
45
3. `/var/lib/mugit/config.yaml`
46
47
48
Durations follow Go's duration syntax (examples: `1h`, `30m`, `5s`). See: [https://pkg.go.dev/time#ParseDuration]
49
50
Minimal configuration example:
51
52
```yaml
53
meta:
54
  host: git.olexsmir.xyz
55
56
repo:
57
  dir: /var/lib/mugit
58
```
59
60
Full example:
61
62
```yaml
63
server:
64
  host: 0.0.0.0 # bind address (0.0.0.0 = all interfaces)
65
  port: 5555    # HTTP port (defaults to 8080 when omitted)
66
  log_file: /var/lib/mugit/mugit.log # where slog output is written (default: <repo.dir>/mugit.log)
67
68
meta:
69
  title: "My Git Server"    # site title shown on index page
70
  description: "A place for my projects"
71
  host: git.example.com     # used for clone URLs and go-import meta tag
72
  modt: "Welcome to my git server!" # message shown on SSH clone/push (empty = disabled)
73
74
repo:
75
  dir: /var/lib/mugit   # directory with repositories
76
  # Default README filenames (applied when omitted):
77
  readmes:
78
    - README.md
79
    - readme.md
80
    - README.html
81
    - readme.html
82
    - README.txt
83
    - readme.txt
84
    - readme
85
86
# ssh: push/clone over SSH
87
ssh:
88
  enable: true
89
  user: "git" # user as which the app operates (default "git")
90
  # Only these public keys can access private repos and push to others.
91
  keys:
92
    - ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAA......
93
    - ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAA......
94
95
# mirror: automatic mirrors of external repositories
96
mirror:
97
  enable: true
98
  interval: 1h  # sync frequency
99
  # Tokens can be provided directly, or read from environment/file:
100
  # - literal: "ghp_xxxxxxxxxxxx"
101
  # - from env: "$env:GITHUB_TOKEN" (will read $GITHUB_TOKEN)
102
  # - from file: "$file:/abs/path/to/token.txt"
103
  github_token: "$env:GITHUB_TOKEN"
104
105
cache:
106
  home_page: 5m   # cache index/home page
107
  readme: 1m      # cache rendered README per repo
108
  diff: 15m       # cache computed diffs
109
```
110
111
## CLI
112
113
```sh
114
# start server
115
mugit serve
116
117
# create new public repository
118
mugit repo new myproject
119
120
# create new private repository
121
mugit repo new --private myproject
122
123
# create a mirror of an external repository
124
mugit repo new myproject --mirror https://codeberg.org/user/repo
125
mugit repo new myproject --private --mirror https://github.com/user/repo
126
127
# toggle repository visibility
128
mugit repo private myproject
129
130
# show and set repository description
131
mugit repo description myproject
132
mugit repo description myproject "My awesome project"
133
```
134
135
## License
136
137
mugit is licensed under the MIT License.