all repos

mugit @ f03a67a4b3efcfc8797ea64aa3bd3bc5e5d745b5

🐮 git server that your cow will love

mugit/README.md (view raw)

Oleksandr Smirnov Oleksandr Smirnov
olexsmir@gmail.com
update readme, 3 months 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
9
- Web interface — browse repositories, view commits, files, and diffs (no javascript required)
10
- Git Smart HTTP — clone over HTTPS (use SSH for pushing)
11
- Git over SSH — push and clone over SSH
12
- Mirroring — automatically mirror repositories (supports GitHub authentication)
13
- Private repositories — repos accessible only via SSH
14
- CLI — command-line for managing your repositories
15
16
## Quick install & deploy
17
18
```sh
19
git clone https://git.olexsmir.xyz/mugit.git
20
cd mugit
21
go build
22
23
# or
24
go install github.com/olexsmir/mugit@latest
25
```
26
27
For nixos you can use our flake, see [my config](https://git.olexsmir.xyz/dotfiles/blob/master/nix/modules/mugit.nix) for reference.
28
29
Start the server:
30
31
```sh
32
# start server with default config lookup
33
mugit serve
34
35
# start with a custom config path
36
mugit -c /path/to/config.yaml serve
37
```
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
67
meta:
68
  title: "My Git Server"    # site title shown on index page
69
  description: "A place for my projects"
70
  host: git.example.com     # used for clone URLs and go-import meta tag
71
72
repo:
73
  dir: /var/lib/mugit   # directory with repositories
74
  # Default README filenames (applied when omitted):
75
  readmes:
76
    - README.md
77
    - readme.md
78
    - README.html
79
    - readme.html
80
    - README.txt
81
    - readme.txt
82
    - readme
83
  # Default branch names considered the repository 'master' (applied when omitted):
84
  masters:
85
    - master
86
    - main
87
88
# ssh: push/clone over SSH
89
ssh:
90
  enable: true
91
  port: 2222  # SSH port (default 2222)
92
  host_key: /var/lib/mugit/host   # path to SSH host key (generate with ssh-keygen)
93
  # Only these public keys can access private repos and push to others.
94
  keys:
95
    - ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAA......
96
    - ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAA......
97
98
# mirror: automatic mirrors of external repositories
99
mirror:
100
  enable: true
101
  interval: 1h  # sync frequency
102
  # Tokens can be provided directly, or read from environment/file:
103
  # - literal: "ghp_xxxxxxxxxxxx"
104
  # - from env: "$env:GITHUB_TOKEN" (will read $GITHUB_TOKEN)
105
  # - from file: "$file:/abs/path/to/token.txt"
106
  github_token: "${env:GITHUB_TOKEN}"
107
108
cache:
109
  home_page: 5m   # cache index/home page
110
  readme: 1m      # cache rendered README per repo
111
  diff: 15m       # cache computed diffs
112
```
113
114
## CLI
115
116
```sh
117
# start server
118
mugit serve
119
120
# create new public repository
121
mugit repo new myproject
122
123
# create new private repository
124
mugit repo new --private myproject
125
126
# create a mirror of an external repository
127
mugit repo new myproject --mirror https://codeberg.org/user/repo
128
mugit repo new myproject --private --mirror https://github.com/user/repo
129
130
# toggle repository visibility
131
mugit repo private myproject
132
133
# show and set repository description
134
mugit repo description myproject
135
mugit repo description myproject "My awesome project"
136
```
137
138
## License
139
140
mugit is licensed under the MIT License.