all repos

mugit @ 3cf8623

🐮 git server that your cow will love

mugit/README.md (view raw)

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