aboutsummaryrefslogtreecommitdiffhomepage
path: root/README.md
blob: d9d734357121118b28a729a3d19d547a22bcca18 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# giternity

[![Version](https://img.shields.io/pypi/v/giternity.svg)](https://pypi.python.org/pypi/giternity)
[![pyversions](https://img.shields.io/pypi/pyversions/giternity.svg)](https://pypi.python.org/pypi/giternity)
[![Downloads](https://www.cpu.re/static/giternity/downloads.svg)](https://www.cpu.re/static/giternity/downloads-by-python-version.txt)
[![License](https://img.shields.io/badge/License-GPLv3+-blue.svg)](https://github.com/rahiel/giternity/blob/master/LICENSE.txt)

Giternity is a tool to mirror your git repositories from GitHub. You can specify
a username/organization to mirror all their repositories, or just individual
repo's. It retrieves some repo metadata so they can be nicely served with
[cgit][]. Run giternity periodically to update the mirrors.

[cgit]: https://git.zx2c4.com/cgit/about/

# Installation

Install giternity:

``` shell
sudo pip3 install giternity
```

You also need to have git installed.

# Configuration

The configuration file is at `/etc/giternity.toml`:

``` toml
# path where to keep the git mirrors
git_data_path = "/srv/git/"

# URL of your cgit instance (optional)
# cgit_url = "https://git.cpu.re/"

[github]
repositories = [
    "rahiel",
    "sunsistemo",
    "TeMPOraL/nyan-mode",
]
```

In the `[github]` section you specify which repositories to mirror. You list a
username (`"rahiel"`) or an organization (`"sunsistemo"`) to mirror all of their
non-fork repositories. For individual repos (`"TeMPOraL/nyan-mode"`) you specify
them like `owner/repo`.

With the configuration in place you simply run `giternity`.

For convenience there is an automatic configuration that sets up a separate
system user, gives this user permissions to `git_data_path` and creates a cron
job at `/etc/cron.d/giternity` to update the mirrors every hour. Apply these
defaults with:

``` shell
sudo giternity --configure
```

# cgit

Your git mirrors are now suitable to serve with cgit. Customize your
`/etc/cgitrc` as you like and add the following to the bottom:

``` ini
agefile=info/web/last-modified
section-from-path=1
scan-path=/srv/git/
```

where you replace `/srv/git/` with the `git_data_path` from your
`/etc/giternity.toml`.