Skip to content

Commit 69eb865

Browse files
committed
Updated README.
1 parent 6d37986 commit 69eb865

File tree

2 files changed

+40
-2
lines changed

2 files changed

+40
-2
lines changed

README.md

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,36 @@
1-
# git-mirror
2-
Mirror Git repositories without effort
1+
# git-mirror - simple Git mirrors
2+
3+
`git-mirror` is designed to create and serve read-only mirrors of your Git repositories locally or wherever you choose. A recent GitHub outage reinforces the fact that developers shouldn't be relying on a single remote for hosting code.
4+
5+
A major design goal of `git-mirror` is that it should just work with as little configuration as possible.
6+
7+
## Get started
8+
9+
1. Download and extract the latest release from the [releases page](https://github.com/beefsack/git-mirror/releases).
10+
1. Create `config.toml` similar to:
11+
```toml
12+
[[repo]]
13+
Origin = "https://github.com/beefsack/git-mirror.git"
14+
```
15+
By default it will update the mirror every **15 minutes** and will serve the mirror over HTTP using port **8080**. You can specify as many repos as you want by having multiple `[[repo]]` sections.
16+
1. Run `git-mirror` with the path to the config file:
17+
```bash
18+
$ ./git-mirror config.toml
19+
2015/05/07 11:08:06 starting web server on :8080
20+
2015/05/07 11:08:06 updating github.com/beefsack/git-mirror.git
21+
2015/05/07 11:08:08 updated github.com/beefsack/git-mirror.git
22+
```
23+
1. Now you can clone from your mirror on the default port of `8080`:
24+
```bash
25+
$ git clone http://localhost:8080/github.com/beefsack/git-mirror.git
26+
Cloning into 'git-mirror'...
27+
Checking connectivity... done.
28+
```
29+
30+
## Advanced configuration
31+
32+
See [the example config](example-config.toml) for more advanced configurations.
33+
34+
## Authentication and authorisation
35+
36+
If you wish to control access to the mirror or specific repositories, consider proxying to `git-mirror` using a web server such as Nginx.

config.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package main
22

33
import (
4+
"path/filepath"
45
"fmt"
56
"io/ioutil"
67
"net/url"
@@ -54,6 +55,9 @@ func parseConfig(filename string) (cfg config, repos map[string]repo, err error)
5455
if cfg.BasePath == "" {
5556
cfg.BasePath = "."
5657
}
58+
if cfg.BasePath, err = filepath.Abs(cfg.BasePath); err != nil {
59+
err = fmt.Errorf("unable to get absolute path to base path, %s", err)
60+
}
5761

5862
// Fetch repos, injecting default values where needed.
5963
if cfg.Repo == nil || len(cfg.Repo) == 0 {

0 commit comments

Comments
 (0)