all repos

mugit @ 0c6e821b28a02ebf2449b86e66232508f5d302aa

🐮 git server that your cow will love

mugit/README.md (view raw)

Oleksandr Smirnov Oleksandr Smirnov
olexsmir@gmail.com
update readme and changelog, 2 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
- 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
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
  user: "git" # user as which the app operates (default "git")
93
  host_key: /var/lib/mugit/host   # path to SSH host key (generate with ssh-keygen)
94
  # Only these public keys can access private repos and push to others.
95
  keys:
96
    - ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAA......
97
    - ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAA......
98
99
# mirror: automatic mirrors of external repositories
100
mirror:
101
  enable: true
102
  interval: 1h  # sync frequency
103
  # Tokens can be provided directly, or read from environment/file:
104
  # - literal: "ghp_xxxxxxxxxxxx"
105
  # - from env: "$env:GITHUB_TOKEN" (will read $GITHUB_TOKEN)
106
  # - from file: "$file:/abs/path/to/token.txt"
107
  github_token: "$env:GITHUB_TOKEN"
108
109
cache:
110
  home_page: 5m   # cache index/home page
111
  readme: 1m      # cache rendered README per repo
112
  diff: 15m       # cache computed diffs
113
```
114
115
## CLI
116
117
```sh
118
# start server
119
mugit serve
120
121
# create new public repository
122
mugit repo new myproject
123
124
# create new private repository
125
mugit repo new --private myproject
126
127
# create a mirror of an external repository
128
mugit repo new myproject --mirror https://codeberg.org/user/repo
129
mugit repo new myproject --private --mirror https://github.com/user/repo
130
131
# toggle repository visibility
132
mugit repo private myproject
133
134
# show and set repository description
135
mugit repo description myproject
136
mugit repo description myproject "My awesome project"
137
```
138
139
## License
140
141
mugit is licensed under the MIT License.